feat: simple frontend #4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "0-simple-frontend"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In
frontend/src/components/InvoicesPage.tsx— employees fetch currently doesfetch('/api/employees').then(res => res.json())without checkingres.ok. If the API returns a non-2xx response you'll still attempt tosetEmployees(data.employees)and might crash or silently show an empty list. Please check the response status and handle error payloads (and network errors). Also consider using an AbortController to cancel the request on unmount to avoid setting state on an unmounted component.Changes Requested
Please address the following before merging:
frontend/src/index.csscontent with Tailwind directives (@tailwind base; @tailwind components; @tailwind utilities;).frontend/postcss.config.cjsor a CommonJSpostcss.config.js) that exportstailwindcssandautoprefixerplugins. Vite/PostCSS expect CommonJS by default.frontend/src/components/InvoicesPage.tsx:AbortControllerfor the invoices fetch and abort on cleanup to avoid setting state after unmount.res.okand surface API error payloads (usedata.errorwhen available).data.invoicesanddata.employeesare arrays) before callingsetInvoices/setEmployees.totalrendering (e.g., ensuretypeof total === 'number'before callingtoFixed) so malformed data does not throw.frontend/package-lock.jsonchanges — regenerate from a clean install if only Tailwind + TanStack were intended to avoid massive transitive changes.Summary of Changes
backend:
backend/internal/server/server.go: Added default orderingORDER BY i.Date ASC, i.id ASCto invoices query.frontend:
frontend/package.json/frontend/package-lock.json.frontend/src/index.css(currently an@importthat must be replaced with Tailwind directives).frontend/vite.config.ts: Added@tailwindcss/viteplugin.frontend/src/App.tsx: Routes now point to the newInvoicesPage.frontend/src/components/InvoicesPage.tsx: New invoices page with date filters, employee selector, debounced fetch, and TanStack table (needs network and shape hardening).frontend/src/App.css, some svg assets).specs/000-proof-of-concept.mdupdated with frontend progress.Overall Feedback
Negative: There are a few blocking issues that will likely break builds or produce runtime errors for users:
@import "tailwindcss"and no CommonJSpostcss.config, Vite/PostCSS may not process Tailwind and the app will look unstyled or fail to build.toFixedon undefined). These must be guarded.Positive: The new frontend is well structured and shows strong UX thinking — good default previous-month date logic, debounced fetching to reduce load, clear form layout, and pragmatic use of TanStack Table for sorting/display. Backend change to add deterministic ordering on invoices is a sensible safety improvement. Nice work! 🎉
@Pertempto — ping me after you push the PostCSS config and the fetch hardening and I’ll re-review the PR quickly and help with any follow-ups.
frontend/src/index.css— please replace the single@import "tailwindcss";with the three Tailwind directives and ensure PostCSS is configured. Minimal changes I expect:Replace file contents with:
Add a PostCSS config using CommonJS (name it
postcss.config.cjsorpostcss.config.jsbut export with CommonJS). Example minimal file (postcss.config.cjs):Reason: Vite/PostCSS expect CommonJS for
postcss.config.jsunless the package.json hastype: "module". Right now I can't find a PostCSS config in the change — builds will break or Tailwind won't be applied. Please add the config (or rename to.cjs) and updateindex.cssas above.