feat(react): reshape PaperlessUI.React to qyl.dashboard layout#4
Conversation
Replaces the empty Vite + React 19 scaffold with the qyl.dashboard structure:
src/
App.tsx # Router + Suspense + QueryClientProvider
main.tsx # unchanged
index.css # unchanged (placeholder)
vite-env.d.ts # vite/client types (added)
components/
layout/AppShell.tsx # navbar + <Outlet>
layout/AppNavbar.tsx # documents / upload / search nav
layout/index.ts
hooks/
use-documents.ts # TanStack Query example against /api/documents
lib/
api.ts # fetchJson / postJson wrapper
pages/
DocumentsPage.tsx
UploadPage.tsx
SearchPage.tsx
types/ # openapi-typescript output target
__tests__/
setup.ts # @testing-library/jest-dom
Configuration:
- vite.config.ts: @/* alias to src, /api proxy to PaperlessREST (5057),
manualChunks splits react-vendor + tanstack
- vitest.config.ts: jsdom env, globals, setup from __tests__/setup.ts
- tsconfig.json: single flat config with @/* path alias, "noEmit": true
(replaces tsconfig.{app,node}.json — `tsc --noEmit && vite build` in scripts)
- package.json adds @tanstack/react-query, react-router-dom, jsdom,
openapi-typescript, @testing-library/jest-dom; gains generate:types script
Deleted: src/App.css, src/assets/{hero.png,react.svg,vite.svg} (boilerplate).
Build verified: vite build emits lazy chunks for each page plus react-vendor
(230.89 kB) and tanstack (33.27 kB) split bundles.
Follow-ups:
- Wire generate:openapi to flow PaperlessREST OpenAPI → src/types/api.ts
- Tailwind 4 + Base UI for component primitives (qyl-style)
- Playwright e2e + Dockerfile/nginx.conf.template parity with qyl.dashboard
- ESLint flat config restricting Radix imports
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (24)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR replaces the default Vite/React scaffold in PaperlessUI.React with a more structured “dashboard-style” React app layout (components/hooks/lib/pages/types/tests), wiring in React Router and TanStack Query as the foundation for future PaperlessREST integration.
Changes:
- Introduces routing + layout shell (
AppShell+ navbar) and lazy-loaded pages (Documents,Upload,Search). - Adds a basic API layer (
fetchJson/postJson) and a TanStack Query example hook (useDocuments). - Updates tooling/config: Vite proxy + chunk splitting, new Vitest config, flattened
tsconfig, and new dependencies/scripts.
Reviewed changes
Copilot reviewed 19 out of 24 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| PaperlessUI.React/vitest.config.ts | Adds Vitest config with jsdom, setup file, and @ alias. |
| PaperlessUI.React/vite.config.ts | Adds @ alias, /api proxy, and Rollup chunk splitting. |
| PaperlessUI.React/tsconfig.node.json | Removes node-specific tsconfig. |
| PaperlessUI.React/tsconfig.app.json | Removes app-specific tsconfig. |
| PaperlessUI.React/tsconfig.json | Replaces project references with a single strict TS config and @/* paths. |
| PaperlessUI.React/src/vite-env.d.ts | Restores Vite client type references. |
| PaperlessUI.React/src/types/.gitkeep | Adds placeholder file for future generated OpenAPI types output. |
| PaperlessUI.React/src/pages/UploadPage.tsx | Adds placeholder Upload page. |
| PaperlessUI.React/src/pages/SearchPage.tsx | Adds placeholder Search page. |
| PaperlessUI.React/src/pages/DocumentsPage.tsx | Adds initial Documents page consuming useDocuments. |
| PaperlessUI.React/src/lib/api.ts | Adds JSON fetch helpers. |
| PaperlessUI.React/src/hooks/use-documents.ts | Adds example TanStack Query hook for documents. |
| PaperlessUI.React/src/components/layout/index.ts | Adds layout barrel exports. |
| PaperlessUI.React/src/components/layout/AppShell.tsx | Adds layout route wrapper with <Outlet />. |
| PaperlessUI.React/src/components/layout/AppNavbar.tsx | Adds navbar with route links. |
| PaperlessUI.React/src/assets/vite.svg | Removes default Vite asset. |
| PaperlessUI.React/src/assets/react.svg | Removes default React asset. |
| PaperlessUI.React/src/App.tsx | Replaces starter app with Router + Suspense + QueryClientProvider wiring. |
| PaperlessUI.React/src/App.css | Removes scaffold CSS. |
| PaperlessUI.React/src/tests/setup.ts | Adds test setup importing jest-dom matchers. |
| PaperlessUI.React/pnpm-lock.yaml | Updates lockfile for new dependencies (router/query/vitest/jsdom/openapi-typescript). |
| PaperlessUI.React/package.json | Adds deps, test/type scripts, and OpenAPI types generation script; updates build command. |
| PaperlessUI.React/index.html | Updates page title to “Paperless”. |
Files not reviewed (1)
- PaperlessUI.React/pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| resolve: { | ||
| alias: { | ||
| '@': resolve(__dirname, './src'), | ||
| }, | ||
| }, |
| resolve: { | ||
| alias: { | ||
| '@': resolve(__dirname, './src'), | ||
| }, | ||
| }, |
| export async function fetchJson<T>(url: string, init?: RequestInit): Promise<T> { | ||
| const res = await fetch(url, init); | ||
| if (!res.ok) throw new Error(`HTTP ${res.status}: ${res.statusText}`); | ||
| return res.json() as Promise<T>; |
| "test": "vitest", | ||
| "test:coverage": "vitest run --coverage", | ||
| "typecheck": "tsc --noEmit", | ||
| "generate:types": "openapi-typescript ../PaperlessREST/openapi/paperless.json -o src/types/api.ts" |
| export function useDocuments() { | ||
| return useQuery({ | ||
| queryKey: ['documents'], | ||
| queryFn: () => fetchJson<DocumentSummary[]>('/api/documents'), |
Summary
components / hooks / lib / pages / types / __tests__layout.App.tsxwiresBrowserRouter+Suspense+QueryClientProvider. Each page is lazy-imported (DocumentsPage,UploadPage,SearchPage);AppShell(navbar +<Outlet />) is the layout route.hooks/use-documents.tsshows the TanStack Query +fetchJsonpattern against/api/documentsfor follow-up wiring.vite.config.ts:@/*alias tosrc/,/apiproxy to PaperlessREST (http://localhost:5057),manualChunkssplitsreact-vendor+tanstack.vitest.config.tsseparated from vite (jsdom env, globals, setup fromsrc/__tests__/setup.ts).tsconfig.jsonflattened to a single file with the@/*path alias and"noEmit": true; the oldtsconfig.{app,node}.jsonare removed in favor oftsc --noEmit && vite build.@tanstack/react-query,react-router-dom,jsdom,openapi-typescript,@testing-library/jest-dom,@vitest/coverage-v8,vitest. pnpm stays as the package manager to keep the current CI job intact.Test plan
pnpm install && pnpm run buildsucceeds locally; lazy page chunks emitted;react-vendor(230.89 kB) andtanstack(33.27 kB) split as configuredBuild (PaperlessUI.React)job greenFollow-ups
generate:openapiscript + flow PaperlessREST OpenAPI →src/types/api.tsDockerfile/nginx.conf.templateparity with qyl.dashboard