Files
Ghost_Kitchen/src/routes/admin/menu/new.tsx
T
lukasandClaude Sonnet 5 8481032e30 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>
2026-09-17 11:50:17 +02:00

39 lines
1.0 KiB
TypeScript

import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { MenuItemForm } from '#/components/admin/MenuItemForm.tsx'
import { withAdminGuard } from '#/lib/admin-guard.ts'
import {
createMenuItem,
getAllergenOptions,
getMachineTagOptions,
} from '#/server/menu-admin.ts'
const NewMenuItemRoute = () => {
const { machineTags, allergenOptions } = Route.useLoaderData()
const navigate = useNavigate()
return (
<section>
<h1>Add menu item</h1>
<MenuItemForm
machineTags={machineTags}
allergenOptions={allergenOptions}
submitLabel="Create item"
onSubmit={async (input) => {
await createMenuItem({ data: input })
await navigate({ to: '/admin/menu', viewTransition: false })
}}
/>
</section>
)
}
export const Route = createFileRoute('/admin/menu/new')({
loader: () =>
withAdminGuard(async () => ({
machineTags: await getMachineTagOptions(),
allergenOptions: await getAllergenOptions(),
})),
component: NewMenuItemRoute,
})