From 53088234e4a45b5afa97bd1db1fc9742b5e8bbb0 Mon Sep 17 00:00:00 2001 From: Devarshi Shimpi Date: Fri, 18 Sep 2026 23:39:13 +0530 Subject: [PATCH 1/3] rm: duplicate login route --- .../src/components/layout/account-menu.tsx | 2 +- apps/dashboard/src/lib/api.ts | 8 +- apps/dashboard/src/pages/login.tsx | 102 ------------------ apps/dashboard/src/routes.tsx | 6 -- apps/worker/wrangler.jsonc | 1 - 5 files changed, 5 insertions(+), 114 deletions(-) delete mode 100644 apps/dashboard/src/pages/login.tsx diff --git a/apps/dashboard/src/components/layout/account-menu.tsx b/apps/dashboard/src/components/layout/account-menu.tsx index df91406c..0fefcf9b 100644 --- a/apps/dashboard/src/components/layout/account-menu.tsx +++ b/apps/dashboard/src/components/layout/account-menu.tsx @@ -162,7 +162,7 @@ export function AccountMenu({ user }: { user: AuthSessionUser }) { onClick={async () => { setOpen(false); await api.logout(); - location.href = '/login'; + location.href = '/'; }} > (input: string, init?: RequestInit) { }); if (response.status === 401) { - if (location.pathname !== '/login') { - location.href = '/login'; + if (location.pathname !== '/') { + location.href = '/'; } throw new Error('Unauthorized'); } @@ -92,8 +92,8 @@ async function requestWithMeta(input: string, init?: RequestInit) { }); if (response.status === 401) { - if (location.pathname !== '/login') { - location.href = '/login'; + if (location.pathname !== '/') { + location.href = '/'; } throw new Error('Unauthorized'); } diff --git a/apps/dashboard/src/pages/login.tsx b/apps/dashboard/src/pages/login.tsx deleted file mode 100644 index 3cccb8fe..00000000 --- a/apps/dashboard/src/pages/login.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import { GithubMark } from '@codraoss/ui'; -import { useMemo } from 'react'; -import { useSearchParams, Link } from 'react-router-dom'; -import { Sun, Moon, ShieldCheck, ArrowLeft, AlertCircle } from 'lucide-react'; -import { useTheme } from '@codraoss/ui/theme'; -import codraDark from '@/assets/codra-fullicon-dark.svg'; -import codraLight from '@/assets/codra-fullicon-light.svg'; - -function getErrorMessage(error: string | null) { - switch (error) { - case 'not_allowed': - return 'This GitHub account is not allowed to access the Codra dashboard.'; - case 'access_denied': - return 'GitHub sign-in was cancelled before authorization completed.'; - case 'invalid_state': - return 'Your sign-in session expired. Please try signing in with GitHub again.'; - case 'invalid_callback': - return 'GitHub did not return a valid callback. Please try again.'; - case 'oauth_failed': - return 'GitHub sign-in failed while completing the OAuth flow.'; - default: - return null; - } -} - -export function LoginPage() { - const { theme, toggleTheme } = useTheme(); - const [searchParams] = useSearchParams(); - const error = useMemo(() => getErrorMessage(searchParams.get('error')), [searchParams]); - - return ( -
- - - - Home - - - -
- -
-
- -
- -

- Only authorized GitHub users can access this instance. -

-
-
-
- ); -} diff --git a/apps/dashboard/src/routes.tsx b/apps/dashboard/src/routes.tsx index 5718d53c..ee2d5e6e 100644 --- a/apps/dashboard/src/routes.tsx +++ b/apps/dashboard/src/routes.tsx @@ -8,7 +8,6 @@ import type { NavItem } from '@client/nav'; const LandingPage = React.lazy(() => import('./pages/landing').then(m => ({ default: m.LandingPage }))); const DashboardPage = React.lazy(() => import('./pages/dashboard').then(m => ({ default: m.DashboardPage }))); -const LoginPage = React.lazy(() => import('./pages/login').then(m => ({ default: m.LoginPage }))); const JobsPage = React.lazy(() => import('./pages/jobs').then(m => ({ default: m.JobsPage }))); const JobDetailPage = React.lazy(() => import('./pages/job-detail').then(m => ({ default: m.JobDetailPage }))); const JobLogsPage = React.lazy(() => import('./pages/job-logs').then(m => ({ default: m.JobLogsPage }))); @@ -31,11 +30,6 @@ export const publicRoutes: RouteObject[] = [ element: withSuspense(LandingPage, true), errorElement: , }, - { - path: '/login', - element: withSuspense(LoginPage, true), - errorElement: , - }, ]; // A boundary per child too, not just on the layout: React Router replaces the whole matched branch, so a branch-only boundary would take the sidebar and header down with a single page. diff --git a/apps/worker/wrangler.jsonc b/apps/worker/wrangler.jsonc index f0e162f5..d55c8e1a 100644 --- a/apps/worker/wrangler.jsonc +++ b/apps/worker/wrangler.jsonc @@ -76,7 +76,6 @@ "not_found_handling": "single-page-application", "run_worker_first": [ "/", - "/login", "/dashboard*", "/jobs*", "/repos*", From 6642d470676fd8a541a6eb030c5518fab87c0ddc Mon Sep 17 00:00:00 2001 From: Devarshi Shimpi Date: Fri, 18 Sep 2026 23:44:00 +0530 Subject: [PATCH 2/3] fix: failing login route dashboard test --- test/e2e/dashboard.spec.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/e2e/dashboard.spec.tsx b/test/e2e/dashboard.spec.tsx index c8cc41f6..9af5177f 100644 --- a/test/e2e/dashboard.spec.tsx +++ b/test/e2e/dashboard.spec.tsx @@ -3,7 +3,7 @@ */ import { expect, it, describe, vi, beforeEach } from 'vitest'; import { render, screen } from '@testing-library/react'; -import { LoginPage } from '@client/pages/login'; +import { LandingPage } from '@client/pages/landing'; import { DashboardPage } from '@client/pages/dashboard'; import { MemoryRouter } from 'react-router-dom'; import { api } from '@client/lib/api'; @@ -34,12 +34,12 @@ describe('Frontend UI Flows (JSDOM)', () => { render( - + ); - const signInLink = screen.getByRole('link', { name: 'Sign in with GitHub' }); + const signInLink = screen.getByRole('link', { name: /continue with github/i }); expect(signInLink.getAttribute('href')).toBe('/auth/github'); }); From a660f86cc5c9b52fa7679c96aaa05b00c3138985 Mon Sep 17 00:00:00 2001 From: Devarshi Shimpi Date: Fri, 18 Sep 2026 23:45:24 +0530 Subject: [PATCH 3/3] fix: update expected routes in dashboard test --- test/e2e/router-extensions.spec.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/router-extensions.spec.tsx b/test/e2e/router-extensions.spec.tsx index 69f2489e..0ffaa0ca 100644 --- a/test/e2e/router-extensions.spec.tsx +++ b/test/e2e/router-extensions.spec.tsx @@ -41,7 +41,7 @@ describe('Dashboard route and nav registries (JSDOM)', () => { }); it('exposes the built-in routes as composable arrays', () => { - expect(publicRoutes.map((r) => r.path)).toEqual(['/', '/login']); + expect(publicRoutes.map((r) => r.path)).toEqual(['/']); expect(shellRoutes.map((r) => r.path)).toContain('dashboard'); expect([...publicRoutes, ...shellRoutes].map((r) => r.path)).not.toContain('*'); });