Add menu item allergens, drop nav Help link, animate customizer price
- Menu items can now list allergens (shared catalog + join table), shown on the menu grid and item detail pages when applicable, and editable from the admin menu item form. - Removed the top-nav "Help" link now that the footer links to it. - The item customization page's price now uses the sliding AnimatedNumber, matching the basket line price. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,10 +2,14 @@ import { createFileRoute, useNavigate } from '@tanstack/react-router'
|
||||
|
||||
import { MenuItemForm } from '#/components/admin/MenuItemForm.tsx'
|
||||
import { withAdminGuard } from '#/lib/admin-guard.ts'
|
||||
import { createMenuItem, getMachineTagOptions } from '#/server/menu-admin.ts'
|
||||
import {
|
||||
createMenuItem,
|
||||
getAllergenOptions,
|
||||
getMachineTagOptions,
|
||||
} from '#/server/menu-admin.ts'
|
||||
|
||||
const NewMenuItemRoute = () => {
|
||||
const machineTags = Route.useLoaderData()
|
||||
const { machineTags, allergenOptions } = Route.useLoaderData()
|
||||
const navigate = useNavigate()
|
||||
|
||||
return (
|
||||
@@ -13,6 +17,7 @@ const NewMenuItemRoute = () => {
|
||||
<h1>Add menu item</h1>
|
||||
<MenuItemForm
|
||||
machineTags={machineTags}
|
||||
allergenOptions={allergenOptions}
|
||||
submitLabel="Create item"
|
||||
onSubmit={async (input) => {
|
||||
await createMenuItem({ data: input })
|
||||
@@ -24,6 +29,10 @@ const NewMenuItemRoute = () => {
|
||||
}
|
||||
|
||||
export const Route = createFileRoute('/admin/menu/new')({
|
||||
loader: () => withAdminGuard(() => getMachineTagOptions()),
|
||||
loader: () =>
|
||||
withAdminGuard(async () => ({
|
||||
machineTags: await getMachineTagOptions(),
|
||||
allergenOptions: await getAllergenOptions(),
|
||||
})),
|
||||
component: NewMenuItemRoute,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user