Spaces:
Sleeping
Sleeping
Commit ·
1643ce8
1
Parent(s): 51c39cf
Initial React Transcription
Browse filesFiles changed (33)
- README.md+39-20
- frontend/index.html+1-1
- frontend/package-lock.json+1026-26
- frontend/package.json+6-1
- frontend/postcss.config.jsAdded+6
- frontend/public/assets/client-logo.pngAdded
- frontend/public/assets/prosento-logo.pngAdded
- frontend/public/templates/job-sheet-template.htmlAdded+286
- frontend/src/App.tsx+22-1
- frontend/src/components/PageFooter.tsxAdded+12
- frontend/src/components/PageHeader.tsxAdded+35
- frontend/src/components/PageShell.tsxAdded+19
- frontend/src/components/report-editor.jsAdded+1177
- frontend/src/index.css+16-11
- frontend/src/lib/api.tsAdded+55
- frontend/src/lib/format.tsAdded+12
- frontend/src/lib/session.tsAdded+27
- frontend/src/main.tsx+1
- frontend/src/pages/EditLayoutsPage.tsxAdded+49
- frontend/src/pages/ExportPage.tsxAdded+273
- frontend/src/pages/ProcessingPage.tsxAdded+86
- frontend/src/pages/ReportViewerPage.tsxAdded+336
- frontend/src/pages/ReviewSetupPage.tsxAdded+376
- frontend/src/pages/UploadPage.tsxAdded+411
- frontend/src/types/custom-elements.d.tsAdded+27
- frontend/src/types/session.tsAdded+67
- frontend/src/vite-env.d.ts+8
- frontend/tailwind.config.jsAdded+8
- frontend/tsconfig.json+1-1
- frontend/vite.config.ts+3
- server/app/api/routes/sessions.py+14
- server/app/main.py+20-4
- server/app/services/session_store.py+18-1
12345678910111213141516171819202122232425262728293031323334353637383940411 unmodified line434445464748493 unmodified lines535455# RepEx Web StarterStatic HTML pages at the project root served by a FastAPI backend (API + static files).## Project Layout```/index.htmlprocessing.htmlreview-setup.htmlreport-viewer.htmledit-layouts.htmlexport.htmlstyle.cssscript.jscomponents/report-editor.jstemplates/job-sheet-template.htmlassets/prosento-logo.pngclient-logo.pngserver/app/api/routes/health.pyrouter.pycore/config.pymain.pyfrontend/ (optional Vite starter)```## Quick Start### Server (API + static pages)```powershellpython -m venv .venv.venv\Scripts\activate1 unmodified lineuvicorn server.app.main:app --reload --port 8000```Open `http://localhost:8000/index.html`.## Configuration3 unmodified lines- `CORS_ORIGINS` (comma-separated, default: `http://localhost:5173`)- `STORAGE_DIR` (default: `data`)- `MAX_UPLOAD_MB` (default: `50`)12345678910111213141516171819202122232425262728293031323334353637381 unmodified line40414243444546474849505152535455565758596061626364653 unmodified lines697071727374# RepEx Web StarterReact (Vite) frontend + FastAPI backend with local session storage.## Project Layout```/server/app/api/routes/health.pysessions.pyrouter.pycore/config.pyservices/session_store.pymain.pyfrontend/public/assets/templates/src/components/pages/lib/index.htmlvite.config.ts```## Quick Start (Dev)### Backend (API)```powershellpython -m venv .venv.venv\Scripts\activate1 unmodified lineuvicorn server.app.main:app --reload --port 8000```### Frontend (Vite)```powershellcd frontendnpm installnpm run dev```Open `http://localhost:5173`.## Production```powershellcd frontendnpm run build```Start the API server; it will serve `frontend/dist` if present:```uvicorn server.app.main:app --host 0.0.0.0 --port 8000```## Configuration3 unmodified lines- `CORS_ORIGINS` (comma-separated, default: `http://localhost:5173`)- `STORAGE_DIR` (default: `data`)- `MAX_UPLOAD_MB` (default: `50`)Frontend environment variables:- `VITE_API_BASE` (optional, default: `/api`)
3 unmodified lines456789103 unmodified lines<meta charset="UTF-8" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>Starter</title></head><body><div id="root"></div>3 unmodified lines456789103 unmodified lines<meta charset="UTF-8" /><link rel="icon" type="image/svg+xml" href="/favicon.svg" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>RepEx</title></head><body><div id="root"></div>
8 unmodified lines9101112131415161718192021222324720 unmodified lines745746747748749750106 unmodified lines85785885986086186286386486586686786886987087187211 unmodified lines8848858868878888898908918928938942 unmodified lines89789889990090190290390411 unmodified lines91691791891992092192292392492592615 unmodified lines94294394494594694794894941 unmodified lines99199299399499599699799899910001001100212 unmodified lines1015101610171018101910209 unmodified lines1030103110321033103410352 unmodified lines10381039104010411042104320 unmodified lines10641065106610671068106912 unmodified lines10821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111115 unmodified lines11271128112911301131113221 unmodified lines11541155115611571158115915 unmodified lines1175117611771178117911802 unmodified lines11831184118511861187118834 unmodified lines12231224122512261227122817 unmodified lines12461247124812491250125111 unmodified lines1263126412651266126712687 unmodified lines127612771278127912801281128221 unmodified lines1304130513061307130813098 unmodified lines"version": "0.1.0","dependencies": {"react": "^18.3.1","react-dom": "^18.3.1"},"devDependencies": {"@types/react": "^18.3.3","@types/react-dom": "^18.3.3","@vitejs/plugin-react": "^4.3.1","typescript": "^5.4.5","vite": "^7.3.1"}},"node_modules/@babel/code-frame": {"version": "7.27.1","dev": true,720 unmodified lines"@jridgewell/sourcemap-codec": "^1.4.14"}},"node_modules/@rolldown/pluginutils": {"version": "1.0.0-beta.27","dev": true,106 unmodified lines"vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"}},"node_modules/baseline-browser-mapping": {"version": "2.8.16","dev": true,"license": "Apache-2.0","bin": {"baseline-browser-mapping": "dist/cli.js"}},"node_modules/browserslist": {"version": "4.26.3","dev": true,"funding": [{11 unmodified lines],"license": "MIT","dependencies": {"baseline-browser-mapping": "^2.8.9","caniuse-lite": "^1.0.30001746","electron-to-chromium": "^1.5.227","node-releases": "^2.0.21","update-browserslist-db": "^1.1.3"},"bin": {"browserslist": "cli.js"2 unmodified lines"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"}},"node_modules/caniuse-lite": {"version": "1.0.30001750","dev": true,"funding": [{11 unmodified lines],"license": "CC-BY-4.0"},"node_modules/convert-source-map": {"version": "2.0.0","dev": true,"license": "MIT"},"node_modules/csstype": {"version": "3.1.3","dev": true,15 unmodified lines}}},"node_modules/electron-to-chromium": {"version": "1.5.237","dev": true,"license": "ISC"},41 unmodified lines},"node_modules/escalade": {"version": "3.2.0","dev": true,"license": "MIT","engines": {"node": ">=6"}},"node_modules/fdir": {"version": "6.5.0","resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",12 unmodified lines}}},"node_modules/fsevents": {"version": "2.3.3","resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",9 unmodified lines"node": "^8.16.0 || ^10.6.0 || >=11.0.0"}},"node_modules/gensync": {"version": "1.0.0-beta.2","dev": true,2 unmodified lines"node": ">=6.9.0"}},"node_modules/js-tokens": {"version": "4.0.0","license": "MIT"20 unmodified lines"node": ">=6"}},"node_modules/loose-envify": {"version": "1.4.0","license": "MIT",12 unmodified lines"yallist": "^3.0.2"}},"node_modules/ms": {"version": "2.1.3","dev": true,"license": "MIT"},"node_modules/nanoid": {"version": "3.3.11","dev": true,"funding": [{"type": "github","url": "https://github.com/sponsors/ai"}],"license": "MIT","bin": {"nanoid": "bin/nanoid.cjs"},"engines": {"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"}},"node_modules/node-releases": {"version": "2.0.23","dev": true,"license": "MIT"},15 unmodified lines"url": "https://github.com/sponsors/jonschlinkert"}},"node_modules/postcss": {"version": "8.5.6","dev": true,21 unmodified lines"node": "^10 || ^12 || >=14"}},"node_modules/react": {"version": "18.3.1","license": "MIT",15 unmodified lines"react": "^18.3.1"}},"node_modules/react-refresh": {"version": "0.17.0","dev": true,2 unmodified lines"node": ">=0.10.0"}},"node_modules/rollup": {"version": "4.52.4","dev": true,34 unmodified lines"fsevents": "~2.3.2"}},"node_modules/scheduler": {"version": "0.23.2","license": "MIT",17 unmodified lines"node": ">=0.10.0"}},"node_modules/tinyglobby": {"version": "0.2.15","resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",11 unmodified lines"url": "https://github.com/sponsors/SuperchupuDev"}},"node_modules/typescript": {"version": "5.9.3","dev": true,7 unmodified lines}},"node_modules/update-browserslist-db": {"version": "1.1.3","dev": true,"funding": [{21 unmodified lines"browserslist": ">= 4.21.0"}},"node_modules/vite": {"version": "7.3.1","resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz",8 unmodified lines9101112131415161718192021222324252627282930313233343536373839404142720 unmodified lines763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815106 unmodified lines922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104511 unmodified lines105710581059106010611062106310641065106610672 unmodified lines1070107110721073107410751076107710781079108010811082108310841085108610871088108911 unmodified lines11011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117215 unmodified lines11881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121141 unmodified lines12531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130612 unmodified lines1319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013519 unmodified lines13611362136313641365136613671368136913701371137213731374137513762 unmodified lines1379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148220 unmodified lines1503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152812 unmodified lines15411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165715 unmodified lines1673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169821 unmodified lines172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189115 unmodified lines1907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919302 unmodified lines193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203834 unmodified lines20732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210217 unmodified lines212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222211 unmodified lines223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822597 unmodified lines22672268226922702271227222732274227521 unmodified lines22972298229923002301230223032304230523062307230823098 unmodified lines"version": "0.1.0","dependencies": {"react": "^18.3.1","react-dom": "^18.3.1","react-feather": "^2.0.10","react-router-dom": "^6.26.2"},"devDependencies": {"@types/react": "^18.3.3","@types/react-dom": "^18.3.3","@vitejs/plugin-react": "^4.3.1","autoprefixer": "^10.4.20","postcss": "^8.4.41","tailwindcss": "^3.4.10","typescript": "^5.4.5","vite": "^7.3.1"}},"node_modules/@alloc/quick-lru": {"version": "5.2.0","resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz","integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==","dev": true,"license": "MIT","engines": {"node": ">=10"},"funding": {"url": "https://github.com/sponsors/sindresorhus"}},"node_modules/@babel/code-frame": {"version": "7.27.1","dev": true,720 unmodified lines"@jridgewell/sourcemap-codec": "^1.4.14"}},"node_modules/@nodelib/fs.scandir": {"version": "2.1.5","resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz","integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==","dev": true,"license": "MIT","dependencies": {"@nodelib/fs.stat": "2.0.5","run-parallel": "^1.1.9"},"engines": {"node": ">= 8"}},"node_modules/@nodelib/fs.stat": {"version": "2.0.5","resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz","integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==","dev": true,"license": "MIT","engines": {"node": ">= 8"}},"node_modules/@nodelib/fs.walk": {"version": "1.2.8","resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz","integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==","dev": true,"license": "MIT","dependencies": {"@nodelib/fs.scandir": "2.1.5","fastq": "^1.6.0"},"engines": {"node": ">= 8"}},"node_modules/@remix-run/router": {"version": "1.23.2","resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.23.2.tgz","integrity": "sha512-Ic6m2U/rMjTkhERIa/0ZtXJP17QUi2CbWE7cqx4J58M8aA3QTfW+2UlQ4psvTX9IO1RfNVhK3pcpdjej7L+t2w==","license": "MIT","engines": {"node": ">=14.0.0"}},"node_modules/@rolldown/pluginutils": {"version": "1.0.0-beta.27","dev": true,106 unmodified lines"vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"}},"node_modules/any-promise": {"version": "1.3.0","resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz","integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==","dev": true,"license": "MIT"},"node_modules/anymatch": {"version": "3.1.3","resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz","integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==","dev": true,"license": "ISC","dependencies": {"normalize-path": "^3.0.0","picomatch": "^2.0.4"},"engines": {"node": ">= 8"}},"node_modules/anymatch/node_modules/picomatch": {"version": "2.3.1","resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz","integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==","dev": true,"license": "MIT","engines": {"node": ">=8.6"},"funding": {"url": "https://github.com/sponsors/jonschlinkert"}},"node_modules/arg": {"version": "5.0.2","resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz","integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==","dev": true,"license": "MIT"},"node_modules/autoprefixer": {"version": "10.4.24","resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.24.tgz","integrity": "sha512-uHZg7N9ULTVbutaIsDRoUkoS8/h3bdsmVJYZ5l3wv8Cp/6UIIoRDm90hZ+BwxUj/hGBEzLxdHNSKuFpn8WOyZw==","dev": true,"funding": [{"type": "opencollective","url": "https://opencollective.com/postcss/"},{"type": "tidelift","url": "https://tidelift.com/funding/github/npm/autoprefixer"},{"type": "github","url": "https://github.com/sponsors/ai"}],"license": "MIT","dependencies": {"browserslist": "^4.28.1","caniuse-lite": "^1.0.30001766","fraction.js": "^5.3.4","picocolors": "^1.1.1","postcss-value-parser": "^4.2.0"},"bin": {"autoprefixer": "bin/autoprefixer"},"engines": {"node": "^10 || ^12 || >=14"},"peerDependencies": {"postcss": "^8.1.0"}},"node_modules/baseline-browser-mapping": {"version": "2.9.19","resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.19.tgz","integrity": "sha512-ipDqC8FrAl/76p2SSWKSI+H9tFwm7vYqXQrItCuiVPt26Km0jS+NzSsBWAaBusvSbQcfJG+JitdMm+wZAgTYqg==","dev": true,"license": "Apache-2.0","bin": {"baseline-browser-mapping": "dist/cli.js"}},"node_modules/binary-extensions": {"version": "2.3.0","resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz","integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==","dev": true,"license": "MIT","engines": {"node": ">=8"},"funding": {"url": "https://github.com/sponsors/sindresorhus"}},"node_modules/braces": {"version": "3.0.3","resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz","integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==","dev": true,"license": "MIT","dependencies": {"fill-range": "^7.1.1"},"engines": {"node": ">=8"}},"node_modules/browserslist": {"version": "4.28.1","resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.1.tgz","integrity": "sha512-ZC5Bd0LgJXgwGqUknZY/vkUQ04r8NXnJZ3yYi4vDmSiZmC/pdSN0NbNRPxZpbtO4uAfDUAFffO8IZoM3Gj8IkA==","dev": true,"funding": [{11 unmodified lines],"license": "MIT","dependencies": {"baseline-browser-mapping": "^2.9.0","caniuse-lite": "^1.0.30001759","electron-to-chromium": "^1.5.263","node-releases": "^2.0.27","update-browserslist-db": "^1.2.0"},"bin": {"browserslist": "cli.js"2 unmodified lines"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"}},"node_modules/camelcase-css": {"version": "2.0.1","resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz","integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==","dev": true,"license": "MIT","engines": {"node": ">= 6"}},"node_modules/caniuse-lite": {"version": "1.0.30001767","resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001767.tgz","integrity": "sha512-34+zUAMhSH+r+9eKmYG+k2Rpt8XttfE4yXAjoZvkAPs15xcYQhyBYdalJ65BzivAvGRMViEjy6oKr/S91loekQ==","dev": true,"funding": [{11 unmodified lines],"license": "CC-BY-4.0"},"node_modules/chokidar": {"version": "3.6.0","resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz","integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==","dev": true,"license": "MIT","dependencies": {"anymatch": "~3.1.2","braces": "~3.0.2","glob-parent": "~5.1.2","is-binary-path": "~2.1.0","is-glob": "~4.0.1","normalize-path": "~3.0.0","readdirp": "~3.6.0"},"engines": {"node": ">= 8.10.0"},"funding": {"url": "https://paulmillr.com/funding/"},"optionalDependencies": {"fsevents": "~2.3.2"}},"node_modules/chokidar/node_modules/glob-parent": {"version": "5.1.2","resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz","integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==","dev": true,"license": "ISC","dependencies": {"is-glob": "^4.0.1"},"engines": {"node": ">= 6"}},"node_modules/commander": {"version": "4.1.1","resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz","integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==","dev": true,"license": "MIT","engines": {"node": ">= 6"}},"node_modules/convert-source-map": {"version": "2.0.0","dev": true,"license": "MIT"},"node_modules/cssesc": {"version": "3.0.0","resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz","integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==","dev": true,"license": "MIT","bin": {"cssesc": "bin/cssesc"},"engines": {"node": ">=4"}},"node_modules/csstype": {"version": "3.1.3","dev": true,15 unmodified lines}}},"node_modules/didyoumean": {"version": "1.2.2","resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz","integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==","dev": true,"license": "Apache-2.0"},"node_modules/dlv": {"version": "1.1.3","resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz","integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==","dev": true,"license": "MIT"},"node_modules/electron-to-chromium": {"version": "1.5.283","resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.283.tgz","integrity": "sha512-3vifjt1HgrGW/h76UEeny+adYApveS9dH2h3p57JYzBSXJIKUJAvtmIytDKjcSCt9xHfrNCFJ7gts6vkhuq++w==","dev": true,"license": "ISC"},41 unmodified lines},"node_modules/escalade": {"version": "3.2.0","resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz","integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==","dev": true,"license": "MIT","engines": {"node": ">=6"}},"node_modules/fast-glob": {"version": "3.3.3","resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz","integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==","dev": true,"license": "MIT","dependencies": {"@nodelib/fs.stat": "^2.0.2","@nodelib/fs.walk": "^1.2.3","glob-parent": "^5.1.2","merge2": "^1.3.0","micromatch": "^4.0.8"},"engines": {"node": ">=8.6.0"}},"node_modules/fast-glob/node_modules/glob-parent": {"version": "5.1.2","resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz","integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==","dev": true,"license": "ISC","dependencies": {"is-glob": "^4.0.1"},"engines": {"node": ">= 6"}},"node_modules/fastq": {"version": "1.20.1","resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz","integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==","dev": true,"license": "ISC","dependencies": {"reusify": "^1.0.4"}},"node_modules/fdir": {"version": "6.5.0","resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",12 unmodified lines}}},"node_modules/fill-range": {"version": "7.1.1","resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz","integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==","dev": true,"license": "MIT","dependencies": {"to-regex-range": "^5.0.1"},"engines": {"node": ">=8"}},"node_modules/fraction.js": {"version": "5.3.4","resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz","integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==","dev": true,"license": "MIT","engines": {"node": "*"},"funding": {"type": "github","url": "https://github.com/sponsors/rawify"}},"node_modules/fsevents": {"version": "2.3.3","resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",9 unmodified lines"node": "^8.16.0 || ^10.6.0 || >=11.0.0"}},"node_modules/function-bind": {"version": "1.1.2","resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz","integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==","dev": true,"license": "MIT","funding": {"url": "https://github.com/sponsors/ljharb"}},"node_modules/gensync": {"version": "1.0.0-beta.2","dev": true,2 unmodified lines"node": ">=6.9.0"}},"node_modules/glob-parent": {"version": "6.0.2","resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz","integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==","dev": true,"license": "ISC","dependencies": {"is-glob": "^4.0.3"},"engines": {"node": ">=10.13.0"}},"node_modules/hasown": {"version": "2.0.2","resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz","integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==","dev": true,"license": "MIT","dependencies": {"function-bind": "^1.1.2"},"engines": {"node": ">= 0.4"}},"node_modules/is-binary-path": {"version": "2.1.0","resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz","integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==","dev": true,"license": "MIT","dependencies": {"binary-extensions": "^2.0.0"},"engines": {"node": ">=8"}},"node_modules/is-core-module": {"version": "2.16.1","resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.1.tgz","integrity": "sha512-UfoeMA6fIJ8wTYFEUjelnaGI67v6+N7qXJEvQuIGa99l4xsCruSYOVSQ0uPANn4dAzm8lkYPaKLrrijLq7x23w==","dev": true,"license": "MIT","dependencies": {"hasown": "^2.0.2"},"engines": {"node": ">= 0.4"},"funding": {"url": "https://github.com/sponsors/ljharb"}},"node_modules/is-extglob": {"version": "2.1.1","resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz","integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==","dev": true,"license": "MIT","engines": {"node": ">=0.10.0"}},"node_modules/is-glob": {"version": "4.0.3","resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz","integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==","dev": true,"license": "MIT","dependencies": {"is-extglob": "^2.1.1"},"engines": {"node": ">=0.10.0"}},"node_modules/is-number": {"version": "7.0.0","resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz","integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==","dev": true,"license": "MIT","engines": {"node": ">=0.12.0"}},"node_modules/jiti": {"version": "1.21.7","resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz","integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==","dev": true,"license": "MIT","bin": {"jiti": "bin/jiti.js"}},"node_modules/js-tokens": {"version": "4.0.0","license": "MIT"20 unmodified lines"node": ">=6"}},"node_modules/lilconfig": {"version": "3.1.3","resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz","integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==","dev": true,"license": "MIT","engines": {"node": ">=14"},"funding": {"url": "https://github.com/sponsors/antonk52"}},"node_modules/lines-and-columns": {"version": "1.2.4","resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz","integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==","dev": true,"license": "MIT"},"node_modules/loose-envify": {"version": "1.4.0","license": "MIT",12 unmodified lines"yallist": "^3.0.2"}},"node_modules/merge2": {"version": "1.4.1","resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz","integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==","dev": true,"license": "MIT","engines": {"node": ">= 8"}},"node_modules/micromatch": {"version": "4.0.8","resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz","integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==","dev": true,"license": "MIT","dependencies": {"braces": "^3.0.3","picomatch": "^2.3.1"},"engines": {"node": ">=8.6"}},"node_modules/micromatch/node_modules/picomatch": {"version": "2.3.1","resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz","integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==","dev": true,"license": "MIT","engines": {"node": ">=8.6"},"funding": {"url": "https://github.com/sponsors/jonschlinkert"}},"node_modules/ms": {"version": "2.1.3","dev": true,"license": "MIT"},"node_modules/mz": {"version": "2.7.0","resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz","integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==","dev": true,"license": "MIT","dependencies": {"any-promise": "^1.0.0","object-assign": "^4.0.1","thenify-all": "^1.0.0"}},"node_modules/nanoid": {"version": "3.3.11","dev": true,"funding": [{"type": "github","url": "https://github.com/sponsors/ai"}],"license": "MIT","bin": {"nanoid": "bin/nanoid.cjs"},"engines": {"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"}},"node_modules/node-releases": {"version": "2.0.27","resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.27.tgz","integrity": "sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==","dev": true,"license": "MIT"},"node_modules/normalize-path": {"version": "3.0.0","resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz","integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==","dev": true,"license": "MIT","engines": {"node": ">=0.10.0"}},"node_modules/object-assign": {"version": "4.1.1","resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz","integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==","license": "MIT","engines": {"node": ">=0.10.0"}},"node_modules/object-hash": {"version": "3.0.0","resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz","integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==","dev": true,"license": "MIT","engines": {"node": ">= 6"}},"node_modules/path-parse": {"version": "1.0.7","resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz","integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==","dev": true,"license": "MIT"},15 unmodified lines"url": "https://github.com/sponsors/jonschlinkert"}},"node_modules/pify": {"version": "2.3.0","resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz","integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==","dev": true,"license": "MIT","engines": {"node": ">=0.10.0"}},"node_modules/pirates": {"version": "4.0.7","resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz","integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==","dev": true,"license": "MIT","engines": {"node": ">= 6"}},"node_modules/postcss": {"version": "8.5.6","dev": true,21 unmodified lines"node": "^10 || ^12 || >=14"}},"node_modules/postcss-import": {"version": "15.1.0","resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz","integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==","dev": true,"license": "MIT","dependencies": {"postcss-value-parser": "^4.0.0","read-cache": "^1.0.0","resolve": "^1.1.7"},"engines": {"node": ">=14.0.0"},"peerDependencies": {"postcss": "^8.0.0"}},"node_modules/postcss-js": {"version": "4.1.0","resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.1.0.tgz","integrity": "sha512-oIAOTqgIo7q2EOwbhb8UalYePMvYoIeRY2YKntdpFQXNosSu3vLrniGgmH9OKs/qAkfoj5oB3le/7mINW1LCfw==","dev": true,"funding": [{"type": "opencollective","url": "https://opencollective.com/postcss/"},{"type": "github","url": "https://github.com/sponsors/ai"}],"license": "MIT","dependencies": {"camelcase-css": "^2.0.1"},"engines": {"node": "^12 || ^14 || >= 16"},"peerDependencies": {"postcss": "^8.4.21"}},"node_modules/postcss-load-config": {"version": "6.0.1","resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz","integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==","dev": true,"funding": [{"type": "opencollective","url": "https://opencollective.com/postcss/"},{"type": "github","url": "https://github.com/sponsors/ai"}],"license": "MIT","dependencies": {"lilconfig": "^3.1.1"},"engines": {"node": ">= 18"},"peerDependencies": {"jiti": ">=1.21.0","postcss": ">=8.0.9","tsx": "^4.8.1","yaml": "^2.4.2"},"peerDependenciesMeta": {"jiti": {"optional": true},"postcss": {"optional": true},"tsx": {"optional": true},"yaml": {"optional": true}}},"node_modules/postcss-nested": {"version": "6.2.0","resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.2.0.tgz","integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==","dev": true,"funding": [{"type": "opencollective","url": "https://opencollective.com/postcss/"},{"type": "github","url": "https://github.com/sponsors/ai"}],"license": "MIT","dependencies": {"postcss-selector-parser": "^6.1.1"},"engines": {"node": ">=12.0"},"peerDependencies": {"postcss": "^8.2.14"}},"node_modules/postcss-selector-parser": {"version": "6.1.2","resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz","integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==","dev": true,"license": "MIT","dependencies": {"cssesc": "^3.0.0","util-deprecate": "^1.0.2"},"engines": {"node": ">=4"}},"node_modules/postcss-value-parser": {"version": "4.2.0","resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz","integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==","dev": true,"license": "MIT"},"node_modules/prop-types": {"version": "15.8.1","resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz","integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==","license": "MIT","dependencies": {"loose-envify": "^1.4.0","object-assign": "^4.1.1","react-is": "^16.13.1"}},"node_modules/queue-microtask": {"version": "1.2.3","resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz","integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==","dev": true,"funding": [{"type": "github","url": "https://github.com/sponsors/feross"},{"type": "patreon","url": "https://www.patreon.com/feross"},{"type": "consulting","url": "https://feross.org/support"}],"license": "MIT"},"node_modules/react": {"version": "18.3.1","license": "MIT",15 unmodified lines"react": "^18.3.1"}},"node_modules/react-feather": {"version": "2.0.10","resolved": "https://registry.npmjs.org/react-feather/-/react-feather-2.0.10.tgz","integrity": "sha512-BLhukwJ+Z92Nmdcs+EMw6dy1Z/VLiJTzEQACDUEnWMClhYnFykJCGWQx+NmwP/qQHGX/5CzQ+TGi8ofg2+HzVQ==","license": "MIT","dependencies": {"prop-types": "^15.7.2"},"peerDependencies": {"react": ">=16.8.6"}},"node_modules/react-is": {"version": "16.13.1","resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz","integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==","license": "MIT"},"node_modules/react-refresh": {"version": "0.17.0","dev": true,2 unmodified lines"node": ">=0.10.0"}},"node_modules/react-router": {"version": "6.30.3","resolved": "https://registry.npmjs.org/react-router/-/react-router-6.30.3.tgz","integrity": "sha512-XRnlbKMTmktBkjCLE8/XcZFlnHvr2Ltdr1eJX4idL55/9BbORzyZEaIkBFDhFGCEWBBItsVrDxwx3gnisMitdw==","license": "MIT","dependencies": {"@remix-run/router": "1.23.2"},"engines": {"node": ">=14.0.0"},"peerDependencies": {"react": ">=16.8"}},"node_modules/react-router-dom": {"version": "6.30.3","resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.30.3.tgz","integrity": "sha512-pxPcv1AczD4vso7G4Z3TKcvlxK7g7TNt3/FNGMhfqyntocvYKj+GCatfigGDjbLozC4baguJ0ReCigoDJXb0ag==","license": "MIT","dependencies": {"@remix-run/router": "1.23.2","react-router": "6.30.3"},"engines": {"node": ">=14.0.0"},"peerDependencies": {"react": ">=16.8","react-dom": ">=16.8"}},"node_modules/read-cache": {"version": "1.0.0","resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz","integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==","dev": true,"license": "MIT","dependencies": {"pify": "^2.3.0"}},"node_modules/readdirp": {"version": "3.6.0","resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz","integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==","dev": true,"license": "MIT","dependencies": {"picomatch": "^2.2.1"},"engines": {"node": ">=8.10.0"}},"node_modules/readdirp/node_modules/picomatch": {"version": "2.3.1","resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz","integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==","dev": true,"license": "MIT","engines": {"node": ">=8.6"},"funding": {"url": "https://github.com/sponsors/jonschlinkert"}},"node_modules/resolve": {"version": "1.22.11","resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.11.tgz","integrity": "sha512-RfqAvLnMl313r7c9oclB1HhUEAezcpLjz95wFH4LVuhk9JF/r22qmVP9AMmOU4vMX7Q8pN8jwNg/CSpdFnMjTQ==","dev": true,"license": "MIT","dependencies": {"is-core-module": "^2.16.1","path-parse": "^1.0.7","supports-preserve-symlinks-flag": "^1.0.0"},"bin": {"resolve": "bin/resolve"},"engines": {"node": ">= 0.4"},"funding": {"url": "https://github.com/sponsors/ljharb"}},"node_modules/reusify": {"version": "1.1.0","resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz","integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==","dev": true,"license": "MIT","engines": {"iojs": ">=1.0.0","node": ">=0.10.0"}},"node_modules/rollup": {"version": "4.52.4","dev": true,34 unmodified lines"fsevents": "~2.3.2"}},"node_modules/run-parallel": {"version": "1.2.0","resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz","integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==","dev": true,"funding": [{"type": "github","url": "https://github.com/sponsors/feross"},{"type": "patreon","url": "https://www.patreon.com/feross"},{"type": "consulting","url": "https://feross.org/support"}],"license": "MIT","dependencies": {"queue-microtask": "^1.2.2"}},"node_modules/scheduler": {"version": "0.23.2","license": "MIT",17 unmodified lines"node": ">=0.10.0"}},"node_modules/sucrase": {"version": "3.35.1","resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz","integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==","dev": true,"license": "MIT","dependencies": {"@jridgewell/gen-mapping": "^0.3.2","commander": "^4.0.0","lines-and-columns": "^1.1.6","mz": "^2.7.0","pirates": "^4.0.1","tinyglobby": "^0.2.11","ts-interface-checker": "^0.1.9"},"bin": {"sucrase": "bin/sucrase","sucrase-node": "bin/sucrase-node"},"engines": {"node": ">=16 || 14 >=14.17"}},"node_modules/supports-preserve-symlinks-flag": {"version": "1.0.0","resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz","integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==","dev": true,"license": "MIT","engines": {"node": ">= 0.4"},"funding": {"url": "https://github.com/sponsors/ljharb"}},"node_modules/tailwindcss": {"version": "3.4.19","resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz","integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==","dev": true,"license": "MIT","dependencies": {"@alloc/quick-lru": "^5.2.0","arg": "^5.0.2","chokidar": "^3.6.0","didyoumean": "^1.2.2","dlv": "^1.1.3","fast-glob": "^3.3.2","glob-parent": "^6.0.2","is-glob": "^4.0.3","jiti": "^1.21.7","lilconfig": "^3.1.3","micromatch": "^4.0.8","normalize-path": "^3.0.0","object-hash": "^3.0.0","picocolors": "^1.1.1","postcss": "^8.4.47","postcss-import": "^15.1.0","postcss-js": "^4.0.1","postcss-load-config": "^4.0.2 || ^5.0 || ^6.0","postcss-nested": "^6.2.0","postcss-selector-parser": "^6.1.2","resolve": "^1.22.8","sucrase": "^3.35.0"},"bin": {"tailwind": "lib/cli.js","tailwindcss": "lib/cli.js"},"engines": {"node": ">=14.0.0"}},"node_modules/thenify": {"version": "3.3.1","resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz","integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==","dev": true,"license": "MIT","dependencies": {"any-promise": "^1.0.0"}},"node_modules/thenify-all": {"version": "1.6.0","resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz","integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==","dev": true,"license": "MIT","dependencies": {"thenify": ">= 3.1.0 < 4"},"engines": {"node": ">=0.8"}},"node_modules/tinyglobby": {"version": "0.2.15","resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz",11 unmodified lines"url": "https://github.com/sponsors/SuperchupuDev"}},"node_modules/to-regex-range": {"version": "5.0.1","resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz","integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==","dev": true,"license": "MIT","dependencies": {"is-number": "^7.0.0"},"engines": {"node": ">=8.0"}},"node_modules/ts-interface-checker": {"version": "0.1.13","resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz","integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==","dev": true,"license": "Apache-2.0"},"node_modules/typescript": {"version": "5.9.3","dev": true,7 unmodified lines}},"node_modules/update-browserslist-db": {"version": "1.2.3","resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz","integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==","dev": true,"funding": [{21 unmodified lines"browserslist": ">= 4.21.0"}},"node_modules/util-deprecate": {"version": "1.0.2","resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz","integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==","dev": true,"license": "MIT"},"node_modules/vite": {"version": "7.3.1","resolved": "https://registry.npmjs.org/vite/-/vite-7.3.1.tgz",
9 unmodified lines1011121314151617181920219 unmodified lines},"dependencies": {"react": "^18.3.1","react-dom": "^18.3.1"},"devDependencies": {"@types/react": "^18.3.3","@types/react-dom": "^18.3.3","@vitejs/plugin-react": "^4.3.1","typescript": "^5.4.5","vite": "^7.3.1"}9 unmodified lines10111213141516171819202122232425269 unmodified lines},"dependencies": {"react": "^18.3.1","react-dom": "^18.3.1","react-feather": "^2.0.10","react-router-dom": "^6.26.2"},"devDependencies": {"@types/react": "^18.3.3","@types/react-dom": "^18.3.3","@vitejs/plugin-react": "^4.3.1","autoprefixer": "^10.4.20","postcss": "^8.4.41","tailwindcss": "^3.4.10","typescript": "^5.4.5","vite": "^7.3.1"}
123456export default { plugins: { tailwindcss: {}, autoprefixer: {}, },};123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286<!doctype html><html lang="en"><head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>SIMM Inspection Job Sheet</title>
<!-- Optional project stylesheet --> <link rel="stylesheet" href="../style.css" />
<!-- Tailwind (CDN OK for prototypes; compile for production) --> <script src="https://cdn.tailwindcss.com"></script>
<!-- Feather icons --> <script defer src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<style> @page { size: A4; margin: 10mm; }
@media print { html, body { background: #fff !important; } .no-print { display: none !important; } main { box-shadow: none !important; border: none !important; margin: 0 !important; padding: 0 !important; } }
.avoid-break { break-inside: avoid; page-break-inside: avoid; } img { -webkit-print-color-adjust: exact; print-color-adjust: exact; } </style></head>
<body class="bg-gray-50 print:bg-white"> <!-- A4-focused container --> <main class="mx-auto max-w-[210mm] bg-white shadow-sm ring-1 ring-gray-200 rounded-xl p-5 print:ring-0 print:shadow-none print:rounded-none"> <!-- Header --> <header class="mb-4 border-b border-gray-200 pb-3"> <div class="grid grid-cols-[auto,1fr,auto] items-center gap-3"> <div class="flex items-center"> <img src="../assets/prosento-logo.png" alt="Prosento logo" class="h-10 w-auto object-contain" loading="eager" /> </div>
<div class="text-center leading-tight"> <h1 class="text-2xl font-bold text-gray-900 whitespace-nowrap">SIMM Inspection Job Sheet</h1> <p class="text-sm text-gray-600 whitespace-nowrap">Structural Inspection and Maintenance Management</p> </div>
<div class="flex items-center justify-end"> <img src="../assets/client-logo.png" alt="Client logo placeholder" class="h-10 w-auto object-contain" loading="eager" /> </div> </div> </header>
<!-- Inspection Details --> <section class="mb-4" aria-labelledby="inspection-details-title"> <h2 id="inspection-details-title" class="text-base font-semibold text-gray-800 border-b border-gray-200 pb-1 mb-2"> Inspection Details </h2>
<dl class="grid grid-cols-2 md:grid-cols-4 gap-2 bg-gray-50 border border-gray-200 rounded-lg p-3"> <div class="space-y-0.5"> <dt class="text-xs font-medium text-gray-500">Inspection Date</dt> <dd class="text-sm font-semibold text-gray-900">2023-11-15</dd> </div>
<div class="space-y-0.5"> <dt class="text-xs font-medium text-gray-500">Inspector</dt> <dd class="text-sm font-semibold text-gray-900">John Doe</dd> </div>
<div class="space-y-0.5"> <dt class="text-xs font-medium text-gray-500">Accompanied By</dt> <dd class="text-sm font-semibold text-gray-900">John Doe</dd> </div>
<div class="space-y-0.5"> <dt class="text-xs font-medium text-gray-500">Document No</dt> <dd class="text-sm font-mono font-semibold text-gray-900">SIMM-JS-2023-001</dd> </div>
<div class="space-y-0.5 md:col-span-2"> <dt class="text-xs font-medium text-gray-500">Project</dt> <dd class="text-sm font-semibold text-gray-900">North Pit - Sector 4 Conveyor Upgrade</dd> </div>
<div class="space-y-0.5 md:col-span-2"> <dt class="text-xs font-medium text-gray-500">Client / Site</dt> <dd class="text-sm font-semibold text-gray-900">Tronox</dd> </div> </dl> </section>
<!-- Observations and Findings --> <section class="mb-4" aria-labelledby="observations-title"> <h2 id="observations-title" class="text-base font-semibold text-gray-800 border-b border-gray-200 pb-1 mb-2"> Observations and Findings </h2>
<div class="grid grid-cols-1 md:grid-cols-2 gap-3"> <!-- Left column --> <div class="space-y-2"> <div class="grid grid-cols-2 gap-2"> <div class="space-y-0.5"> <div class="text-xs font-medium text-gray-500">Reference</div> <div class="text-sm font-semibold text-gray-900">REF-7821</div> </div>
<div class="space-y-0.5"> <div class="text-xs font-medium text-gray-500">Action Type</div> <div class="text-sm font-semibold text-gray-900">Structural Repair</div> </div>
<div class="space-y-0.5 col-span-2"> <div class="text-xs font-medium text-gray-500">Item Description</div> <div class="text-sm font-semibold text-gray-900">Main support beam for conveyor CV-04</div> </div> </div> </div>
<!-- Right column --> <div class="space-y-2"> <div class="space-y-0.5"> <div class="text-xs font-medium text-gray-500">Functional Location</div> <div class="text-sm font-semibold text-gray-900">Conveyor Support - CV-04-SUP-02</div> </div> </div>
<!-- Centered Category + Priority (must be direct child of the grid) --> <div class="md:col-span-2 flex justify-center"> <div class="inline-flex items-center gap-10"> <div class="text-center space-y-1"> <div class="text-xs font-medium text-gray-500">Category</div> <span id="condition-rating" class="badge inline-flex items-center justify-center rounded-md border px-4 py-1 text-sm font-semibold" aria-label="Category rating" > <!-- populated by JS --> </span> </div>
<div class="text-center space-y-1"> <div class="text-xs font-medium text-gray-500">Priority</div> <span id="priority-rating" class="badge inline-flex items-center justify-center rounded-md border px-4 py-1 text-sm font-semibold" aria-label="Priority rating" > <!-- populated by JS --> </span> </div> </div> </div>
<!-- Full-width: Condition Description --> <div class="md:col-span-2 space-y-1"> <div class="text-xs font-medium text-gray-500">Condition Description</div> <div class="bg-amber-50 border-l-4 border-amber-300 p-2 rounded-sm"> <p class="text-amber-800 text-sm font-semibold leading-snug"> Visible corrosion on lower flange with ~15% material loss. Surface pitting along entire length. </p> </div> </div>
<!-- Full-width: Required Action --> <div class="md:col-span-2 space-y-1"> <div class="text-xs font-medium text-gray-500">Required Action</div> <div class="bg-blue-50 border-l-4 border-blue-300 p-2 rounded-sm"> <p class="text-blue-800 text-sm font-semibold leading-snug"> Clean exposed rebar; apply corrosion protection; use wet-to-dry epoxy; reinstate with concrete repair. Complete within next 12 months to limit further degradation. </p> </div> </div> </div> </section>
<!-- Photo Documentation --> <section class="mb-4 avoid-break" aria-labelledby="photo-doc-title"> <h2 id="photo-doc-title" class="text-base font-semibold text-gray-800 border-b border-gray-200 pb-1 mb-2"> Photo Documentation </h2>
<div class="grid grid-cols-2 gap-3"> <figure class="border border-gray-200 rounded-lg p-2 bg-gray-50"> <img src="https://huggingface.co/spaces/ChristopherJKoen/minefix-simm-inspector/resolve/main/images/Screenshot%202026-02-02%20100102.png" alt="Photo 1" class="w-full h-40 object-contain mx-auto" loading="eager" /> <figcaption class="text-[11px] text-gray-600 mt-1 text-center leading-tight"> Fig 1: Ref 1.1 - Concrete spalling (example) </figcaption> </figure>
<figure class="border border-gray-200 rounded-lg p-2 bg-gray-50 relative"> <img src="https://huggingface.co/spaces/ChristopherJKoen/minefix-simm-inspector/resolve/main/images/Picture2.png" alt="Photo 2" class="w-full h-40 object-contain mx-auto" loading="eager" /> <div class="absolute top-2 left-2 bg-white/95 text-black text-[11px] font-bold px-2 py-1 rounded border border-gray-300"> #1.2 [C3, P3] Moderate Corrosion </div> <figcaption class="text-[11px] text-gray-600 mt-1 text-center leading-tight"> Fig 2: Ref 1.2 - Walkway corrosion (example) </figcaption> </figure> </div> </section>
<!-- Signatures --> <section class="mt-6" aria-label="Signatures"> <div class="grid grid-cols-3 gap-4"> <div class="border-t pt-2"> <div class="text-xs font-medium text-gray-500">Inspected By</div> <div class="h-10 mt-1 border-b border-gray-300"></div> <p class="text-[11px] text-gray-500 mt-1">Name / Signature / Date</p> </div>
<div class="border-t pt-2"> <div class="text-xs font-medium text-gray-500">Approved By</div> <div class="h-10 mt-1 border-b border-gray-300"></div> <p class="text-[11px] text-gray-500 mt-1">Name / Signature / Date</p> </div>
<div class="border-t pt-2"> <div class="text-xs font-medium text-gray-500">Completed By</div> <div class="h-10 mt-1 border-b border-gray-300"></div> <p class="text-[11px] text-gray-500 mt-1">Name / Signature / Date</p> </div> </div> </section>
<!-- Footer --> <footer class="mt-4 text-center text-[11px] text-gray-500"> <p>Prosento - (c) 2026 All Rights Reserved</p> <p class="mt-0.5">Automatically generated job sheet</p> </footer> </main>
<script> document.addEventListener('DOMContentLoaded', () => { // Badge tone system const TONES = { amber: ['bg-amber-50', 'text-amber-800', 'border-amber-200'], emerald: ['bg-emerald-50', 'text-emerald-800', 'border-emerald-200'], gray: ['bg-gray-50', 'text-gray-700', 'border-gray-200'], };
const BASE_BADGE = 'inline-flex items-center justify-center rounded-md border px-4 py-1 text-sm font-semibold';
function setBadge(id, text, toneKey) { const el = document.getElementById(id); if (!el) return; const tone = TONES[toneKey] || TONES.gray; el.className = `${BASE_BADGE} ${tone.join(' ')}`; el.textContent = text; }
setBadge('condition-rating', '3 - Poor', 'amber'); setBadge('priority-rating', '3 - 3 Years', 'emerald');
// Icons if (window.feather && typeof window.feather.replace === 'function') { window.feather.replace(); }
// Ensure images are loaded before printing window.addEventListener('beforeprint', () => { document.querySelectorAll('img').forEach(img => (img.loading = 'eager')); }); }); </script></body></html>123export default function App() {return <div className="black-screen" />;}123456789101112131415161718192021222324import { BrowserRouter, Navigate, Route, Routes } from "react-router-dom";import UploadPage from "./pages/UploadPage";import ProcessingPage from "./pages/ProcessingPage";import ReviewSetupPage from "./pages/ReviewSetupPage";import ReportViewerPage from "./pages/ReportViewerPage";import EditLayoutsPage from "./pages/EditLayoutsPage";import ExportPage from "./pages/ExportPage";export default function App() {return (<BrowserRouter><Routes><Route path="/" element={<UploadPage />} /><Route path="/processing" element={<ProcessingPage />} /><Route path="/review-setup" element={<ReviewSetupPage />} /><Route path="/report-viewer" element={<ReportViewerPage />} /><Route path="/edit-layouts" element={<EditLayoutsPage />} /><Route path="/export" element={<ExportPage />} /><Route path="*" element={<Navigate to="/" replace />} /></Routes></BrowserRouter>);}
123456789101112type PageFooterProps = { note?: string;};
export function PageFooter({ note }: PageFooterProps) { return ( <footer className="mt-12 text-center text-xs text-gray-500"> <p>Prosento - (c) 2026 All Rights Reserved</p> {note ? <p className="mt-1">{note}</p> : null} </footer> );}1234567891011121314151617181920212223242526272829303132333435import type { ReactNode } from "react";
type PageHeaderProps = { title: string; subtitle?: string; right?: ReactNode;};
export function PageHeader({ title, subtitle, right }: PageHeaderProps) { return ( <header className="mb-8 border-b border-gray-200 pb-4"> <div className="grid grid-cols-[auto,1fr,auto] items-center gap-4"> <div className="flex items-center"> <img src="/assets/prosento-logo.png" alt="Company logo" className="h-12 w-auto object-contain" loading="eager" /> </div>
<div className="text-center"> <h1 className="text-2xl md:text-3xl font-bold text-gray-900 whitespace-nowrap"> {title} </h1> {subtitle ? ( <p className="text-gray-600 whitespace-nowrap">{subtitle}</p> ) : null} </div>
<div className="flex justify-end">{right}</div> </div> </header> );}12345678910111213141516171819import type { ReactNode } from "react";
type PageShellProps = { children: ReactNode; className?: string;};
export function PageShell({ children, className = "" }: PageShellProps) { return ( <main className={[ "max-w-4xl mx-auto my-8 bg-white shadow-sm ring-1 ring-gray-200 rounded-xl p-6 md:p-8", className, ].join(" ")} > {children} </main> );}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177// @ts-nocheckclass ReportEditor extends HTMLElement { constructor() { super(); this._mounted = false;
this.BASE_W = 595; // A4 points-ish (screen independent model) this.BASE_H = 842;
this.state = { isOpen: false, zoom: 1, activePage: 0, pages: [], // [{ items: [...] }] selectedId: null, tool: "select", // select | text | rect dragging: null, // { id, startX, startY, origX, origY } resizing: null, // { id, handle, startX, startY, orig } undo: [], // stack of serialized states (current page) redo: [], payload: null, };
this.sessionId = null; this.apiBase = null; this._saveTimer = null; }
connectedCallback() { if (this._mounted) return; this._mounted = true; this.render(); this.bind(); this.hide(); }
// Public API open({ payload, pageIndex = 0, totalPages = 6, sessionId = null, apiBase = null } = {}) { this.state.payload = payload ?? null; this.state.isOpen = true; this.sessionId = sessionId || (window.REPEX && typeof window.REPEX.getSessionId === "function" ? window.REPEX.getSessionId() : null); this.apiBase = apiBase || window.REPEX_API_BASE || (window.REPEX && window.REPEX.apiBase ? window.REPEX.apiBase : null);
// Load existing editor pages from storage, else initialize const stored = this._loadPages(); if (stored && Array.isArray(stored.pages) && stored.pages.length) { this.state.pages = stored.pages; } else { this.state.pages = Array.from({ length: totalPages }, () => ({ items: [] })); this._savePages(); }
this.state.activePage = Math.min(Math.max(0, pageIndex), this.state.pages.length - 1); this.state.selectedId = null; this.state.tool = "select"; this.state.undo = []; this.state.redo = [];
this.show(); this.updateAll();
if (this.sessionId) { this._loadPagesFromServer().then((pages) => { if (pages && pages.length) { this.state.pages = pages; this.state.activePage = Math.min( Math.max(0, pageIndex), this.state.pages.length - 1 ); this.updateAll(); } }); } }
close() { this.state.isOpen = false; this.hide(); this.dispatchEvent(new CustomEvent("editor-closed", { bubbles: true })); }
// ---------- Rendering ---------- render() { this.innerHTML = ` <div class="fixed inset-0 z-50 hidden" data-overlay> <div class="absolute inset-0 bg-black/30"></div>
<div class="relative h-full w-full flex items-center justify-center p-4"> <div class="w-full max-w-6xl bg-white rounded-xl shadow-sm ring-1 ring-gray-200 overflow-hidden"> <!-- Header --> <div class="flex items-center justify-between px-4 py-3 border-b border-gray-200"> <div class="flex items-center gap-2"> <div class="inline-flex h-9 w-9 items-center justify-center rounded-lg bg-gray-50 border border-gray-200"> <span class="text-xs font-bold text-gray-700">A4</span> </div> <div> <div class="text-sm font-semibold text-gray-900">Edit Report</div> <div class="text-xs text-gray-500">Drag, resize, format and arrange elements</div> </div> </div>
<div class="flex items-center gap-2"> <button data-btn="undo" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition disabled:opacity-50 disabled:cursor-not-allowed"> <i data-feather="rotate-ccw" class="h-4 w-4"></i> Undo </button> <button data-btn="redo" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition disabled:opacity-50 disabled:cursor-not-allowed"> <i data-feather="rotate-cw" class="h-4 w-4"></i> Redo </button>
<button data-btn="save" class="inline-flex items-center gap-2 rounded-lg bg-emerald-600 px-3 py-2 text-sm font-semibold text-white hover:bg-emerald-700 transition"> <i data-feather="save" class="h-4 w-4"></i> Save </button>
<button data-btn="close" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="x" class="h-4 w-4"></i> Done </button> </div> </div>
<!-- Body --> <div class="grid grid-cols-1 lg:grid-cols-[240px,1fr,280px] gap-0 min-h-[70vh]"> <!-- Pages sidebar --> <aside class="border-r border-gray-200 bg-white p-3"> <div class="flex items-center justify-between mb-3"> <div class="text-sm font-semibold text-gray-900">Pages</div> <button data-btn="add-page" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-2.5 py-1.5 text-xs font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="plus" class="h-4 w-4"></i> Add </button> </div>
<div class="space-y-2 max-h-[60vh] overflow-auto pr-1" data-page-list></div>
<div class="mt-3 text-xs text-gray-500"> Tip: Click a page to edit. Your edits are saved to the server. </div> </aside>
<!-- Canvas + toolbar --> <section class="bg-gray-50 p-3"> <!-- Toolbar --> <div class="flex flex-wrap items-center justify-between gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 mb-3"> <div class="flex flex-wrap items-center gap-2"> <button data-tool="select" class="toolBtn inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="mouse-pointer" class="h-4 w-4"></i> Select </button>
<button data-tool="text" class="toolBtn inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="type" class="h-4 w-4"></i> Text </button>
<button data-tool="rect" class="toolBtn inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="square" class="h-4 w-4"></i> Shape </button>
<button data-btn="add-image" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="image" class="h-4 w-4"></i> Image </button>
<input data-file="image" type="file" accept="image/*" class="hidden" /> </div>
<div class="flex items-center gap-2"> <div class="text-xs font-semibold text-gray-600">Zoom</div> <button data-btn="zoom-out" class="inline-flex items-center justify-center rounded-lg border border-gray-200 bg-white p-2 hover:bg-gray-50 transition"> <i data-feather="minus" class="h-4 w-4"></i> </button> <div class="text-xs font-semibold text-gray-700 w-14 text-center" data-zoom-label>100%</div> <button data-btn="zoom-in" class="inline-flex items-center justify-center rounded-lg border border-gray-200 bg-white p-2 hover:bg-gray-50 transition"> <i data-feather="plus" class="h-4 w-4"></i> </button> </div> </div>
<!-- Canvas area --> <div class="flex justify-center"> <div class="relative" data-canvas-wrap> <div data-canvas class="relative bg-white border border-gray-200 rounded-xl shadow-sm overflow-hidden select-none" style="width: min(100%, 700px); aspect-ratio: 210/297;" aria-label="Editable A4 canvas" > <!-- items injected here --> </div> </div> </div>
<div class="mt-3 text-xs text-gray-500"> Drag elements to move. Drag corner handles to resize. Double-click text to edit. </div> </section>
<!-- Properties panel --> <aside class="border-l border-gray-200 bg-white p-3"> <div class="text-sm font-semibold text-gray-900 mb-2">Properties</div>
<div data-empty-props class="text-sm text-gray-600 rounded-lg border border-gray-200 bg-gray-50 p-3"> Select an element to edit formatting and layout options. </div>
<div data-props class="hidden space-y-4"> <!-- Arrange --> <div class="rounded-lg border border-gray-200 p-3"> <div class="text-xs font-semibold text-gray-600 mb-2">Arrange</div> <div class="flex flex-wrap gap-2"> <button data-btn="bring-front" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="chevrons-up" class="h-4 w-4"></i> Front </button> <button data-btn="send-back" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="chevrons-down" class="h-4 w-4"></i> Back </button> <button data-btn="duplicate" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="copy" class="h-4 w-4"></i> Duplicate </button> <button data-btn="delete" class="inline-flex items-center gap-2 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-xs font-semibold text-red-700 hover:bg-red-100 transition"> <i data-feather="trash-2" class="h-4 w-4"></i> Delete </button> </div> </div>
<!-- Text controls --> <div data-props-text class="rounded-lg border border-gray-200 p-3 hidden"> <div class="text-xs font-semibold text-gray-600 mb-2">Text</div>
<div class="grid grid-cols-2 gap-2"> <label class="text-xs text-gray-600"> Font size <input data-prop="fontSize" type="number" min="8" max="72" class="mt-1 w-full rounded-lg border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-200 focus:border-blue-500" /> </label>
<label class="text-xs text-gray-600"> Color <input data-prop="color" type="color" class="mt-1 w-full h-[40px] rounded-lg border border-gray-300 px-2 py-1" /> </label> </div>
<div class="flex flex-wrap gap-2 mt-2"> <button data-btn="bold" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="bold" class="h-4 w-4"></i> </button> <button data-btn="italic" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="italic" class="h-4 w-4"></i> </button> <button data-btn="underline" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="underline" class="h-4 w-4"></i> </button>
<button data-btn="align-left" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="align-left" class="h-4 w-4"></i> </button> <button data-btn="align-center" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="align-center" class="h-4 w-4"></i> </button> <button data-btn="align-right" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="align-right" class="h-4 w-4"></i> </button> </div> </div>
<!-- Shape controls --> <div data-props-rect class="rounded-lg border border-gray-200 p-3 hidden"> <div class="text-xs font-semibold text-gray-600 mb-2">Shape</div>
<div class="grid grid-cols-2 gap-2"> <label class="text-xs text-gray-600"> Fill <input data-prop="fill" type="color" class="mt-1 w-full h-[40px] rounded-lg border border-gray-300 px-2 py-1" /> </label>
<label class="text-xs text-gray-600"> Border <input data-prop="stroke" type="color" class="mt-1 w-full h-[40px] rounded-lg border border-gray-300 px-2 py-1" /> </label> </div>
<label class="text-xs text-gray-600 block mt-2"> Border width <input data-prop="strokeWidth" type="number" min="0" max="12" class="mt-1 w-full rounded-lg border border-gray-300 px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-blue-200 focus:border-blue-500" /> </label> </div>
<!-- Image controls --> <div data-props-image class="rounded-lg border border-gray-200 p-3 hidden"> <div class="text-xs font-semibold text-gray-600 mb-2">Image</div> <button data-btn="replace-image" class="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-xs font-semibold text-gray-800 hover:bg-gray-50 transition"> <i data-feather="refresh-cw" class="h-4 w-4"></i> Replace image </button> <input data-file="replace" type="file" accept="image/*" class="hidden" /> </div> </div>
<div class="mt-4 rounded-lg border border-gray-200 bg-gray-50 p-3 text-xs text-gray-600"> <div class="font-semibold text-gray-800 mb-1">Keyboard shortcuts</div> <ul class="list-disc pl-4 space-y-1"> <li><span class="font-semibold">Delete</span>: remove selected</li> <li><span class="font-semibold">Ctrl/Cmd+Z</span>: undo</li> <li><span class="font-semibold">Ctrl/Cmd+Y</span>: redo</li> <li><span class="font-semibold">Esc</span>: close editor</li> </ul> </div> </aside> </div> </div> </div> </div> `; }
bind() { this.$overlay = this.querySelector("[data-overlay]"); this.$pageList = this.querySelector("[data-page-list]"); this.$canvas = this.querySelector("[data-canvas]"); this.$zoomLabel = this.querySelector("[data-zoom-label]");
this.$emptyProps = this.querySelector("[data-empty-props]"); this.$props = this.querySelector("[data-props]"); this.$propsText = this.querySelector("[data-props-text]"); this.$propsRect = this.querySelector("[data-props-rect]"); this.$propsImage = this.querySelector("[data-props-image]");
this.$imgFile = this.querySelector('[data-file="image"]'); this.$replaceFile = this.querySelector('[data-file="replace"]');
// header buttons this.querySelector('[data-btn="close"]').addEventListener("click", () => this.close()); this.querySelector('[data-btn="save"]').addEventListener("click", () => this._savePages(true)); this.querySelector('[data-btn="undo"]').addEventListener("click", () => this.undo()); this.querySelector('[data-btn="redo"]').addEventListener("click", () => this.redo());
// tools this.querySelectorAll(".toolBtn").forEach(btn => { btn.addEventListener("click", () => { this.state.tool = btn.dataset.tool; this.updateToolbar(); }); });
// toolbar buttons this.querySelector('[data-btn="add-image"]').addEventListener("click", () => this.$imgFile.click()); this.$imgFile.addEventListener("change", (e) => this._handleImageUpload(e, "add"));
this.querySelector('[data-btn="zoom-in"]').addEventListener("click", () => this.setZoom(this.state.zoom + 0.1)); this.querySelector('[data-btn="zoom-out"]').addEventListener("click", () => this.setZoom(this.state.zoom - 0.1));
// pages this.querySelector('[data-btn="add-page"]').addEventListener("click", () => this.addPage());
// properties buttons this.querySelector('[data-btn="delete"]').addEventListener("click", () => this.deleteSelected()); this.querySelector('[data-btn="duplicate"]').addEventListener("click", () => this.duplicateSelected()); this.querySelector('[data-btn="bring-front"]').addEventListener("click", () => this.bringFront()); this.querySelector('[data-btn="send-back"]').addEventListener("click", () => this.sendBack());
// text props this.querySelector('[data-btn="bold"]').addEventListener("click", () => this.toggleTextStyle("bold")); this.querySelector('[data-btn="italic"]').addEventListener("click", () => this.toggleTextStyle("italic")); this.querySelector('[data-btn="underline"]').addEventListener("click", () => this.toggleTextStyle("underline")); this.querySelector('[data-btn="align-left"]').addEventListener("click", () => this.setTextAlign("left")); this.querySelector('[data-btn="align-center"]').addEventListener("click", () => this.setTextAlign("center")); this.querySelector('[data-btn="align-right"]').addEventListener("click", () => this.setTextAlign("right"));
this.querySelector('[data-prop="fontSize"]').addEventListener("input", (e) => this.setProp("fontSize", Number(e.target.value || 12))); this.querySelector('[data-prop="color"]').addEventListener("input", (e) => this.setProp("color", e.target.value));
// rect props this.querySelector('[data-prop="fill"]').addEventListener("input", (e) => this.setProp("fill", e.target.value)); this.querySelector('[data-prop="stroke"]').addEventListener("input", (e) => this.setProp("stroke", e.target.value)); this.querySelector('[data-prop="strokeWidth"]').addEventListener("input", (e) => this.setProp("strokeWidth", Number(e.target.value || 0)));
// image replace this.querySelector('[data-btn="replace-image"]').addEventListener("click", () => this.$replaceFile.click()); this.$replaceFile.addEventListener("change", (e) => this._handleImageUpload(e, "replace"));
// canvas interactions this.$canvas.addEventListener("pointerdown", (e) => this.onCanvasPointerDown(e)); window.addEventListener("pointermove", (e) => this.onPointerMove(e)); window.addEventListener("pointerup", () => this.onPointerUp());
// keyboard shortcuts window.addEventListener("keydown", (e) => { if (!this.state.isOpen) return;
if (e.key === "Escape") { e.preventDefault(); this.close(); }
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "z") { e.preventDefault(); this.undo(); } if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === "y") { e.preventDefault(); this.redo(); }
if (e.key === "Delete" || e.key === "Backspace") { // avoid deleting while typing in contenteditable const active = document.activeElement; const isEditingText = active && active.getAttribute && active.getAttribute("contenteditable") === "true"; if (!isEditingText) this.deleteSelected(); } }); }
// ---------- Core helpers ---------- show() { this.$overlay.classList.remove("hidden"); this.state.isOpen = true; this.updateAll(); }
hide() { this.$overlay.classList.add("hidden"); this.state.isOpen = false; }
setZoom(z) { const clamped = Math.max(0.6, Math.min(1.4, Number(z.toFixed(2)))); this.state.zoom = clamped; this.updateCanvasScale(); }
get activePage() { return this.state.pages[this.state.activePage]; }
updateAll() { this.updateToolbar(); this.renderPageList(); this.renderCanvas(); this.updateCanvasScale(); this.updatePropsPanel(); this.updateUndoRedoButtons(); this._refreshIcons(); }
updateToolbar() { this.querySelectorAll(".toolBtn").forEach(btn => { const active = btn.dataset.tool === this.state.tool; btn.classList.toggle("bg-gray-900", active); btn.classList.toggle("text-white", active); btn.classList.toggle("border-gray-900", active);
if (!active) { btn.classList.add("bg-white", "text-gray-800", "border-gray-200"); btn.classList.remove("bg-gray-900", "text-white", "border-gray-900"); } else { btn.classList.remove("bg-white", "text-gray-800", "border-gray-200"); } }); }
updateCanvasScale() { if (!this.$canvas) return; this.$canvas.style.transformOrigin = "top center"; this.$canvas.style.transform = `scale(${this.state.zoom})`; this.$zoomLabel.textContent = `${Math.round(this.state.zoom * 100)}%`; }
_refreshIcons() { if (window.feather && typeof window.feather.replace === "function") { window.feather.replace(); } }
// ---------- Storage ---------- _storageKey() { if (this.sessionId) { return `repex_report_pages_v1_${this.sessionId}`; } return "repex_report_pages_v1"; }
_loadPages() { try { const raw = localStorage.getItem(this._storageKey()); return raw ? JSON.parse(raw) : null; } catch { return null; } }
_savePages(showToast = false) { try { localStorage.setItem(this._storageKey(), JSON.stringify({ pages: this.state.pages })); this._scheduleServerSave(); if (showToast) this._toast("Saved"); } catch { if (showToast) this._toast("Save failed"); } }
_apiRoot() { if (this.apiBase) return this.apiBase.replace(/\/$/, ""); if (window.REPEX && window.REPEX.apiBase) return window.REPEX.apiBase.replace(/\/$/, ""); return ""; }
async _loadPagesFromServer() { const base = this._apiRoot(); if (!base || !this.sessionId) return null; try { const res = await fetch(`${base}/sessions/${this.sessionId}/pages`); if (!res.ok) return null; const data = await res.json(); if (data && Array.isArray(data.pages)) { return data.pages; } } catch {} return null; }
_scheduleServerSave() { if (!this.sessionId) return; if (this._saveTimer) clearTimeout(this._saveTimer); this._saveTimer = setTimeout(() => { this._savePagesToServer(); }, 800); }
async _savePagesToServer() { const base = this._apiRoot(); if (!base || !this.sessionId) return; try { const res = await fetch(`${base}/sessions/${this.sessionId}/pages`, { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ pages: this.state.pages }), }); if (!res.ok) { throw new Error("Failed"); } } catch { this._toast("Sync failed"); } }
_toast(text) { const el = document.createElement("div"); el.className = "fixed z-[60] bottom-5 left-1/2 -translate-x-1/2 rounded-lg bg-gray-900 text-white text-sm font-semibold px-4 py-2 shadow"; el.textContent = text; document.body.appendChild(el); setTimeout(() => el.remove(), 1200); }
// ---------- Page list ---------- renderPageList() { this.$pageList.innerHTML = "";
this.state.pages.forEach((_, idx) => { const active = idx === this.state.activePage;
const btn = document.createElement("button"); btn.type = "button"; btn.className = "w-full text-left rounded-lg border px-3 py-2 transition " + (active ? "border-gray-900 bg-gray-900 text-white" : "border-gray-200 bg-white text-gray-800 hover:bg-gray-50"); btn.innerHTML = ` <div class="flex items-center justify-between"> <div class="text-sm font-semibold">Page ${idx + 1}</div> <div class="text-xs ${active ? "text-white/80" : "text-gray-500"}">${this.state.pages[idx].items.length} items</div> </div> `; btn.addEventListener("click", () => { this.state.activePage = idx; this.state.selectedId = null; this.state.undo = []; this.state.redo = []; this.updateAll(); });
this.$pageList.appendChild(btn); }); }
addPage() { this._pushUndoSnapshot(); this.state.pages.push({ items: [] }); this.state.activePage = this.state.pages.length - 1; this.state.selectedId = null; this._savePages(); this.updateAll(); }
// ---------- Canvas rendering ---------- renderCanvas() { this.$canvas.innerHTML = "";
// Click-away surface const surface = document.createElement("div"); surface.className = "absolute inset-0"; surface.addEventListener("pointerdown", (e) => { // only clear selection if clicking empty space if (e.target === surface) { this.state.selectedId = null; this.updatePropsPanel(); this.renderCanvas(); } }); this.$canvas.appendChild(surface);
const items = this.activePage.items; const selectedId = this.state.selectedId;
items .slice() .sort((a, b) => (a.z ?? 0) - (b.z ?? 0)) .forEach(item => { const wrapper = document.createElement("div"); wrapper.dataset.itemId = item.id; wrapper.className = "absolute";
// scaled px placement based on model units const scale = this._canvasScale(); wrapper.style.left = `${item.x * scale}px`; wrapper.style.top = `${item.y * scale}px`; wrapper.style.width = `${item.w * scale}px`; wrapper.style.height = `${item.h * scale}px`; wrapper.style.zIndex = String(item.z ?? 0);
const isSelected = selectedId === item.id; if (isSelected) wrapper.classList.add("ring-2", "ring-blue-300");
// content if (item.type === "text") { const content = document.createElement("div"); content.className = "w-full h-full p-2 overflow-hidden"; content.setAttribute("contenteditable", "true"); content.style.fontSize = `${(item.style?.fontSize ?? 14) * scale}px`; content.style.fontWeight = item.style?.bold ? "700" : "400"; content.style.fontStyle = item.style?.italic ? "italic" : "normal"; content.style.textDecoration = item.style?.underline ? "underline" : "none"; content.style.color = item.style?.color ?? "#111827"; content.style.textAlign = item.style?.align ?? "left"; content.style.whiteSpace = "pre-wrap"; content.style.outline = "none"; content.innerText = item.content ?? "Double-click to edit";
// update model when typing (debounced) let t = null; content.addEventListener("input", () => { clearTimeout(t); t = setTimeout(() => { const it = this._findItem(item.id); if (!it) return; it.content = content.innerText; this._savePages(); }, 250); });
wrapper.appendChild(content); }
if (item.type === "image") { const img = document.createElement("img"); img.className = "w-full h-full object-contain bg-white"; img.src = item.src; img.alt = item.name ?? "Image"; img.draggable = false; wrapper.appendChild(img); }
if (item.type === "rect") { const box = document.createElement("div"); box.className = "w-full h-full"; box.style.background = item.style?.fill ?? "#ffffff"; box.style.borderColor = item.style?.stroke ?? "#111827"; box.style.borderWidth = `${(item.style?.strokeWidth ?? 1) * scale}px`; box.style.borderStyle = "solid"; wrapper.appendChild(box); }
// wrapper drag handler wrapper.addEventListener("pointerdown", (e) => this.onItemPointerDown(e, item.id));
// resize handles (selected only) if (isSelected) { ["nw", "ne", "sw", "se"].forEach(handle => { const h = document.createElement("div"); h.dataset.handle = handle; h.className = "absolute w-3 h-3 bg-white border border-blue-300 rounded-sm"; if (handle === "nw") { h.style.left = "-6px"; h.style.top = "-6px"; } if (handle === "ne") { h.style.right = "-6px"; h.style.top = "-6px"; } if (handle === "sw") { h.style.left = "-6px"; h.style.bottom = "-6px"; } if (handle === "se") { h.style.right = "-6px"; h.style.bottom = "-6px"; }
h.style.cursor = `${handle}-resize`; h.addEventListener("pointerdown", (e) => { e.stopPropagation(); this.startResize(e, item.id, handle); }); wrapper.appendChild(h); }); }
this.$canvas.appendChild(wrapper); }); }
_canvasScale() { // actual displayed width divided by model width const w = this.$canvas.clientWidth; return w / this.BASE_W; }
// ---------- Item creation ---------- onCanvasPointerDown(e) { // prevent adding when clicking existing item const hit = e.target.closest("[data-item-id]"); if (hit) return;
const { x, y } = this._eventToModelPoint(e);
if (this.state.tool === "text") { this._pushUndoSnapshot(); const id = this._id(); this.activePage.items.push({ id, type: "text", x: this._clamp(x, 0, this.BASE_W - 200), y: this._clamp(y, 0, this.BASE_H - 80), w: 220, h: 80, z: this._maxZ() + 1, content: "New text", style: { fontSize: 14, bold: false, italic: false, underline: false, color: "#111827", align: "left" } }); this.selectItem(id); this._savePages(); this.renderCanvas(); this.updatePropsPanel(); return; }
if (this.state.tool === "rect") { this._pushUndoSnapshot(); const id = this._id(); this.activePage.items.push({ id, type: "rect", x: this._clamp(x, 0, this.BASE_W - 200), y: this._clamp(y, 0, this.BASE_H - 120), w: 220, h: 120, z: this._maxZ() + 1, style: { fill: "#ffffff", stroke: "#111827", strokeWidth: 1 } }); this.selectItem(id); this._savePages(); this.renderCanvas(); this.updatePropsPanel(); return; }
// select tool clicking empty space clears selection if (this.state.tool === "select") { this.state.selectedId = null; this.updatePropsPanel(); this.renderCanvas(); } }
_eventToModelPoint(e) { const canvasRect = this.$canvas.getBoundingClientRect(); const scale = canvasRect.width / this.BASE_W; const xPx = e.clientX - canvasRect.left; const yPx = e.clientY - canvasRect.top; return { x: xPx / scale, y: yPx / scale }; }
// ---------- Selection / Drag / Resize ---------- selectItem(id) { this.state.selectedId = id; this.updatePropsPanel(); this.renderCanvas(); }
onItemPointerDown(e, id) { // ignore if resizing handle if (e.target && e.target.dataset && e.target.dataset.handle) return;
// select this.selectItem(id);
const isEditingText = e.target && e.target.getAttribute && e.target.getAttribute("contenteditable") === "true"; if (isEditingText) return;
// start drag only when using select tool if (this.state.tool !== "select") return;
this._pushUndoSnapshot();
const it = this._findItem(id); if (!it) return;
const { x, y } = this._eventToModelPoint(e); this.state.dragging = { id, startX: x, startY: y, origX: it.x, origY: it.y };
e.preventDefault(); }
startResize(e, id, handle) { this._pushUndoSnapshot();
const it = this._findItem(id); if (!it) return;
const { x, y } = this._eventToModelPoint(e); this.state.resizing = { id, handle, startX: x, startY: y, orig: { x: it.x, y: it.y, w: it.w, h: it.h } }; e.preventDefault(); }
onPointerMove(e) { if (!this.state.isOpen) return;
if (this.state.dragging) { const d = this.state.dragging; const it = this._findItem(d.id); if (!it) return;
const { x, y } = this._eventToModelPoint(e); const dx = x - d.startX; const dy = y - d.startY;
it.x = this._clamp(d.origX + dx, 0, this.BASE_W - it.w); it.y = this._clamp(d.origY + dy, 0, this.BASE_H - it.h);
this._savePages(); this.renderCanvas(); return; }
if (this.state.resizing) { const r = this.state.resizing; const it = this._findItem(r.id); if (!it) return;
const { x, y } = this._eventToModelPoint(e); const dx = x - r.startX; const dy = y - r.startY;
const o = r.orig; const minW = 40, minH = 30;
let nx = o.x, ny = o.y, nw = o.w, nh = o.h;
if (r.handle.includes("e")) nw = this._clamp(o.w + dx, minW, this.BASE_W - o.x); if (r.handle.includes("s")) nh = this._clamp(o.h + dy, minH, this.BASE_H - o.y); if (r.handle.includes("w")) { nw = this._clamp(o.w - dx, minW, o.w + o.x); nx = this._clamp(o.x + dx, 0, o.x + o.w - minW); } if (r.handle.includes("n")) { nh = this._clamp(o.h - dy, minH, o.h + o.y); ny = this._clamp(o.y + dy, 0, o.y + o.h - minH); }
it.x = nx; it.y = ny; it.w = nw; it.h = nh;
this._savePages(); this.renderCanvas(); } }
onPointerUp() { if (!this.state.isOpen) return;
if (this.state.dragging) { this.state.dragging = null; this.updateUndoRedoButtons(); } if (this.state.resizing) { this.state.resizing = null; this.updateUndoRedoButtons(); } }
// ---------- Properties panel ---------- updatePropsPanel() { const it = this._findItem(this.state.selectedId); const has = !!it;
this.$emptyProps.classList.toggle("hidden", has); this.$props.classList.toggle("hidden", !has);
// hide all groups first this.$propsText.classList.add("hidden"); this.$propsRect.classList.add("hidden"); this.$propsImage.classList.add("hidden");
if (!it) return;
if (it.type === "text") { this.$propsText.classList.remove("hidden"); this.querySelector('[data-prop="fontSize"]').value = it.style?.fontSize ?? 14; this.querySelector('[data-prop="color"]').value = it.style?.color ?? "#111827"; }
if (it.type === "rect") { this.$propsRect.classList.remove("hidden"); this.querySelector('[data-prop="fill"]').value = it.style?.fill ?? "#ffffff"; this.querySelector('[data-prop="stroke"]').value = it.style?.stroke ?? "#111827"; this.querySelector('[data-prop="strokeWidth"]').value = it.style?.strokeWidth ?? 1; }
if (it.type === "image") { this.$propsImage.classList.remove("hidden"); }
this._refreshIcons(); }
setProp(key, value) { const it = this._findItem(this.state.selectedId); if (!it) return;
this._pushUndoSnapshot();
it.style = it.style || {}; it.style[key] = value;
this._savePages(); this.renderCanvas(); this.updatePropsPanel(); this.updateUndoRedoButtons(); }
toggleTextStyle(which) { const it = this._findItem(this.state.selectedId); if (!it || it.type !== "text") return;
this._pushUndoSnapshot();
it.style = it.style || {}; if (which === "bold") it.style.bold = !it.style.bold; if (which === "italic") it.style.italic = !it.style.italic; if (which === "underline") it.style.underline = !it.style.underline;
this._savePages(); this.renderCanvas(); this.updateUndoRedoButtons(); }
setTextAlign(align) { const it = this._findItem(this.state.selectedId); if (!it || it.type !== "text") return; this.setProp("align", align); }
// ---------- Arrange ---------- bringFront() { const it = this._findItem(this.state.selectedId); if (!it) return; this._pushUndoSnapshot(); it.z = this._maxZ() + 1; this._savePages(); this.renderCanvas(); this.updateUndoRedoButtons(); }
sendBack() { const it = this._findItem(this.state.selectedId); if (!it) return; this._pushUndoSnapshot(); it.z = this._minZ() - 1; this._savePages(); this.renderCanvas(); this.updateUndoRedoButtons(); }
duplicateSelected() { const it = this._findItem(this.state.selectedId); if (!it) return; this._pushUndoSnapshot();
const copy = JSON.parse(JSON.stringify(it)); copy.id = this._id(); copy.x = this._clamp(copy.x + 12, 0, this.BASE_W - copy.w); copy.y = this._clamp(copy.y + 12, 0, this.BASE_H - copy.h); copy.z = this._maxZ() + 1;
this.activePage.items.push(copy); this.state.selectedId = copy.id;
this._savePages(); this.updateAll(); this.updateUndoRedoButtons(); }
deleteSelected() { const id = this.state.selectedId; if (!id) return;
this._pushUndoSnapshot();
this.activePage.items = this.activePage.items.filter(x => x.id !== id); this.state.selectedId = null;
this._savePages(); this.updateAll(); this.updateUndoRedoButtons(); }
// ---------- Images ---------- _handleImageUpload(e, mode) { const file = e.target.files && e.target.files[0]; if (!file) return;
const reader = new FileReader(); reader.onload = () => { if (mode === "add") { this._pushUndoSnapshot(); const id = this._id(); const w = 260, h = 180; this.activePage.items.push({ id, type: "image", x: (this.BASE_W - w) / 2, y: (this.BASE_H - h) / 2, w, h, z: this._maxZ() + 1, src: reader.result, name: file.name }); this.selectItem(id); this._savePages(); this.updateAll(); this.updateUndoRedoButtons(); }
if (mode === "replace") { const it = this._findItem(this.state.selectedId); if (!it || it.type !== "image") return; this._pushUndoSnapshot(); it.src = reader.result; it.name = file.name; this._savePages(); this.updateAll(); this.updateUndoRedoButtons(); } }; reader.readAsDataURL(file);
// reset input e.target.value = ""; }
// ---------- Undo / redo ---------- _pushUndoSnapshot() { // store snapshot of active page items const snap = JSON.stringify(this.activePage.items); const last = this.state.undo[this.state.undo.length - 1]; if (last !== snap) this.state.undo.push(snap); // clear redo on new change this.state.redo = []; this.updateUndoRedoButtons(); }
undo() { if (!this.state.undo.length) return;
const current = JSON.stringify(this.activePage.items); const prev = this.state.undo.pop(); this.state.redo.push(current);
// restore prev try { this.activePage.items = JSON.parse(prev); } catch {} this.state.selectedId = null;
this._savePages(); this.updateAll(); }
redo() { if (!this.state.redo.length) return;
const current = JSON.stringify(this.activePage.items); const next = this.state.redo.pop(); this.state.undo.push(current);
try { this.activePage.items = JSON.parse(next); } catch {} this.state.selectedId = null;
this._savePages(); this.updateAll(); }
updateUndoRedoButtons() { const undoBtn = this.querySelector('[data-btn="undo"]'); const redoBtn = this.querySelector('[data-btn="redo"]'); if (undoBtn) undoBtn.disabled = this.state.undo.length === 0; if (redoBtn) redoBtn.disabled = this.state.redo.length === 0; }
// ---------- Utils ---------- _findItem(id) { if (!id) return null; return this.activePage.items.find(x => x.id === id) || null; }
_maxZ() { const items = this.activePage.items; return items.length ? Math.max(...items.map(i => i.z ?? 0)) : 0; }
_minZ() { const items = this.activePage.items; return items.length ? Math.min(...items.map(i => i.z ?? 0)) : 0; }
_id() { return "it_" + Math.random().toString(16).slice(2) + "_" + Date.now().toString(16); }
_clamp(n, a, b) { return Math.max(a, Math.min(b, n)); }}
customElements.define("report-editor", ReportEditor);123456789101112131415161718192021* {box-sizing: border-box;}html,body,#root {width: 100%;height: 100%;margin: 0;}body {background: #000000;}.black-screen {width: 100%;height: 100%;background: #000000;}1234567891011121314151617181920212223242526@tailwind base;@tailwind components;@tailwind utilities;* {box-sizing: border-box;}img {-webkit-print-color-adjust: exact;print-color-adjust: exact;}body {@apply bg-gray-50 text-gray-900;}@media print {body {background: #ffffff;}.no-print {display: none !important;}}
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455const BASE = (import.meta.env.VITE_API_BASE as string | undefined) || "/api";export const API_BASE = BASE.replace(/\/$/, "");
async function parseError(res: Response): Promise<string> { try { const data = await res.json(); return data?.detail || res.statusText; } catch { return res.statusText; }}
export async function request<T>( path: string, options: RequestInit = {},): Promise<T> { const url = `${API_BASE}${path}`; const res = await fetch(url, { credentials: "same-origin", ...options, }); if (!res.ok) { throw new Error(await parseError(res)); } if (res.status === 204) return null as T; const contentType = res.headers.get("content-type") || ""; if (contentType.includes("application/json")) { return (await res.json()) as T; } return (await res.text()) as T;}
export async function postForm<T>(path: string, data: FormData): Promise<T> { return request<T>(path, { method: "POST", body: data });}
export async function postJson<T>( path: string, body: unknown,): Promise<T> { return request<T>(path, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body), });}
export async function putJson<T>(path: string, body: unknown): Promise<T> { return request<T>(path, { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body), });}123456789101112export function formatBytes(bytes: number): string { if (!Number.isFinite(bytes)) return "0 B"; const units = ["B", "KB", "MB", "GB"]; let value = bytes; let idx = 0; while (value >= 1024 && idx < units.length - 1) { value /= 1024; idx += 1; } const digits = value >= 10 || idx === 0 ? 0 : 1; return `${value.toFixed(digits)} ${units[idx]}`;}123456789101112131415161718192021222324252627const SESSION_KEY = "repex_session_id";
export function getStoredSessionId(): string { return localStorage.getItem(SESSION_KEY) || "";}
export function setStoredSessionId(id: string): void { if (!id) return; localStorage.setItem(SESSION_KEY, id);}
export function clearStoredSessionId(): void { localStorage.removeItem(SESSION_KEY);}
export function getSessionIdFromSearch(search: string): string { const params = new URLSearchParams(search); return params.get("session") || "";}
export function getSessionId(search: string): string { return getSessionIdFromSearch(search) || getStoredSessionId();}
export function buildSessionQuery(sessionId: string): string { return sessionId ? `?session=${encodeURIComponent(sessionId)}` : "";}1 unmodified line2345671 unmodified lineimport ReactDOM from "react-dom/client";import App from "./App";import "./index.css";ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(<React.StrictMode>1 unmodified line23456781 unmodified lineimport ReactDOM from "react-dom/client";import App from "./App";import "./index.css";import "./components/report-editor";ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(<React.StrictMode>
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849import { Link, useSearchParams } from "react-router-dom";import { ArrowLeft } from "react-feather";
import { buildSessionQuery, getSessionId } from "../lib/session";import { PageFooter } from "../components/PageFooter";import { PageHeader } from "../components/PageHeader";import { PageShell } from "../components/PageShell";
export default function EditLayoutsPage() { const [searchParams] = useSearchParams(); const sessionId = getSessionId(searchParams.toString()); const sessionQuery = buildSessionQuery(sessionId);
return ( <PageShell> <PageHeader title="RepEx - Report Express" subtitle="Edit Page Layouts" right={ <Link to={`/report-viewer${sessionQuery}`} className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition" > <ArrowLeft className="h-4 w-4" /> Back </Link> } />
<section className="rounded-lg border border-gray-200 bg-gray-50 p-6 text-center"> <h2 className="text-xl font-semibold text-gray-900 mb-2"> Edit Page Layouts (Coming Soon) </h2> <p className="text-sm text-gray-600 mb-4"> Layout tools will be added in the next iteration. For now, continue editing pages from the report viewer. </p> <Link to={`/report-viewer${sessionQuery}`} className="inline-flex items-center justify-center gap-2 rounded-lg bg-blue-600 px-5 py-2.5 text-white font-semibold hover:bg-blue-700 transition" > Return to Report Viewer </Link> </section>
<PageFooter note="Layout tools are on the roadmap for the next release." /> </PageShell> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273import { useEffect, useMemo, useState } from "react";import { Link, useSearchParams } from "react-router-dom";import { ArrowLeft, Download, Grid, Layout } from "react-feather";
import { request } from "../lib/api";import { buildSessionQuery, getSessionId, setStoredSessionId } from "../lib/session";import type { Page, Session } from "../types/session";import { PageFooter } from "../components/PageFooter";import { PageHeader } from "../components/PageHeader";import { PageShell } from "../components/PageShell";
export default function ExportPage() { const [searchParams] = useSearchParams(); const sessionId = getSessionId(searchParams.toString()); const sessionQuery = buildSessionQuery(sessionId);
const [session, setSession] = useState<Session | null>(null); const [pages, setPages] = useState<Page[]>([]); const [error, setError] = useState("");
const [incPages, setIncPages] = useState(true); const [incLayout, setIncLayout] = useState(true); const [incPayload, setIncPayload] = useState(true); const [incTimestamp, setIncTimestamp] = useState(true);
useEffect(() => { if (!sessionId) { setError("No active session."); return; } setStoredSessionId(sessionId); async function load() { try { const data = await request<Session>(`/sessions/${sessionId}`); setSession(data); const pageResp = await request<{ pages: Page[] }>( `/sessions/${sessionId}/pages`, ); setPages(Array.isArray(pageResp.pages) ? pageResp.pages : []); } catch (err) { const message = err instanceof Error ? err.message : "Failed to load session."; setError(message); } } load(); }, [sessionId]);
const totals = useMemo(() => { const totalItems = pages.reduce( (acc, page) => acc + (page?.items?.length ?? 0), 0, ); return { pages: pages.length, items: totalItems, photos: session?.selected_photo_ids?.length ?? 0, docs: session?.uploads?.documents?.length ?? 0, data: session?.uploads?.data_files?.length ?? 0, }; }, [pages, session]);
function downloadJson() { const pack: Record<string, unknown> = {}; if (incPages) pack.pages = pages; if (incLayout) pack.layout = (session as Session | null)?.["layout"] ?? null; if (incPayload) pack.payload = session; if (incTimestamp) pack.exportedAt = new Date().toISOString();
const blob = new Blob([JSON.stringify(pack, null, 2)], { type: "application/json", }); const url = URL.createObjectURL(blob); const link = document.createElement("a"); link.href = url; link.download = `repex_report_package_${new Date() .toISOString() .replace(/[:.]/g, "-")}.json`; document.body.appendChild(link); link.click(); link.remove(); URL.revokeObjectURL(url); }
return ( <PageShell> <PageHeader title="RepEx - Report Express" subtitle="Export" right={ <Link to={`/report-viewer${sessionQuery}`} className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition" > <ArrowLeft className="h-4 w-4" /> Back </Link> } />
<nav className="mb-6 no-print" aria-label="Report workflow navigation"> <div className="flex flex-wrap gap-2"> <Link to={`/report-viewer${sessionQuery}`} className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition" > <Layout className="h-4 w-4" /> Report Viewer </Link>
<Link to={`/edit-layouts${sessionQuery}`} className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition" > <Grid className="h-4 w-4" /> Edit Page Layouts </Link>
<span className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-900 px-4 py-2 text-sm font-semibold text-white"> <Download className="h-4 w-4" /> Export </span> </div> </nav>
<section className="grid grid-cols-1 lg:grid-cols-[1fr,360px] gap-6"> <div className="rounded-lg border border-gray-200 bg-white p-4"> <h2 className="text-lg font-semibold text-gray-900 mb-2">Export Options</h2> <p className="text-sm text-gray-600 mb-4"> PDF export comes next. For now, you can export a report package as JSON (pages + layout settings + payload). </p>
<div className="space-y-4"> <div className="rounded-lg border border-gray-200 bg-gray-50 p-4"> <div className="flex items-start justify-between gap-3"> <div> <div className="text-sm font-semibold text-gray-900"> Report package (.json) </div> <div className="text-xs text-gray-500"> Includes edited pages, layout settings and upload metadata </div> </div> <span className="text-xs font-semibold text-emerald-700 bg-emerald-50 border border-emerald-200 rounded-md px-2 py-1"> Available </span> </div>
<div className="mt-3 grid grid-cols-1 sm:grid-cols-2 gap-3"> <label className="inline-flex items-center gap-2 text-sm text-gray-700"> <input type="checkbox" className="rounded border-gray-300" checked={incPages} onChange={(event) => setIncPages(event.target.checked)} /> Include pages </label> <label className="inline-flex items-center gap-2 text-sm text-gray-700"> <input type="checkbox" className="rounded border-gray-300" checked={incLayout} onChange={(event) => setIncLayout(event.target.checked)} /> Include layout settings </label> <label className="inline-flex items-center gap-2 text-sm text-gray-700"> <input type="checkbox" className="rounded border-gray-300" checked={incPayload} onChange={(event) => setIncPayload(event.target.checked)} /> Include upload payload </label> <label className="inline-flex items-center gap-2 text-sm text-gray-700"> <input type="checkbox" className="rounded border-gray-300" checked={incTimestamp} onChange={(event) => setIncTimestamp(event.target.checked)} /> Include timestamp </label> </div>
<button type="button" onClick={downloadJson} disabled={!sessionId} className="mt-4 inline-flex items-center justify-center gap-2 rounded-lg bg-emerald-600 px-4 py-2.5 text-white font-semibold hover:bg-emerald-700 transition disabled:opacity-50 disabled:cursor-not-allowed" > <Download className="h-4 w-4" /> Download JSON package </button> </div>
<div className="rounded-lg border border-gray-200 bg-gray-50 p-4"> <div className="flex items-start justify-between gap-3"> <div> <div className="text-sm font-semibold text-gray-900">PDF export</div> <div className="text-xs text-gray-500"> Will export as print-ready A4 PDF </div> </div> <span className="text-xs font-semibold text-gray-600 bg-white border border-gray-200 rounded-md px-2 py-1"> Coming soon </span> </div>
<button type="button" disabled className="mt-4 inline-flex items-center justify-center gap-2 rounded-lg bg-gray-200 px-4 py-2.5 text-gray-500 font-semibold cursor-not-allowed" > Export PDF (disabled) </button> </div> </div> </div>
<aside className="rounded-lg border border-gray-200 bg-white p-4"> <h2 className="text-lg font-semibold text-gray-900 mb-2">Export Summary</h2> <p className="text-sm text-gray-600 mb-4"> This is what will be included based on your current session. </p>
<div className="space-y-3"> <div className="rounded-lg border border-gray-200 bg-gray-50 p-3"> <div className="text-xs font-semibold text-gray-600">Pages</div> <div className="text-sm font-semibold text-gray-900"> {totals.pages ? `${totals.pages} pages - ${totals.items} total items` : "No saved pages yet"} </div> </div>
<div className="rounded-lg border border-gray-200 bg-gray-50 p-3"> <div className="text-xs font-semibold text-gray-600"> Selected example photos </div> <div className="text-sm font-semibold text-gray-900"> {totals.photos} </div> </div>
<div className="rounded-lg border border-gray-200 bg-gray-50 p-3"> <div className="text-xs font-semibold text-gray-600">Documents</div> <div className="text-sm font-semibold text-gray-900"> {totals.docs} </div> </div>
<div className="rounded-lg border border-gray-200 bg-gray-50 p-3"> <div className="text-xs font-semibold text-gray-600">Data files</div> <div className="text-sm font-semibold text-gray-900"> {totals.data} </div> </div>
<div className="text-xs text-gray-500">Stored in the active server session.</div> </div>
{error ? <p className="text-sm text-red-600 mt-3">{error}</p> : null} </aside> </section>
<PageFooter note="Export: JSON package now; PDF export will be added next." /> </PageShell> );}1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586import { useEffect, useState } from "react";import { useNavigate, useSearchParams } from "react-router-dom";import { Loader } from "react-feather";
import { request } from "../lib/api";import { getSessionId, setStoredSessionId } from "../lib/session";import type { SessionStatus } from "../types/session";
export default function ProcessingPage() { const navigate = useNavigate(); const [searchParams] = useSearchParams(); const [message, setMessage] = useState("");
const sessionId = getSessionId(searchParams.toString());
useEffect(() => { if (!sessionId) { setMessage("No active session found. Return to the upload page."); return; } setStoredSessionId(sessionId);
let active = true; const poll = async () => { try { const status = await request<SessionStatus>( `/sessions/${sessionId}/status`, ); if (!active) return; if (status?.status === "ready") { navigate(`/review-setup?session=${encodeURIComponent(sessionId)}`); } } catch { // keep polling } };
poll(); const timer = setInterval(poll, 2000); return () => { active = false; clearInterval(timer); }; }, [navigate, sessionId]);
return ( <main className="max-w-2xl mx-auto my-10 bg-white shadow-sm ring-1 ring-gray-200 rounded-xl p-6 md:p-8"> <header className="flex items-center gap-4 border-b border-gray-200 pb-4 mb-6"> <img src="/assets/prosento-logo.png" alt="Prosento logo" className="h-10 w-auto object-contain" loading="eager" /> <div> <h1 className="text-xl font-semibold text-gray-900">Prosento RepEx</h1> <p className="text-sm text-gray-600">Report processing</p> </div> </header>
<section className="text-center"> <div className="mx-auto mb-4 inline-flex h-12 w-12 items-center justify-center rounded-full bg-blue-50 border border-blue-100"> <Loader className="h-5 w-5 text-blue-700 animate-spin" /> </div> <h2 className="text-2xl font-semibold text-gray-900 mb-2"> Generating your report </h2> <p className="text-gray-600 mb-6"> We are preparing your files and building the final report. This may take a few minutes. </p>
<div className="w-full rounded-full bg-gray-200 h-3 overflow-hidden"> <div className="h-full bg-blue-600 w-1/2 animate-pulse" /> </div>
<p className="text-xs text-gray-500 mt-4"> You can leave this tab open while we process your submission. </p>
{message ? ( <p className="text-sm text-red-600 mt-6">{message}</p> ) : null} </section> </main> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336import type { CSSProperties } from "react";import { useEffect, useMemo, useRef, useState } from "react";import { Link, useSearchParams } from "react-router-dom";import { ArrowLeft, ChevronLeft, ChevronRight, Layout, Edit3, Grid, Download,} from "react-feather";
import { API_BASE, request } from "../lib/api";import { buildSessionQuery, getSessionId, setStoredSessionId } from "../lib/session";import type { Page, Session } from "../types/session";
const BASE_W = 595;
export default function ReportViewerPage() { const [searchParams] = useSearchParams(); const sessionId = getSessionId(searchParams.toString());
const [session, setSession] = useState<Session | null>(null); const [pages, setPages] = useState<Page[]>([]); const [pageIndex, setPageIndex] = useState(0); const [totalPages, setTotalPages] = useState(6); const [scale, setScale] = useState(1); const [editMode, setEditMode] = useState(false); const [error, setError] = useState("");
const stageRef = useRef<HTMLDivElement | null>(null); const editorRef = useRef<ReportEditorElement | null>(null);
useEffect(() => { if (!sessionId) { setError("No active session found. Return to upload to continue."); return; } setStoredSessionId(sessionId); }, [sessionId]);
useEffect(() => { const handleResize = () => { if (!stageRef.current) return; const width = stageRef.current.clientWidth; setScale(width / BASE_W); }; handleResize(); window.addEventListener("resize", handleResize); return () => window.removeEventListener("resize", handleResize); }, []);
useEffect(() => { if (!sessionId) return; async function load() { try { const data = await request<Session>(`/sessions/${sessionId}`); setSession(data); setTotalPages(Math.max(data.page_count || 0, 1)); const pageResp = await request<{ pages: Page[] }>( `/sessions/${sessionId}/pages`, ); const loaded = Array.isArray(pageResp.pages) ? pageResp.pages : []; setPages(loaded); if (loaded.length) { setTotalPages(Math.max(data.page_count || 0, loaded.length, 1)); } } catch (err) { const message = err instanceof Error ? err.message : "Failed to load session."; setError(message); } } load(); }, [sessionId]);
useEffect(() => { const handler = (event: KeyboardEvent) => { if (editMode) return; if (event.key === "ArrowRight") { setPageIndex((idx) => Math.min(totalPages - 1, idx + 1)); } if (event.key === "ArrowLeft") { setPageIndex((idx) => Math.max(0, idx - 1)); } }; window.addEventListener("keydown", handler); return () => window.removeEventListener("keydown", handler); }, [editMode, totalPages]);
useEffect(() => { const editor = editorRef.current; if (!editor) return; const closeHandler = () => { setEditMode(false); if (sessionId) { request<{ pages: Page[] }>(`/sessions/${sessionId}/pages`) .then((resp) => { const loaded = Array.isArray(resp.pages) ? resp.pages : []; setPages(loaded); }) .catch(() => {}); } }; editor.addEventListener("editor-closed", closeHandler); return () => editor.removeEventListener("editor-closed", closeHandler); }, [sessionId]);
const pageItems = pages[pageIndex]?.items ?? []; const hasItems = pageItems.length > 0; const sessionQuery = buildSessionQuery(sessionId || "");
const viewerMeta = useMemo(() => { if (!session) return "Loading..."; const selected = session.selected_photo_ids?.length ?? 0; const docs = session.uploads?.documents?.length ?? 0; const dataFiles = session.uploads?.data_files?.length ?? 0; const hasEdits = pages.length > 0; return ( `Selected example photos: ${selected} - Documents: ${docs} - Data files: ${dataFiles}` + (hasEdits ? " - Edited pages loaded" : " - No saved edits yet") ); }, [pages.length, session]);
function openEditor() { if (!editorRef.current || !sessionId || !session) return; setEditMode(true); editorRef.current.open({ payload: session, pageIndex, totalPages, sessionId, apiBase: API_BASE, }); }
return ( <main className="max-w-4xl mx-auto my-8 bg-white shadow-sm ring-1 ring-gray-200 rounded-xl p-6 md:p-8 print:ring-0 print:shadow-none print:rounded-none"> <header className="mb-8 border-b border-gray-200 pb-4"> <div className="grid grid-cols-[auto,1fr,auto] items-center gap-4"> <div className="flex items-center"> <img src="/assets/prosento-logo.png" alt="Company logo" className="h-12 w-auto object-contain" loading="eager" /> </div>
<div className="text-center"> <h1 className="text-2xl md:text-3xl font-bold text-gray-900 whitespace-nowrap"> RepEx - Report Express </h1> <p className="text-gray-600 whitespace-nowrap">Report Viewer</p> </div>
<div className="flex justify-end gap-2 no-print"> <Link to={`/review-setup${sessionQuery}`} className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition" > <ArrowLeft className="h-4 w-4" /> Back </Link> </div> </div> </header>
<nav className="mb-6 no-print" aria-label="Report workflow navigation"> <div className="flex flex-wrap gap-2"> <span className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-900 px-4 py-2 text-sm font-semibold text-white"> <Layout className="h-4 w-4" /> Report Viewer </span>
<button type="button" onClick={openEditor} className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition" > <Edit3 className="h-4 w-4" /> Edit Report </button>
<Link to={`/edit-layouts${sessionQuery}`} className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition" > <Grid className="h-4 w-4" /> Edit Page Layouts </Link>
<Link to={`/export${sessionQuery}`} className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition" > <Download className="h-4 w-4" /> Export </Link> </div> </nav>
<section id="viewerSection" aria-label="Report viewer" className={editMode ? "hidden" : ""} > <div className="flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-4"> <div> <h2 className="text-xl font-semibold text-gray-800">Report Pages</h2> <p className="text-sm text-gray-600">{viewerMeta}</p> </div>
<div className="flex items-center gap-2 no-print"> <button type="button" onClick={() => setPageIndex((idx) => Math.max(0, idx - 1))} disabled={pageIndex === 0} className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition disabled:opacity-50 disabled:cursor-not-allowed" > <ChevronLeft className="h-4 w-4" /> Prev </button>
<div className="text-sm font-semibold text-gray-700"> Page <span>{pageIndex + 1}</span> / <span>{totalPages}</span> </div>
<button type="button" onClick={() => setPageIndex((idx) => Math.min(totalPages - 1, idx + 1)) } disabled={pageIndex >= totalPages - 1} className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition disabled:opacity-50 disabled:cursor-not-allowed" > Next <ChevronRight className="h-4 w-4" /> </button> </div> </div>
<div className="flex justify-center"> <div ref={stageRef} className={[ "relative overflow-hidden shadow-sm rounded-xl", hasItems ? "bg-white border border-gray-200" : "bg-red-100 border border-red-300", ].join(" ")} style={{ aspectRatio: "210 / 297", width: "min(100%, 560px)", }} > {hasItems ? pageItems .slice() .sort((a, b) => (a.z ?? 0) - (b.z ?? 0)) .map((item) => { const itemStyle: CSSProperties = { position: "absolute", left: `${item.x * scale}px`, top: `${item.y * scale}px`, width: `${item.w * scale}px`, height: `${item.h * scale}px`, zIndex: item.z ?? 0, };
if (item.type === "text") { return ( <div key={item.id} style={itemStyle}> <div className="w-full h-full p-2 overflow-hidden" style={{ whiteSpace: "pre-wrap", fontSize: `${(item.style?.fontSize ?? 14) * scale}px`, fontWeight: item.style?.bold ? 700 : 400, fontStyle: item.style?.italic ? "italic" : "normal", textDecoration: item.style?.underline ? "underline" : "none", color: item.style?.color ?? "#111827", textAlign: item.style?.align ?? "left", }} > {item.content ?? ""} </div> </div> ); }
if (item.type === "image") { return ( <div key={item.id} style={itemStyle}> <img src={item.src} alt={item.name ?? "Image"} className="w-full h-full object-contain bg-white" loading="eager" /> </div> ); }
return ( <div key={item.id} style={itemStyle}> <div className="w-full h-full" style={{ background: item.style?.fill ?? "#ffffff", borderStyle: "solid", borderColor: item.style?.stroke ?? "#111827", borderWidth: `${(item.style?.strokeWidth ?? 1) * scale}px`, }} /> </div> ); }) : null} </div> </div>
<p className="mt-4 text-xs text-gray-500 no-print"> Tip: Use keyboard arrows (left / right) to change pages. </p> {error ? <p className="text-sm text-red-600 mt-2">{error}</p> : null} </section>
<footer className="mt-12 text-center text-xs text-gray-500 no-print"> <p>Prosento - (c) 2026 All Rights Reserved</p> <p className="mt-1">Viewer now renders saved edits from the editor.</p> </footer>
<report-editor ref={editorRef} /> </main> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376import { useEffect, useMemo, useState } from "react";import { useNavigate, useSearchParams } from "react-router-dom";import { CheckCircle, Image as ImageIcon, FileText, Table, CheckSquare, Square, ArrowRight,} from "react-feather";
import { putJson, request } from "../lib/api";import { getSessionId, setStoredSessionId } from "../lib/session";import type { Session } from "../types/session";import { PageFooter } from "../components/PageFooter";import { PageHeader } from "../components/PageHeader";import { PageShell } from "../components/PageShell";
export default function ReviewSetupPage() { const navigate = useNavigate(); const [searchParams] = useSearchParams(); const sessionId = getSessionId(searchParams.toString());
const [session, setSession] = useState<Session | null>(null); const [selectedPhotoIds, setSelectedPhotoIds] = useState<Set<string>>( new Set(), ); const [statusMessage, setStatusMessage] = useState("");
useEffect(() => { if (!sessionId) { setStatusMessage("No active session found. Return to upload to continue."); return; } setStoredSessionId(sessionId); async function loadSession() { try { const data = await request<Session>(`/sessions/${sessionId}`); setSession(data); const initial = new Set(data.selected_photo_ids || []); setSelectedPhotoIds(initial); } catch (err) { const message = err instanceof Error ? err.message : "Failed to load session."; setStatusMessage(message); } } loadSession(); }, [sessionId]);
const photos = session?.uploads?.photos ?? []; const documents = session?.uploads?.documents ?? []; const dataFiles = session?.uploads?.data_files ?? [];
const canContinue = selectedPhotoIds.size > 0;
const readyStatus = useMemo(() => { if (!sessionId) return "No active session found. Return to upload to continue."; if (!canContinue) return "Choose report example images to continue..."; return "Ready. Continue to report viewer."; }, [canContinue, sessionId]);
async function handleContinue() { if (!sessionId || selectedPhotoIds.size === 0) return; try { await putJson(`/sessions/${sessionId}/selection`, { selected_photo_ids: Array.from(selectedPhotoIds), }); navigate(`/report-viewer?session=${encodeURIComponent(sessionId)}`); } catch (err) { const message = err instanceof Error ? err.message : "Failed to save selection."; setStatusMessage(message); } }
return ( <PageShell> <PageHeader title="RepEx - Report Express" subtitle="Review uploads -> pick examples -> continue to report viewer" right={ <span className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-gray-50 px-3 py-2 text-xs font-semibold text-gray-700"> <CheckCircle className="h-4 w-4" /> Uploads processed </span> } />
<section className="mb-8" aria-labelledby="what-next"> <h2 id="what-next" className="text-xl font-semibold text-gray-800 border-b border-gray-200 pb-2 mb-4" > What happens on this page </h2>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4"> <div className="rounded-lg border border-gray-200 bg-gray-50 p-4"> <div className="inline-flex h-10 w-10 items-center justify-center rounded-full bg-blue-50 border border-blue-100 mb-3"> <ImageIcon className="h-5 w-5 text-blue-700" /> </div> <h3 className="font-semibold text-gray-900 mb-1"> Select example photos </h3> <p className="text-sm text-gray-600"> Choose which uploaded images should appear as example figures in the report. </p> </div>
<div className="rounded-lg border border-gray-200 bg-gray-50 p-4"> <div className="inline-flex h-10 w-10 items-center justify-center rounded-full bg-emerald-50 border border-emerald-100 mb-3"> <FileText className="h-5 w-5 text-emerald-700" /> </div> <h3 className="font-semibold text-gray-900 mb-1">Confirm documents</h3> <p className="text-sm text-gray-600"> Ensure supporting PDFs/DOCX are correct (and later attach to export if needed). </p> </div>
<div className="rounded-lg border border-gray-200 bg-gray-50 p-4"> <div className="inline-flex h-10 w-10 items-center justify-center rounded-full bg-amber-50 border border-amber-100 mb-3"> <Table className="h-5 w-5 text-amber-700" /> </div> <h3 className="font-semibold text-gray-900 mb-1">Use Excel/CSV data</h3> <p className="text-sm text-gray-600"> If Excel/CSV exists, it will populate report data areas automatically in later steps. </p> </div> </div> </section>
<section className="mb-8" aria-labelledby="review-uploads"> <h2 id="review-uploads" className="text-xl font-semibold text-gray-800 border-b border-gray-200 pb-2 mb-6" > Review uploaded files </h2>
<div className="grid grid-cols-1 lg:grid-cols-3 gap-6"> <div className="lg:col-span-2"> <div className="flex items-center justify-between mb-3"> <h3 className="text-lg font-semibold text-gray-900">Photos</h3> <span className="text-sm font-semibold text-gray-600"> {photos.length} file{photos.length === 1 ? "" : "s"} </span> </div>
<div className="rounded-lg border border-gray-200 bg-white p-4"> <p className="text-sm text-gray-600 mb-3"> Select images to use as example figures in the report.{" "} <span className="font-semibold text-gray-800">Recommended:</span>{" "} 2-6 images. </p>
<div className="grid grid-cols-2 md:grid-cols-3 gap-3"> {photos.length === 0 ? ( <div className="col-span-full text-sm text-gray-500"> No photos were uploaded. </div> ) : ( photos.map((photo) => { const isChecked = selectedPhotoIds.has(photo.id); return ( <label key={photo.id} className="cursor-pointer"> <input type="checkbox" className="sr-only" checked={isChecked} onChange={(event) => { const next = new Set(selectedPhotoIds); if (event.target.checked) { next.add(photo.id); } else { next.delete(photo.id); } setSelectedPhotoIds(next); }} /> <div className={[ "rounded-lg border bg-gray-50 overflow-hidden transition", isChecked ? "ring-2 ring-emerald-200 border-emerald-300" : "border-gray-200", ].join(" ")} > <div className="relative"> <img src={photo.url} alt={photo.name} className="h-28 w-full object-cover" loading="eager" /> <div className={[ "absolute top-2 right-2 inline-flex items-center justify-center rounded-full border p-1.5", isChecked ? "bg-emerald-50 border-emerald-200 text-emerald-700" : "bg-white/90 border-gray-200 text-gray-700", ].join(" ")} > <CheckCircle className="h-4 w-4" /> </div> </div> <div className="p-2"> <div className="text-xs font-semibold text-gray-900 truncate"> {photo.name} </div> <div className="text-xs text-gray-500"> Click to select for report </div> </div> </div> </label> ); }) )} </div>
<div className="mt-4 flex flex-wrap items-center justify-between gap-3"> <div className="text-sm text-gray-600"> Selected for report:{" "} <span className="font-semibold text-gray-900"> {selectedPhotoIds.size} </span> </div> <div className="flex gap-2"> <button type="button" onClick={() => { setSelectedPhotoIds(new Set(photos.map((p) => p.id))); }} className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition" > <CheckSquare className="h-4 w-4" /> Select all </button> <button type="button" onClick={() => setSelectedPhotoIds(new Set())} className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition" > <Square className="h-4 w-4" /> Clear </button> </div> </div> </div> </div>
<div className="space-y-6"> <div> <div className="flex items-center justify-between mb-3"> <h3 className="text-lg font-semibold text-gray-900">Documents</h3> <span className="text-sm font-semibold text-gray-600"> {documents.length} file{documents.length === 1 ? "" : "s"} </span> </div>
<div className="rounded-lg border border-gray-200 bg-white p-4"> <ul className="space-y-2 text-sm text-gray-700"> {documents.length === 0 ? ( <li className="text-sm text-gray-500"> No supporting documents detected. </li> ) : ( documents.map((doc) => ( <li key={doc.id} className="flex items-center justify-between gap-3 rounded-lg border border-gray-200 bg-gray-50 px-3 py-2" > <div className="flex items-center gap-2 min-w-0"> <FileText className="h-4 w-4 text-gray-600" /> <span className="truncate text-gray-800">{doc.name}</span> </div> <span className="text-xs font-semibold text-gray-600"> {doc.content_type || "File"} </span> </li> )) )} </ul> {documents.length === 0 ? ( <p className="text-xs text-gray-500 mt-3"> PDFs/DOCX appear here after processing. </p> ) : null} </div> </div>
<div> <div className="flex items-center justify-between mb-3"> <h3 className="text-lg font-semibold text-gray-900">Data files</h3> <span className="text-sm font-semibold text-gray-600"> {dataFiles.length} file{dataFiles.length === 1 ? "" : "s"} </span> </div>
<div className="rounded-lg border border-gray-200 bg-white p-4"> {dataFiles.length === 0 ? ( <div className="rounded-lg border border-gray-200 bg-gray-50 p-3 text-sm text-gray-600"> <div className="font-semibold text-gray-800 mb-1"> No Excel/CSV detected </div> If you upload a CSV or Excel file, RepEx can auto-populate report data fields. </div> ) : ( dataFiles.map((file) => ( <div key={file.id} className="rounded-lg border border-gray-200 bg-gray-50 p-3 text-sm text-gray-700 mb-2 last:mb-0" > <div className="flex items-center justify-between gap-3"> <div className="flex items-center gap-2 min-w-0"> <Table className="h-4 w-4 text-amber-700" /> <span className="truncate font-semibold text-gray-900"> {file.name} </span> </div> <span className="text-xs font-semibold text-gray-600"> {file.content_type || "Data"} </span> </div> <div className="text-xs text-gray-600 mt-1"> Will populate report data areas (tables/fields). </div> </div> )) )} <p className="text-xs text-gray-500 mt-3"> If present, these files will populate report tables/fields automatically. </p> </div> </div> </div> </div> </section>
<section className="mb-4" aria-label="Continue to report viewer"> <div className="rounded-lg border border-gray-200 bg-gray-50 p-4 flex flex-col sm:flex-row gap-3 sm:items-center sm:justify-between"> <div className={[ "text-sm", canContinue ? "text-emerald-700 font-semibold" : "text-amber-700 font-semibold", ].join(" ")} > {readyStatus} </div>
<button type="button" onClick={handleContinue} disabled={!canContinue} className="inline-flex items-center justify-center gap-2 rounded-lg bg-emerald-600 px-5 py-2.5 text-white font-semibold hover:bg-emerald-700 transition disabled:opacity-50 disabled:cursor-not-allowed" > <ArrowRight className="h-5 w-5" /> Continue to Report Viewer </button> </div>
<p className="text-xs text-gray-500 mt-3"> Note: This page assumes uploads were completed on a previous processing step. </p> </section>
{statusMessage ? ( <p className="text-sm text-red-600">{statusMessage}</p> ) : null}
<PageFooter note="Workflow: Processing -> Review uploads -> Report viewer -> Edit -> Export" /> </PageShell> );}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411import { useEffect, useMemo, useRef, useState } from "react";import { useNavigate } from "react-router-dom";import { ArrowDownCircle, Upload, Info, Camera, UploadCloud, FileText, FilePlus, Edit,} from "react-feather";
import { postForm, request } from "../lib/api";import { formatBytes } from "../lib/format";import { setStoredSessionId } from "../lib/session";import type { Session } from "../types/session";
type StatusTone = "idle" | "info" | "error";
export default function UploadPage() { const navigate = useNavigate(); const inputRef = useRef<HTMLInputElement | null>(null); const [selectedFiles, setSelectedFiles] = useState<File[]>([]); const [projectName, setProjectName] = useState(""); const [inspectionDate, setInspectionDate] = useState(""); const [notes, setNotes] = useState(""); const [uploadStatus, setUploadStatus] = useState(""); const [statusTone, setStatusTone] = useState<StatusTone>("idle"); const [recentSessions, setRecentSessions] = useState<Session[]>([]); const [dragActive, setDragActive] = useState(false); const [isSubmitting, setIsSubmitting] = useState(false);
const fileSummary = useMemo(() => { if (!selectedFiles.length) { return "Supports JPG, PNG, PDF, DOCX, CSV, XLSX (Max 50MB each)"; } return selectedFiles .map((file) => `${file.name} (${formatBytes(file.size)})`) .join(" - "); }, [selectedFiles]);
useEffect(() => { async function loadSessions() { try { const sessions = await request<Session[]>("/sessions"); if (Array.isArray(sessions)) { setRecentSessions(sessions.slice(0, 5)); } } catch { // ignore for now } } loadSessions(); }, []);
function handleBrowseClick() { inputRef.current?.click(); }
function handleFilesChange(files: FileList | null) { if (!files) return; setSelectedFiles(Array.from(files)); }
function handleDrop(event: React.DragEvent<HTMLDivElement>) { event.preventDefault(); setDragActive(false); const files = Array.from(event.dataTransfer.files || []); if (files.length) { setSelectedFiles(files); if (inputRef.current) inputRef.current.value = ""; } }
async function handleSubmit() { if (!selectedFiles.length) { setUploadStatus("Please add at least one file to continue."); setStatusTone("info"); return; }
setIsSubmitting(true); setUploadStatus("Uploading files..."); setStatusTone("idle");
const formData = new FormData(); formData.append("project_name", projectName.trim()); formData.append("inspection_date", inspectionDate); formData.append("notes", notes.trim()); selectedFiles.forEach((file) => formData.append("files", file));
try { const session = await postForm<Session>("/sessions", formData); setStoredSessionId(session.id); navigate(`/processing?session=${encodeURIComponent(session.id)}`); } catch (err) { const message = err instanceof Error ? err.message : "Upload failed. Please try again."; setUploadStatus(message); setStatusTone("error"); setIsSubmitting(false); } }
return ( <main className="max-w-4xl mx-auto my-8 bg-white shadow-sm ring-1 ring-gray-200 rounded-xl p-6 md:p-8"> <header className="mb-10 border-b border-gray-200 pb-4"> <div className="grid grid-cols-[auto,1fr,auto] items-center gap-4"> <div className="flex items-center"> <img src="/assets/prosento-logo.png" alt="Company logo" className="h-12 w-auto object-contain" loading="eager" /> </div>
<div className="text-center"> <h1 className="text-2xl md:text-3xl font-bold text-gray-900 whitespace-nowrap"> Prosento RepEx </h1> <p className="text-gray-600 whitespace-nowrap"> Upload photos and documents to generate professional job reports instantly </p> </div>
<div className="flex justify-end"> <a href="#upload" className="inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-semibold text-gray-800 hover:bg-gray-50 transition" > <ArrowDownCircle className="h-4 w-4" /> Upload </a> </div> </div> </header>
<section className="text-center mb-12"> <h2 className="text-3xl md:text-4xl font-bold text-gray-900 mb-3"> Generate inspection-ready reports in minutes </h2> <p className="text-base md:text-lg text-gray-600 mb-8"> Drag and drop files, add quick context, and produce a clean, consistent report format every time. </p>
<div className="flex flex-col sm:flex-row justify-center gap-3"> <a href="#upload" className="inline-flex items-center justify-center gap-2 rounded-lg bg-blue-600 px-6 py-3 text-white font-semibold hover:bg-blue-700 transition" > <Upload className="h-5 w-5" /> Start Uploading </a>
<a href="#how-it-works" className="inline-flex items-center justify-center gap-2 rounded-lg border border-gray-200 bg-white px-6 py-3 text-gray-800 font-semibold hover:bg-gray-50 transition" > <Info className="h-5 w-5" /> Learn More </a> </div> </section>
<section id="how-it-works" className="mb-12"> <h2 className="text-xl md:text-2xl font-semibold text-gray-800 border-b border-gray-200 pb-2 mb-6"> How It Works </h2>
<div className="grid grid-cols-1 md:grid-cols-3 gap-4"> <article className="rounded-lg border border-gray-200 bg-gray-50 p-5"> <div className="mb-4 inline-flex h-10 w-10 items-center justify-center rounded-full bg-blue-50 border border-blue-100"> <Camera className="h-5 w-5 text-blue-700" /> </div> <h3 className="text-base font-semibold text-gray-900 mb-1">Capture site photos</h3> <p className="text-sm text-gray-600"> Take clear photos of structural elements and issues during your inspection. </p> </article>
<article className="rounded-lg border border-gray-200 bg-gray-50 p-5"> <div className="mb-4 inline-flex h-10 w-10 items-center justify-center rounded-full bg-emerald-50 border border-emerald-100"> <UploadCloud className="h-5 w-5 text-emerald-700" /> </div> <h3 className="text-base font-semibold text-gray-900 mb-1">Upload documents</h3> <p className="text-sm text-gray-600"> Add notes, measurements, and supporting PDFs/DOCX to complete the context. </p> </article>
<article className="rounded-lg border border-gray-200 bg-gray-50 p-5"> <div className="mb-4 inline-flex h-10 w-10 items-center justify-center rounded-full bg-blue-50 border border-blue-100"> <FileText className="h-5 w-5 text-blue-700" /> </div> <h3 className="text-base font-semibold text-gray-900 mb-1">Generate report</h3> <p className="text-sm text-gray-600"> Produce a consistent, professional report that is ready for submission. </p> </article> </div> </section>
<section id="upload" className="mb-12"> <h2 className="text-xl md:text-2xl font-semibold text-gray-800 border-b border-gray-200 pb-2 mb-6"> Upload Your Files </h2>
<div className="rounded-lg border border-gray-200 bg-white p-6"> <div onDragEnter={() => setDragActive(true)} onDragOver={(event) => { event.preventDefault(); setDragActive(true); }} onDragLeave={(event) => { event.preventDefault(); setDragActive(false); }} onDrop={handleDrop} role="button" tabIndex={0} aria-label="Drag and drop files here" className={[ "rounded-lg border-2 border-dashed p-8 text-center transition mb-6", dragActive ? "border-blue-500 bg-blue-50" : "border-gray-300 bg-gray-50 hover:border-blue-400", ].join(" ")} > <div className="mx-auto mb-4 inline-flex h-12 w-12 items-center justify-center rounded-full bg-blue-50 border border-blue-100"> <Upload className="h-5 w-5 text-blue-700" /> </div>
<h3 className="text-base font-semibold text-gray-900">Drag & drop files here</h3> <p className="text-sm text-gray-600 mt-1 mb-4">or browse to upload</p>
<button type="button" onClick={handleBrowseClick} className="inline-flex items-center justify-center rounded-lg bg-blue-600 px-5 py-2.5 text-white font-semibold hover:bg-blue-700 transition" > Browse Files </button>
<input ref={inputRef} type="file" className="hidden" multiple accept=".jpg,.jpeg,.png,.webp,.pdf,.doc,.docx,.csv,.xls,.xlsx" onChange={(event) => handleFilesChange(event.target.files)} />
<p className="text-xs text-gray-500 mt-4">{fileSummary}</p> </div>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <div className="space-y-1"> <label className="block text-sm font-medium text-gray-700" htmlFor="projectName"> Project Name </label> <input id="projectName" type="text" value={projectName} onChange={(event) => setProjectName(event.target.value)} placeholder="e.g., North Pit Conveyor Support" className="w-full rounded-lg border border-gray-300 px-4 py-2 text-gray-900 focus:outline-none focus:ring-2 focus:ring-blue-200 focus:border-blue-500" /> </div>
<div className="space-y-1"> <label className="block text-sm font-medium text-gray-700" htmlFor="inspectionDate"> Inspection Date </label> <input id="inspectionDate" type="date" value={inspectionDate} onChange={(event) => setInspectionDate(event.target.value)} className="w-full rounded-lg border border-gray-300 px-4 py-2 text-gray-900 focus:outline-none focus:ring-2 focus:ring-blue-200 focus:border-blue-500" /> </div> </div>
<div className="space-y-1 mb-6"> <label className="block text-sm font-medium text-gray-700" htmlFor="notes"> Additional Notes </label> <textarea id="notes" rows={4} value={notes} onChange={(event) => setNotes(event.target.value)} placeholder="Add any context you'd like included in the report..." className="w-full rounded-lg border border-gray-300 px-4 py-2 text-gray-900 focus:outline-none focus:ring-2 focus:ring-blue-200 focus:border-blue-500" /> </div>
<button type="button" onClick={handleSubmit} disabled={isSubmitting} className="w-full inline-flex items-center justify-center gap-2 rounded-lg bg-emerald-600 px-6 py-3 text-white font-semibold hover:bg-emerald-700 transition disabled:opacity-50 disabled:cursor-not-allowed" > <FilePlus className="h-5 w-5" /> Generate Report </button> {uploadStatus ? ( <p className={[ "text-sm mt-3", statusTone === "error" ? "text-red-600" : statusTone === "info" ? "text-amber-700" : "text-gray-600", ].join(" ")} > {uploadStatus} </p> ) : null} </div> </section>
<section className="mb-6"> <h2 className="text-xl md:text-2xl font-semibold text-gray-800 border-b border-gray-200 pb-2 mb-6"> Recent Reports </h2>
<div className="rounded-lg border border-gray-200 bg-white overflow-hidden"> <div className="overflow-x-auto"> <table className="min-w-full divide-y divide-gray-200"> <thead className="bg-gray-50"> <tr> <th className="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"> Report ID </th> <th className="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"> Project </th> <th className="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"> Date </th> <th className="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"> Status </th> <th className="px-6 py-3 text-left text-xs font-semibold text-gray-500 uppercase tracking-wider"> Actions </th> </tr> </thead>
<tbody className="bg-white divide-y divide-gray-200"> {recentSessions.length === 0 ? ( <tr> <td colSpan={5} className="px-6 py-6 text-sm text-gray-500 text-center"> No recent reports yet. </td> </tr> ) : ( recentSessions.map((session) => ( <tr key={session.id}> <td className="px-6 py-4 whitespace-nowrap text-sm font-semibold text-gray-900"> #{session.id.slice(0, 8)} </td> <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-600"> {session.project_name || "Untitled project"} </td> <td className="px-6 py-4 whitespace-nowrap text-sm text-gray-600"> {session.created_at ? new Date(session.created_at).toLocaleDateString() : "-"} </td> <td className="px-6 py-4 whitespace-nowrap"> <span className="inline-flex items-center rounded-md border px-2.5 py-1 text-xs font-semibold bg-emerald-50 text-emerald-700 border-emerald-200"> {session.status || "ready"} </span> </td> <td className="px-6 py-4 whitespace-nowrap text-sm"> <button type="button" onClick={() => navigate(`/report-viewer?session=${session.id}`) } className="inline-flex items-center text-blue-700 hover:text-blue-800" aria-label="View report" > <Edit className="h-4 w-4" /> </button> </td> </tr> )) )} </tbody> </table> </div> </div> </section>
<footer className="mt-12 text-center text-xs text-gray-500"> <p>Prosento - (c) 2026 All Rights Reserved</p> <p className="mt-1"> RepEx is a report automation interface. All uploads should comply with site data policies. </p> </footer> </main> );}123456789101112131415161718192021222324252627import type React from "react";import type { Session } from "./session";
declare global { interface ReportEditorOpenOptions { payload?: Session | null; pageIndex?: number; totalPages?: number; sessionId?: string | null; apiBase?: string | null; }
interface ReportEditorElement extends HTMLElement { open: (options?: ReportEditorOpenOptions) => void; }
namespace JSX { interface IntrinsicElements { "report-editor": React.DetailedHTMLProps< React.HTMLAttributes<ReportEditorElement>, ReportEditorElement >; } }}
export {};12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667export type FileMeta = { id: string; name: string; size: number; content_type: string; category: string; url?: string;};
export type SessionUploads = { photos?: FileMeta[]; documents?: FileMeta[]; data_files?: FileMeta[];};
export type Session = { id: string; status: string; created_at: string; updated_at: string; project_name: string; inspection_date: string; notes: string; uploads: SessionUploads; selected_photo_ids: string[]; page_count: number;};
export type SessionStatus = { id: string; status: string; updated_at: string;};
export type PageItemStyle = { fontSize?: number; bold?: boolean; italic?: boolean; underline?: boolean; color?: string; align?: "left" | "center" | "right"; fill?: string; stroke?: string; strokeWidth?: number;};
export type PageItem = { id: string; type: "text" | "image" | "rect"; x: number; y: number; w: number; h: number; z?: number; content?: string; src?: string; name?: string; style?: PageItemStyle;};
export type Page = { items: PageItem[];};
export type PagesResponse = { pages: Page[];};1/// <reference types="vite/client" />123456789/// <reference types="vite/client" />interface ImportMetaEnv {readonly VITE_API_BASE?: string;}interface ImportMeta {readonly env: ImportMetaEnv;}
12345678/** @type {import('tailwindcss').Config} */export default { content: ["./index.html", "./src/**/*.{ts,tsx,js,jsx}"], theme: { extend: {}, }, plugins: [],};2 unmodified lines34567892 unmodified lines"target": "ES2020","useDefineForClassFields": true,"lib": ["DOM", "DOM.Iterable", "ES2020"],"allowJs": false,"skipLibCheck": true,"esModuleInterop": false,"allowSyntheticDefaultImports": true,2 unmodified lines34567892 unmodified lines"target": "ES2020","useDefineForClassFields": true,"lib": ["DOM", "DOM.Iterable", "ES2020"],"allowJs": true,"skipLibCheck": true,"esModuleInterop": false,"allowSyntheticDefaultImports": true,
4 unmodified lines56789104 unmodified linesplugins: [react()],server: {port: 5173,},preview: {port: 4173,4 unmodified lines56789101112134 unmodified linesplugins: [react()],server: {port: 5173,proxy: {"/api": "http://localhost:8000",},},preview: {port: 4173,
20 unmodified lines21222324252648 unmodified lines7576777879804 unmodified lines8586878889908 unmodified lines991001011021031043 unmodified lines1081091101111121137 unmodified lines1211221231241251267 unmodified lines1341351361371381397 unmodified lines14714814915015115220 unmodified linesrouter = APIRouter()def _attach_urls(session: dict) -> dict:session = dict(session)uploads = {}48 unmodified lines@router.get("/{session_id}", response_model=SessionResponse)def get_session(session_id: str, store: SessionStore = Depends(get_session_store)) -> SessionResponse:session = store.get_session(session_id)if not session:raise HTTPException(status_code=404, detail="Session not found.")4 unmodified linesdef get_session_status(session_id: str, store: SessionStore = Depends(get_session_store)) -> SessionStatusResponse:session = store.get_session(session_id)if not session:raise HTTPException(status_code=404, detail="Session not found.")8 unmodified linespayload: SelectionRequest,store: SessionStore = Depends(get_session_store),) -> SessionResponse:session = store.get_session(session_id)if not session:raise HTTPException(status_code=404, detail="Session not found.")3 unmodified lines@router.get("/{session_id}/pages", response_model=PagesResponse)def get_pages(session_id: str, store: SessionStore = Depends(get_session_store)) -> PagesResponse:session = store.get_session(session_id)if not session:raise HTTPException(status_code=404, detail="Session not found.")7 unmodified linespayload: PagesRequest,store: SessionStore = Depends(get_session_store),) -> PagesResponse:session = store.get_session(session_id)if not session:raise HTTPException(status_code=404, detail="Session not found.")7 unmodified linesfile_id: str,store: SessionStore = Depends(get_session_store),) -> FileResponse:session = store.get_session(session_id)if not session:raise HTTPException(status_code=404, detail="Session not found.")7 unmodified linesdef export_package(session_id: str, store: SessionStore = Depends(get_session_store)) -> FileResponse:session = store.get_session(session_id)if not session:raise HTTPException(status_code=404, detail="Session not found.")20 unmodified lines2122232425262728293031323348 unmodified lines828384858687884 unmodified lines939495969798998 unmodified lines1081091101111121131143 unmodified lines1181191201211221231247 unmodified lines1321331341351361371387 unmodified lines1461471481491501511527 unmodified lines16016116216316416516620 unmodified linesrouter = APIRouter()def _normalize_session_id(session_id: str, store: SessionStore) -> str:try:return store.validate_session_id(session_id)except ValueError as exc:raise HTTPException(status_code=400, detail=str(exc)) from excdef _attach_urls(session: dict) -> dict:session = dict(session)uploads = {}48 unmodified lines@router.get("/{session_id}", response_model=SessionResponse)def get_session(session_id: str, store: SessionStore = Depends(get_session_store)) -> SessionResponse:session_id = _normalize_session_id(session_id, store)session = store.get_session(session_id)if not session:raise HTTPException(status_code=404, detail="Session not found.")4 unmodified linesdef get_session_status(session_id: str, store: SessionStore = Depends(get_session_store)) -> SessionStatusResponse:session_id = _normalize_session_id(session_id, store)session = store.get_session(session_id)if not session:raise HTTPException(status_code=404, detail="Session not found.")8 unmodified linespayload: SelectionRequest,store: SessionStore = Depends(get_session_store),) -> SessionResponse:session_id = _normalize_session_id(session_id, store)session = store.get_session(session_id)if not session:raise HTTPException(status_code=404, detail="Session not found.")3 unmodified lines@router.get("/{session_id}/pages", response_model=PagesResponse)def get_pages(session_id: str, store: SessionStore = Depends(get_session_store)) -> PagesResponse:session_id = _normalize_session_id(session_id, store)session = store.get_session(session_id)if not session:raise HTTPException(status_code=404, detail="Session not found.")7 unmodified linespayload: PagesRequest,store: SessionStore = Depends(get_session_store),) -> PagesResponse:session_id = _normalize_session_id(session_id, store)session = store.get_session(session_id)if not session:raise HTTPException(status_code=404, detail="Session not found.")7 unmodified linesfile_id: str,store: SessionStore = Depends(get_session_store),) -> FileResponse:session_id = _normalize_session_id(session_id, store)session = store.get_session(session_id)if not session:raise HTTPException(status_code=404, detail="Session not found.")7 unmodified linesdef export_package(session_id: str, store: SessionStore = Depends(get_session_store)) -> FileResponse:session_id = _normalize_session_id(session_id, store)session = store.get_session(session_id)if not session:raise HTTPException(status_code=404, detail="Session not found.")
1234567812 unmodified lines2122232425262728from pathlib import Pathfrom fastapi import FastAPIfrom fastapi.middleware.cors import CORSMiddlewarefrom fastapi.staticfiles import StaticFilesfrom .api.router import api_routerfrom .core.config import get_settings12 unmodified lines)app.include_router(api_router, prefix=settings.api_prefix)static_root = Path(__file__).resolve().parents[2]app.mount("/", StaticFiles(directory=static_root, html=True), name="static")return app1234567812 unmodified lines212223242526272829303132333435363738394041424344from pathlib import Pathfrom fastapi import FastAPI, HTTPExceptionfrom fastapi.middleware.cors import CORSMiddlewarefrom fastapi.responses import FileResponsefrom .api.router import api_routerfrom .core.config import get_settings12 unmodified lines)app.include_router(api_router, prefix=settings.api_prefix)static_root = Path(__file__).resolve().parents[2] / "frontend" / "dist"if static_root.exists():index_file = static_root / "index.html"@app.get("/", include_in_schema=False)def serve_index() -> FileResponse:return FileResponse(index_file)@app.get("/{full_path:path}", include_in_schema=False)def serve_spa(full_path: str) -> FileResponse:if full_path.startswith("api/"):raise HTTPException(status_code=404)candidate = (static_root / full_path).resolve()if not str(candidate).startswith(str(static_root.resolve())):raise HTTPException(status_code=404)if candidate.is_file():return FileResponse(candidate)return FileResponse(index_file)return app
16 unmodified lines17181920212227 unmodified lines50515253545531 unmodified lines87888990919278 unmodified lines17117217317417517617716 unmodified linesIMAGE_EXTS = {".jpg", ".jpeg", ".png", ".gif", ".webp"}DOC_EXTS = {".pdf", ".doc", ".docx"}DATA_EXTS = {".csv", ".xls", ".xlsx"}@dataclass27 unmodified linesreturn "documents"class SessionStore:def __init__(self, base_dir: Optional[Path] = None) -> None:settings = get_settings()31 unmodified linesself._save_session(session)return sessiondef get_session(self, session_id: str) -> Optional[dict]:session_path = self._session_file(session_id)if not session_path.exists():78 unmodified lines)def _session_dir(self, session_id: str) -> Path:return self.sessions_dir / session_iddef session_dir(self, session_id: str) -> Path:return self._session_dir(session_id)16 unmodified lines1718192021222327 unmodified lines51525354555657585960616263646531 unmodified lines97989910010110210310410578 unmodified lines18418518618718818919019119219319416 unmodified linesIMAGE_EXTS = {".jpg", ".jpeg", ".png", ".gif", ".webp"}DOC_EXTS = {".pdf", ".doc", ".docx"}DATA_EXTS = {".csv", ".xls", ".xlsx"}SESSION_ID_RE = re.compile(r"^[0-9a-f]{32}$")@dataclass27 unmodified linesreturn "documents"def _validate_session_id(session_id: str) -> str:if not session_id:raise ValueError("Invalid session id.")normalized = session_id.lower()if not SESSION_ID_RE.match(normalized):raise ValueError("Invalid session id.")return normalizedclass SessionStore:def __init__(self, base_dir: Optional[Path] = None) -> None:settings = get_settings()31 unmodified linesself._save_session(session)return sessiondef validate_session_id(self, session_id: str) -> str:return _validate_session_id(session_id)def get_session(self, session_id: str) -> Optional[dict]:session_path = self._session_file(session_id)if not session_path.exists():78 unmodified lines)def _session_dir(self, session_id: str) -> Path:safe_id = _validate_session_id(session_id)path = (self.sessions_dir / safe_id).resolve()if not str(path).startswith(str(self.sessions_dir.resolve())):raise ValueError("Invalid session id.")return pathdef session_dir(self, session_id: str) -> Path:return self._session_dir(session_id)
README.md+39-20
frontend/index.html+1-1
frontend/package-lock.json+1026-26
frontend/package.json+6-1
frontend/postcss.config.jsAdded+6
frontend/public/assets/client-logo.pngAdded

frontend/public/assets/prosento-logo.pngAdded

frontend/public/templates/job-sheet-template.htmlAdded+286
frontend/src/App.tsx+22-1
frontend/src/components/PageFooter.tsxAdded+12
frontend/src/components/PageHeader.tsxAdded+35
frontend/src/components/PageShell.tsxAdded+19
frontend/src/components/report-editor.jsAdded+1177
frontend/src/index.css+16-11
frontend/src/lib/api.tsAdded+55
frontend/src/lib/format.tsAdded+12
frontend/src/lib/session.tsAdded+27
frontend/src/main.tsx+1
frontend/src/pages/EditLayoutsPage.tsxAdded+49
frontend/src/pages/ExportPage.tsxAdded+273
frontend/src/pages/ProcessingPage.tsxAdded+86
frontend/src/pages/ReportViewerPage.tsxAdded+336
frontend/src/pages/ReviewSetupPage.tsxAdded+376
frontend/src/pages/UploadPage.tsxAdded+411
frontend/src/types/custom-elements.d.tsAdded+27
frontend/src/types/session.tsAdded+67
frontend/src/vite-env.d.ts+8
frontend/tailwind.config.jsAdded+8
frontend/tsconfig.json+1-1
frontend/vite.config.ts+3
server/app/api/routes/sessions.py+14
server/app/main.py+20-4
server/app/services/session_store.py+18-1