Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,5 @@ jobs:
- name: Run tests
run: bun run test

- name: Run integration tests
run: bunx vitest run src/integration_testing/

- name: Run build
run: bun run build
17 changes: 15 additions & 2 deletions src/api/responses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ export interface UserResponse {
updatedAt: string
}

export interface ReceivedResponse {
id: string
formId: string
formName: string
responder: string
email: string
answers: Record<string, unknown>
isSubmitted: boolean
status: string
createdAt: string
}

export interface SubmitResponseInput {
answers: Record<string, unknown>
isSubmitted?: boolean
Expand Down Expand Up @@ -131,12 +143,13 @@ export const responsesApi = {
},

// GET /responses/received - Get all responses RECEIVED for forms owned by the user
getAllReceived: async (): Promise<Array<any>> => {
getAllReceived: async (): Promise<Array<ReceivedResponse>> => {
const response = await fetch(`${API_URL}/responses/received`, {
method: 'GET',
headers: { 'Content-Type': 'application/json' },
credentials: 'include',
})
return handleResponse<Array<any>>(response)

return handleResponse<Array<ReceivedResponse>>(response)
},
}
1 change: 0 additions & 1 deletion src/components/app-sidebar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,5 @@ describe('AppSidebar', () => {
expect(await screen.findByText('Dashboard')).toBeInTheDocument();
expect(await screen.findByText('Editor')).toBeInTheDocument();
expect(await screen.findByText('Analytics')).toBeInTheDocument();
expect(await screen.findByText('Settings')).toBeInTheDocument();
});
});
6 changes: 0 additions & 6 deletions src/components/app-sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
LayoutDashboard,
LogOut,
Plus,
Settings,
} from 'lucide-react'

import { NavMain } from '@/components/nav-main'
Expand Down Expand Up @@ -62,11 +61,6 @@ const data = {
},
],
},
{
title: 'Settings',
url: '/settings',
icon: Settings,
},
],
}

Expand Down
21 changes: 21 additions & 0 deletions src/routeTree.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { Route as LayoutEditorIndexRouteImport } from './routes/_layout.editor.i
import { Route as LayoutAnalyticsIndexRouteImport } from './routes/_layout.analytics.index'
import { Route as LayoutEditorFormIdRouteImport } from './routes/_layout.editor.$formId'
import { Route as LayoutAnalyticsResponsesRouteImport } from './routes/_layout.analytics.responses'
import { Route as LayoutAnalyticsReportsRouteImport } from './routes/_layout.analytics.reports'

const SignupRoute = SignupRouteImport.update({
id: '/signup',
Expand Down Expand Up @@ -88,6 +89,11 @@ const LayoutAnalyticsResponsesRoute =
path: '/responses',
getParentRoute: () => LayoutAnalyticsRoute,
} as any)
const LayoutAnalyticsReportsRoute = LayoutAnalyticsReportsRouteImport.update({
id: '/reports',
path: '/reports',
getParentRoute: () => LayoutAnalyticsRoute,
} as any)

export interface FileRoutesByFullPath {
'/': typeof IndexRoute
Expand All @@ -98,6 +104,7 @@ export interface FileRoutesByFullPath {
'/dashboard': typeof LayoutDashboardRoute
'/my-responses': typeof LayoutMyResponsesRoute
'/form/$formId': typeof FormFormIdRoute
'/analytics/reports': typeof LayoutAnalyticsReportsRoute
'/analytics/responses': typeof LayoutAnalyticsResponsesRoute
'/editor/$formId': typeof LayoutEditorFormIdRoute
'/analytics/': typeof LayoutAnalyticsIndexRoute
Expand All @@ -111,6 +118,7 @@ export interface FileRoutesByTo {
'/dashboard': typeof LayoutDashboardRoute
'/my-responses': typeof LayoutMyResponsesRoute
'/form/$formId': typeof FormFormIdRoute
'/analytics/reports': typeof LayoutAnalyticsReportsRoute
'/analytics/responses': typeof LayoutAnalyticsResponsesRoute
'/editor/$formId': typeof LayoutEditorFormIdRoute
'/analytics': typeof LayoutAnalyticsIndexRoute
Expand All @@ -127,6 +135,7 @@ export interface FileRoutesById {
'/_layout/dashboard': typeof LayoutDashboardRoute
'/_layout/my-responses': typeof LayoutMyResponsesRoute
'/form/$formId': typeof FormFormIdRoute
'/_layout/analytics/reports': typeof LayoutAnalyticsReportsRoute
'/_layout/analytics/responses': typeof LayoutAnalyticsResponsesRoute
'/_layout/editor/$formId': typeof LayoutEditorFormIdRoute
'/_layout/analytics/': typeof LayoutAnalyticsIndexRoute
Expand All @@ -143,6 +152,7 @@ export interface FileRouteTypes {
| '/dashboard'
| '/my-responses'
| '/form/$formId'
| '/analytics/reports'
| '/analytics/responses'
| '/editor/$formId'
| '/analytics/'
Expand All @@ -156,6 +166,7 @@ export interface FileRouteTypes {
| '/dashboard'
| '/my-responses'
| '/form/$formId'
| '/analytics/reports'
| '/analytics/responses'
| '/editor/$formId'
| '/analytics'
Expand All @@ -171,6 +182,7 @@ export interface FileRouteTypes {
| '/_layout/dashboard'
| '/_layout/my-responses'
| '/form/$formId'
| '/_layout/analytics/reports'
| '/_layout/analytics/responses'
| '/_layout/editor/$formId'
| '/_layout/analytics/'
Expand Down Expand Up @@ -279,15 +291,24 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof LayoutAnalyticsResponsesRouteImport
parentRoute: typeof LayoutAnalyticsRoute
}
'/_layout/analytics/reports': {
id: '/_layout/analytics/reports'
path: '/reports'
fullPath: '/analytics/reports'
preLoaderRoute: typeof LayoutAnalyticsReportsRouteImport
parentRoute: typeof LayoutAnalyticsRoute
}
}
}

interface LayoutAnalyticsRouteChildren {
LayoutAnalyticsReportsRoute: typeof LayoutAnalyticsReportsRoute
LayoutAnalyticsResponsesRoute: typeof LayoutAnalyticsResponsesRoute
LayoutAnalyticsIndexRoute: typeof LayoutAnalyticsIndexRoute
}

const LayoutAnalyticsRouteChildren: LayoutAnalyticsRouteChildren = {
LayoutAnalyticsReportsRoute: LayoutAnalyticsReportsRoute,
LayoutAnalyticsResponsesRoute: LayoutAnalyticsResponsesRoute,
LayoutAnalyticsIndexRoute: LayoutAnalyticsIndexRoute,
}
Expand Down
23 changes: 23 additions & 0 deletions src/routes/_layout.analytics.reports.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { createFileRoute } from '@tanstack/react-router'
import { FileText } from 'lucide-react'

export const Route = createFileRoute('/_layout/analytics/reports')({
component: ReportsPage,
})

function ReportsPage() {
return (
<div className="h-full flex items-center justify-center p-6">
<div className="text-center max-w-md">
<div className="inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/10 mb-6">
<FileText className="h-8 w-8 text-primary" />
</div>
<h2 className="text-2xl font-bold tracking-tight mb-2">Reports Coming Soon</h2>
<p className="text-muted-foreground text-sm">
AI-powered analytics reports will be available here. Stay tuned!
</p>
</div>
</div>
)
}

16 changes: 4 additions & 12 deletions src/routes/_layout.analytics.responses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
X,
} from 'lucide-react'
import { useMemo, useState } from 'react'
import type { FormResponseForOwner } from '@/api/responses'
import type { ReceivedResponse } from '@/api/responses'
import type { Form } from '@/api/forms';
import { responsesApi } from '@/api/responses'
import { formsApi } from '@/api/forms'
Expand All @@ -31,14 +31,8 @@ export const Route = createFileRoute('/_layout/analytics/responses')({
component: ResponsesPage,
})

// Extended interface for frontend simulation
interface SimulatedResponse extends FormResponseForOwner {
responder?: string;
email?: string;
createdAt: string;
status?: string;
isSubmitted?: boolean;
}
// Extended interface for frontend display
type SimulatedResponse = ReceivedResponse

function ResponsesPage() {
const [searchTerm, setSearchTerm] = useState('')
Expand Down Expand Up @@ -378,9 +372,7 @@ function ResponsesPage() {
<div className="text-xs font-bold text-muted-foreground whitespace-nowrap">
{response.createdAt && !isNaN(Date.parse(response.createdAt))
? new Date(response.createdAt).toLocaleDateString()
: response.submittedAt && !isNaN(Date.parse(response.submittedAt))
? new Date(response.submittedAt).toLocaleDateString()
: '3/10/2026'}
: '—'}
</div>
<div className="text-[9px] text-muted-foreground/60 mt-1">
{response.createdAt && !isNaN(Date.parse(response.createdAt))
Expand Down
3 changes: 2 additions & 1 deletion src/routes/signin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ function Login() {
</button>
</form>

{/* Google sign-in disabled
<div className="relative my-6">
<div className="absolute inset-0 flex items-center">
<span className="w-full border-t border-border" />
Expand All @@ -155,7 +156,6 @@ function Login() {
onClick={() => {
const backendUrl = import.meta.env.VITE_API_URL || 'http://localhost:8000';
const callback = encodeURIComponent(window.location.origin + '/dashboard');
// Direct navigation to avoid XHR/cookie blocking
window.location.href = `${backendUrl}/signin/google?callback=${callback}`;
}}
>
Expand All @@ -179,6 +179,7 @@ function Login() {
</svg>
Sign in with Google
</button>
*/}

<p className="mt-6 text-center text-[13px] text-muted-foreground">
Don’t have an account?{' '}
Expand Down
3 changes: 2 additions & 1 deletion src/routes/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ function Signup() {
</button>
</form>

{/* Google sign-up disabled
<div className="relative my-6">
<div className="absolute inset-0 flex items-center">
<span className="w-full border-t border-border" />
Expand All @@ -268,7 +269,6 @@ function Signup() {
onClick={() => {
const backendUrl = import.meta.env.VITE_API_URL || 'http://localhost:8000';
const callback = encodeURIComponent(window.location.origin + '/dashboard');
// Direct navigation to avoid XHR/cookie blocking
window.location.href = `${backendUrl}/signin/google?callback=${callback}`;
}}
>
Expand All @@ -292,6 +292,7 @@ function Signup() {
</svg>
Sign up with Google
</button>
*/}

<p className="mt-6 text-center text-xs text-muted-foreground leading-relaxed px-4">
By clicking continue, you agree to our{' '}
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ export default defineConfig({
environment: 'jsdom',
globals: true,
setupFiles: ['./src/test/setup.ts'],
exclude: ['e2e/**', 'node_modules/**'],
exclude: ['e2e/**', 'node_modules/**', 'src/integration_testing/**'],
},
})
Loading