mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-09-30 09:13:11 +00:00
* fix: correct Sea Haven branding in page title and wordmark * chore: use correct company name in docs and comments * docs: rewrite README * docs: add README badge block per github-standards * fix: update command syntax in deployment instructions * fix: replace template PWA icons and manifest branding * test: assert PWA manifest branding
4.7 KiB
4.7 KiB
Architecture Plan — Sea Haven (Selective Rebuild)
Aligned with IrisLoan.Admin · Vite SPA + React Router · no Next.js · Tailwind + MUI
Mirror document of the Cursor plan. Strategy: reuse knowledge, discard legacy code — do not normalize/refactor the current project.
Strategy in one sentence
Build api/ + domain/ + app/ from scratch; use pages/ only as endpoint and business rule reference; delete each legacy folder when the new feature is ready.
Matrix: Keep vs Discard
Keep (extract logic → new code)
| Legacy | Keep | Destination |
|---|---|---|
lib/api/services.js |
ASP.NET paths + response parsing | api/api-paths.ts, api/handle-api-response.ts |
pages/*/api.js |
Real endpoints | api/api-paths.ts |
constants/queryKeys.js |
Entities | infra/query-key/query-key.ts |
hooks/useDebounce.js, useModal.js |
Hooks | hooks/*.ts |
hooks/api/usePMSchedules.js |
RQ pattern | Template domain/*/use-cases/ |
lib/queryClient.js |
Cache defaults | lib/query/query-client.ts |
App.js, Sidebar.js |
Routes and menu | app/routes.tsx, config/menu.ts |
pages/workorders/ (list) |
Business flow | Reference for POC |
Discard (delete without refactoring)
apiUtil.js,services/api.js,lib/api/client.jstokenUtility.js,authService.js, Redux (app/store.js, slices)usePaginatedList.js, entirepages/folder (after replacement)Site.Layout.js,setupProxy.js,site.css, per-feature CSS, Font Awesome- Forms
*FormPage.js(rewrite with RHF + Zod) SharedTable.js,ActionBar.js(recreate if adapting is costly)
Defer (later)
pages/vendor-portal/→domain/vendor-portal/pages/calendar/→ new FullCalendar wrapper
Feature priority
Full matrix (waves, dependencies, LOC, done criteria): FEATURE_PRIORITIZATION.md · TS config: src/config/feature-priorities.ts.
| Wave | Scope |
|---|---|
| 0 POC | auth → work-orders (list) |
| 1 must-have | work-orders (full), dashboard, settings/dropdowns |
| 2 | accounts, locations, employees |
| 3 should-have | vendors, vendor-pos, uplifts, follow-ups, contacts, settings/task-templates |
| 4 later | calendar, vendor-portal, pm-schedules, assets, reports/documents |
Stakeholder decision: auth + work-orders first; POC = auth + work-orders list (not pm-schedules).
Target structure
src/
├── api/
├── domain/<feature>/
├── infra/query-key/
├── lib/
├── components/ui/ + common/
├── app/
├── config/menu.ts
├── hooks/
├── providers/
└── main.tsx
Phases
| Phase | Goal |
|---|---|
| 0 | Complete foundation (Ky, routes, layout, AuthProvider, tooling) — Vite/TS/Tailwind ok |
| 1 | Ky + httpOnly auth cookies; delete legacy HTTP stacks |
| 2 | Rewrite must-have features; delete pages/<feature>/ per delivery |
| 3 | UI shell + RHF+Zod forms |
| 4 | Remove pages/, Redux, legacy CSS; Docker + CI + Vitest |
Next steps
- Complete foundation (
api/api.ts,routes.tsx, AuthProvider, layout shell) api/api-paths.ts(extract fromlib/api/services.js)- POC:
domain/auth+ login → deletepages/auth/ - POC:
domain/work-orders(list) → delete list portion ofpages/workorders/ - Cookie contract with backend
See full plan with diagrams in .cursor/plans/migração_arquitetura_irisloan_cf39e1a6.plan.md.