Skip to content
Draft
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b38e787
feat: Migrate from pages directory to app router
snomiao Oct 26, 2025
4839d40
fix: Remove conflicting pages directory files after app router migration
snomiao Oct 26, 2025
f62cc98
Merge remote-tracking branch 'origin/main' into sno-migrate-app-router
snomiao Oct 26, 2025
ee5b56d
fix: Complete app router migration by moving page components and addi…
snomiao Oct 26, 2025
74c8799
format: Apply prettier --fix changes
snomiao Oct 26, 2025
b18a36e
fix: Address Copilot review comments - fix comment and import paths
snomiao Oct 26, 2025
b72ee1d
Merge branch 'main' into sno-migrate-app-router
snomiao Oct 29, 2025
4135388
fix: Use @ alias for imports in app/providers.tsx
snomiao Oct 29, 2025
472d1d5
fix: Remove unused i18next import from app/layout.tsx
snomiao Oct 29, 2025
f3c206d
format: Apply prettier --fix changes
snomiao Oct 29, 2025
1b284e9
Merge branch 'main' into sno-migrate-app-router
snomiao Oct 30, 2025
955e548
docs: Add TODO comment for singletonRouter migration
snomiao Oct 30, 2025
14b2fbd
refactor: Migrate node pages to proper App Router structure
snomiao Oct 30, 2025
4d5f37f
refactor: Migrate publisher pages to proper App Router structure
snomiao Oct 30, 2025
3962362
feat: Add App Router version of useRouterQuery hook
snomiao Oct 30, 2025
e6778e1
refactor: Remove migrated page components from components/pages
snomiao Oct 30, 2025
bec08b9
refactor: Move components/pages into app directory
snomiao Nov 4, 2025
3172d3b
fix: Address Copilot review comments and fix build errors
snomiao Nov 10, 2025
d6fee20
chore: Resolve merge conflicts with main
snomiao Nov 10, 2025
63ca204
format: Apply prettier --fix changes
snomiao Nov 10, 2025
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
9 changes: 9 additions & 0 deletions app/admin/add-unclaimed-node/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use client'

import Component from '@/components/pages/admin/add-unclaimed-node'

export default function Page() {
return <Component />
}

export const dynamic = 'force-dynamic'
9 changes: 9 additions & 0 deletions app/admin/claim-nodes/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use client'

import Component from '@/components/pages/admin/claim-nodes'

export default function Page() {
return <Component />
}

export const dynamic = 'force-dynamic'
9 changes: 9 additions & 0 deletions app/admin/node-version-compatibility/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use client'

import Component from '@/components/pages/admin/node-version-compatibility'

export default function Page() {
return <Component />
}

export const dynamic = 'force-dynamic'
9 changes: 9 additions & 0 deletions app/admin/nodes/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use client'

import Component from '@/components/pages/admin/nodes'

export default function Page() {
return <Component />
}

export const dynamic = 'force-dynamic'
9 changes: 9 additions & 0 deletions app/admin/nodeversions/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use client'

import Component from '@/components/pages/admin/nodeversions'

export default function Page() {
return <Component />
}

export const dynamic = 'force-dynamic'
88 changes: 88 additions & 0 deletions app/admin/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
'use client'

import { Breadcrumb } from 'flowbite-react'
import Link from 'next/link'
import { useRouter } from 'next/navigation'
import {
HiHome,
HiOutlineAdjustments,
HiOutlineClipboardCheck,
HiOutlineCollection,
} from 'react-icons/hi'
import AdminTreeNavigation from '@/components/admin/AdminTreeNavigation'
import withAdmin from '@/components/common/HOC/authAdmin'
import { useNextTranslation } from '@/src/hooks/i18n'

function AdminDashboard() {
const router = useRouter()
const { t } = useNextTranslation()

return (
<div className="p-4">
<Breadcrumb className="py-4">
<Breadcrumb.Item href="/" icon={HiHome} className="dark">
{t('Home')}
</Breadcrumb.Item>
<Breadcrumb.Item href="#" className="dark">
{t('Admin Dashboard')}
</Breadcrumb.Item>
</Breadcrumb>

<h1 className="text-2xl font-bold text-gray-200 mb-6">
{t('Admin Dashboard')}
</h1>

<div className="grid grid-cols-1 lg:grid-cols-4 gap-6">
<div className="lg:col-span-1">
<AdminTreeNavigation />
</div>

<div className="lg:col-span-3">
<div className="bg-gray-800 rounded-lg p-6">
<h2 className="text-xl font-semibold text-gray-200 mb-4">
{t('Quick Actions')}
</h2>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
<Link
href="/admin/search-ranking"
className="bg-blue-600 hover:bg-blue-700 text-white rounded-lg p-4 flex items-center transition-colors"
>
<HiOutlineAdjustments className="h-8 w-8 mr-3" />
<span>{t('Search Ranking Table')}</span>
</Link>
<Link
href="/admin/nodeversions?filter=flagged"
className="bg-yellow-600 hover:bg-yellow-700 text-white rounded-lg p-4 flex items-center transition-colors"
>
<HiOutlineClipboardCheck className="h-8 w-8 mr-3" />
<span>{t('Review Flagged Versions')}</span>
</Link>
<Link
href="/admin/claim-nodes"
className="bg-green-600 hover:bg-green-700 text-white rounded-lg p-4 flex items-center transition-colors"
>
<HiOutlineCollection className="h-8 w-8 mr-3" />
<span>{t('Manage Unclaimed Nodes')}</span>
</Link>
<Link
href="/admin/nodes"
className="bg-purple-600 hover:bg-purple-700 text-white rounded-lg p-4 flex items-center transition-colors"
>
<HiOutlineCollection className="h-8 w-8 mr-3" />
<span>{t('Manage All Nodes')}</span>
</Link>
</div>
</div>
</div>
</div>
</div>
)
}

const WrappedAdminDashboard = withAdmin(AdminDashboard)

export default function Page() {
return <WrappedAdminDashboard />
}

export const dynamic = 'force-dynamic'
9 changes: 9 additions & 0 deletions app/admin/preempted-comfy-node-names/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use client'

import Component from '@/components/pages/admin/preempted-comfy-node-names'

export default function Page() {
return <Component />
}

export const dynamic = 'force-dynamic'
9 changes: 9 additions & 0 deletions app/admin/search-ranking/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use client'

import Component from '@/components/pages/admin/search-ranking'

export default function Page() {
return <Component />
}

export const dynamic = 'force-dynamic'
6 changes: 6 additions & 0 deletions app/auth/login/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react'
import SignIn from '@/components/AuthUI/AuthUI'

export default function SignInPage() {
return <SignIn />
}
6 changes: 6 additions & 0 deletions app/auth/logout/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react'
import Logout from '@/components/AuthUI/Logout'

export default function LogoutPage() {
return <Logout />
}
6 changes: 6 additions & 0 deletions app/auth/signup/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react'
import SignIn from '@/components/AuthUI/AuthUI'

export default function SignUpPage() {
return <SignIn />
}
32 changes: 32 additions & 0 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import i18next from 'i18next'
import { Metadata } from 'next'
import { Providers } from './providers'
import '../styles/globals.css'

export const metadata: Metadata = {
title: 'ComfyUI Registry',
description: 'Discover and install ComfyUI custom nodes.',
icons: {
icon: '/favicon.ico',
},
}

export const dynamic = 'force-dynamic'

export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
// Default to 'en', will be handled by i18n middleware/client-side detection
const locale = 'en'
const dir = i18next.dir(locale)

return (
<html lang={locale} dir={dir}>
<body>
<Providers>{children}</Providers>
</body>
</html>
)
}
9 changes: 9 additions & 0 deletions app/nodes/[nodeId]/claim/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use client'

import Component from '@/components/pages/nodes/claim'

export default function Page() {
return <Component />
}

export const dynamic = 'force-dynamic'
9 changes: 9 additions & 0 deletions app/nodes/[nodeId]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use client'

import Component from '@/components/pages/nodes/[nodeId]'

export default function Page() {
return <Component />
}

export const dynamic = 'force-dynamic'
5 changes: 5 additions & 0 deletions app/nodes/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Registry from '@/components/registry/Registry'

export default function NodeList() {
return <Registry />
Copy link

Copilot AI Oct 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The /nodes route renders the same Registry component as the home page (/), which may cause confusion. Consider whether this duplication is intentional or if these routes should render different content or have different configurations.

Suggested change
return <Registry />
return (
<>
<h1>Node List</h1>
<Registry />
</>
);

Copilot uses AI. Check for mistakes.
}
5 changes: 5 additions & 0 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Registry from '@/components/registry/Registry'

export default function Home() {
return <Registry />
}
126 changes: 126 additions & 0 deletions app/providers.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
'use client'

import { createSyncStoragePersister } from '@tanstack/query-sync-storage-persister'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { persistQueryClient } from '@tanstack/react-query-persist-client'
import { AxiosResponse } from 'axios'
import { getAuth } from 'firebase/auth'
import { ThemeModeScript } from 'flowbite-react'
import { useEffect, useState } from 'react'
import { ToastContainer } from 'react-toastify'
import 'react-toastify/dist/ReactToastify.css'
import { DIE } from 'phpdie'
import { AXIOS_INSTANCE } from '@/src/api/mutator/axios-instance'
import app from '@/src/firebase'
import FlowBiteThemeProvider from '../components/flowbite-theme'
import Layout from '../components/layout'

// Add an interceptor to attach the Firebase JWT token to every request
AXIOS_INSTANCE.interceptors.request.use(async (config) => {
const auth = getAuth(app)
const user = auth.currentUser
if (user) {
const token = await user.getIdToken()
sessionStorage.setItem('idToken', token)
config.headers.Authorization = `Bearer ${token}`
} else {
const cachedIdtoken = sessionStorage.getItem('idToken') ?? ''
if (cachedIdtoken) config.headers.Authorization = `Bearer ${cachedIdtoken}`
}
return config
})

const createQueryClient = () =>
new QueryClient({
defaultOptions: {
queries: {
retry: (failureCount, error: any) => {
// Don't retry on 404s
if (error?.response?.status === 404) return false

// Retry up to 3 times for other errors
return failureCount < 3
},
staleTime: 0, // set to 0 to always query fresh data when page refreshed, and render staled data while requesting (swr)
gcTime: 86400e3,
},
},
})

export function Providers({ children }: { children: React.ReactNode }) {
const [queryClient] = useState(() => createQueryClient())

useEffect(() => {
// General localStorage cache invalidation for all endpoints
// this interceptors will user always have latest data after edit.
const responseInterceptor = AXIOS_INSTANCE.interceptors.response.use(
function onSuccess(response: AxiosResponse) {
const req = response.config
if (!req.url) return response

const baseURL =
req.baseURL ??
globalThis.location.origin ??
DIE('Remember to fill window.location when testing axios')
const pathname = new URL(req.url, baseURL).pathname

const isCreateMethod = ['POST'].includes(
req.method!.toUpperCase() ?? ''
)
const isEditMethod = ['PUT', 'PATCH', 'DELETE'].includes(
req.method!.toUpperCase() ?? ''
)

if (isCreateMethod) {
queryClient.invalidateQueries({ queryKey: [pathname] })
}
if (isEditMethod) {
queryClient.invalidateQueries({ queryKey: [pathname] })
queryClient.invalidateQueries({
queryKey: [pathname.split('/').slice(0, -1).join('/')],
})
}
return response
},
(error) => {
return Promise.reject(error)
}
)

// Persist query client
const [unsubscribe] = persistQueryClient({
queryClient: queryClient as any,
persister: createSyncStoragePersister({
storage: window.localStorage,
key: 'comfy-registry-cache',
}),
// Only persist queries with these query keys
dehydrateOptions: {
shouldDehydrateQuery: ({ queryKey, state }) => {
// Don't persist pending queries as they can't be properly restored
if (state.status === 'pending') return false

// Persist all queries in localStorage, share across tabs
return true
},
},
maxAge: 86400e3, // 1 day in milliseconds
buster: process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA ?? 'v1',
})

return () => {
AXIOS_INSTANCE.interceptors.response.eject(responseInterceptor)
unsubscribe()
}
}, [queryClient])

return (
<QueryClientProvider client={queryClient}>
<ThemeModeScript />
<FlowBiteThemeProvider>
<Layout>{children}</Layout>
<ToastContainer />
</FlowBiteThemeProvider>
</QueryClientProvider>
)
}
9 changes: 9 additions & 0 deletions app/publishers/[publisherId]/claim-my-node/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use client'

import Component from '@/components/pages/publishers/claim-my-node'

export default function Page() {
return <Component />
}

export const dynamic = 'force-dynamic'
9 changes: 9 additions & 0 deletions app/publishers/[publisherId]/nodes/[nodeId]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
'use client'

import Component from '@/components/pages/publishers/[nodeId]'

export default function Page() {
return <Component />
}

export const dynamic = 'force-dynamic'
Loading