feat: add sidebar and product categories #89
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/sidebar-and-product-categories"
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?
PR Review: feat: add sidebar and product categories
This is a substantial PR (69 files, +1772/-250 lines) introducing two major features: a sidebar layout and product categories. Here are my findings:
🔴 Bug Found
PageWithSidebar.svelte—bind:opencallback checks wrong conditionThe condition
!isMdWidthchecks theMediaQueryobject itself, which is always truthy. This should be!isMdWidth.current. As a result, when the Dialog opens/closes,sidebarOpenwill never update because the condition is alwaysfalse. This affects mobile sidebar toggle behavior.⚠️ Observations
Breaking database migration: The migration adds
categoryIdas aNOT NULLcolumn with a foreign key toproductCategory. Existing products in the database would cause this migration to fail unless a default category exists or products are pre-populated. Consider whether a migration script to assign existing products to a default category is needed.Placeholder UI in list components: The popovers in
CategoriesList.svelte,ProductsList.svelte,ProductOptionsList.svelte, andPrintersList.sveltehave hardcoded placeholder text ("Modify order", "Edit", "Delete") that isn't wired up. These should either be implemented or removed before merge.Dead admin link: The sidebar references
/admin/receipts("Comande e scontrini") but this route doesn't exist yet.Commented-out code: In
[productId]/+page.svelte, theAddProductOptionDialogis commented out with<!-- <AddProductOptionDialog>... -->. Consider removing this dead code or implementing the feature.signOutFormfire-and-forget: The sign-out form is not awaited (<Form form={signOutForm}>instead of<Form form={$derived(signOutForm)}>). This works for fire-and-forget but may cause issues if the Form component expects an awaited form.✅ Positive Changes
User/Product/PrintertoUserClient/ProductClient/PrinterClient— much clearer distinction between server and client entities.Dialog.svelteto the root of#components/and using thedialog-centeredutility class everywhere is a nice cleanup.fromIdbatch queries now properly return 404 errors for missing items instead ofnull.svelte-checkpasses with 0 errors and 0 warnings.📝 Recommendations
isMdWidthbug before merge — this is a clear regression.categoryIdnullable with a default)./admin/receiptslink or create the route.AddProductOptionDialogcode.@ -0,0 +115,4 @@<main class="h-screen w-full"><header class="flex border-b border-slate-300 p-2 gap-4 items-center"><Dialogbind:open={() => sidebarOpen && !isMdWidth.current, (v) => {Bug:
!isMdWidthshould be!isMdWidth.current. SinceMediaQueryobjects are always truthy,sidebarOpenwill never be updated when the Dialog opens/closes.