The previous commit dropped real data for The Hills ext 12
(sites, vehicles, employees, orders, plant hire rates, P&G
expenses) so the dashboard had something to render during design
iteration. With PB about to be wired, that data now belongs in
PocketBase rather than in the source tree.
This commit empties the data layer back to zero so the dashboard
falls into its empty-state UI on every page:
- src/lib/mock-data.ts SITES_DATA, SITES, SUPPLIERS, VEHICLES,
EMPLOYEES, ORDERS, FUEL_READINGS,
PLANT_HIRE_RATES, PG_EXPENSES → []
Header comment updated to point future
contributors at lib/pb.ts as the next
step.
- src/lib/uploads.ts UPLOAD_HISTORY → []. Acceptance rules
(mime / extensions / size limits) kept so
the Uploads page still shows format hints.
Type definitions, helper functions and date utilities are untouched
so all routes continue to render (HTTP 200 across the board). The
sidebar, dashboard, fuel, orders, employees, sites and uploads pages
all gracefully render their empty states.
When PocketBase is wired:
1. Install 'pocketbase' (npm)
2. Build src/lib/pb.ts with admin-authed server client + public
client
3. Replace the imports in pages like
import { SITES_DATA, VEHICLES, ... } from '@/lib/mock-data';
with calls like
import { getServerPB } from '@/lib/pb';
const records = await getServerPB().collection('sites').getList();
4. Keep the empty exports here as a final fallback so the dashboard
still works if PB is ever unreachable.
51 lines
2.5 KiB
TypeScript
51 lines
2.5 KiB
TypeScript
import type { UploadEntry, UploadKind, UploadAcceptance } from "./types";
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Upload acceptance rules — kept populated so the UI on /dashboard/uploads
|
|
// can still render its format / size hints and the /api/upload endpoint
|
|
// can still validate incoming files. Once PocketBase is wired, the
|
|
// history below will be replaced with live queries to the appropriate
|
|
// PB collection per kind.
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export const UPLOAD_ACCEPTANCE: Record<UploadKind, UploadAcceptance> = {
|
|
orders: {
|
|
mimes: ["text/csv", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
extensions: [".csv", ".xls", ".xlsx"],
|
|
maxBytes: 10 * 1024 * 1024, // 10 MB
|
|
description: "Bulk purchase order lines, supplier invoices, or stock-sheet exports.",
|
|
},
|
|
"delivery-notes": {
|
|
mimes: ["application/pdf", "image/png", "image/jpeg", "image/webp"],
|
|
extensions: [".pdf", ".png", ".jpg", ".jpeg", ".webp"],
|
|
maxBytes: 20 * 1024 * 1024, // 20 MB
|
|
description: "Scanned delivery notes, supplier GRNs, or photos of the docket.",
|
|
},
|
|
"fuel-logs": {
|
|
mimes: ["text/csv", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
extensions: [".csv", ".xls", ".xlsx"],
|
|
maxBytes: 5 * 1024 * 1024, // 5 MB
|
|
description: "Per-vehicle daily fuel-issue exports from the depot system.",
|
|
},
|
|
"time-sheets": {
|
|
mimes: ["text/csv", "application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],
|
|
extensions: [".csv", ".xls", ".xlsx"],
|
|
maxBytes: 5 * 1024 * 1024,
|
|
description: "Weekly or daily timesheet exports from the payroll system.",
|
|
},
|
|
};
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Upload history — empty until PocketBase is wired. The shape of each
|
|
// entry matches `UploadEntry`; once your ingest pipeline lands in
|
|
// lib/pb.ts, append live records here and the Uploads page will render
|
|
// them (or replace this export entirely with a PB query).
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export const UPLOAD_HISTORY: UploadEntry[] = [];
|
|
|
|
// Helper for callers that want to filter by kind. Returns an empty array
|
|
// when `UPLOAD_HISTORY` is empty.
|
|
export function uploadsByKind(kind: UploadKind): UploadEntry[] {
|
|
return UPLOAD_HISTORY.filter((u) => u.kind === kind);
|
|
}
|