// DEPLOY_CONFIG: {"triggers": [{"name": "menu_item_sold_out_notify_staff", "on": "collection.update", "collection": "menu_items", "actions": [{"type": "email", "to": "{{staff_notification_email}}", "subject": "Menu item sold out: {{name}}", "body": "Menu item '{{name}}' has been marked unavailable/sold out and may need attention."}], "conditions": [{"field": "available", "operator": "changed_to", "value": false}]}]} import { useMemo, useState } from 'react'; import { useAuth } from '@deplixo/sdk'; import { MenuCreator } from './components/MenuCreator.jsx'; import { CustomerMenu } from './components/CustomerMenu.jsx'; function App() { const { user, loading, login, logout } = useAuth(); const [view, setView] = useState('creator'); const publicMenuUrl = useMemo(() => { if (typeof window === 'undefined') return ''; const { origin, pathname } = window.location; return `${origin}${pathname}#menu=customer`; }, []); const qrCodeUrl = useMemo(() => { if (!publicMenuUrl) return ''; return `https://api.qrserver.com/v1/create-qr-code/?size=280x280&margin=12&data=${encodeURIComponent(publicMenuUrl)}`; }, [publicMenuUrl]); const handlePrintTableQr = () => { window.print(); }; if (loading) { return (
); } if (!user) { return (
🍽️

Welcome to MenuCraft

Sign in with Google to manage your restaurant menu, add categories, and publish a beautiful customer preview.

Restaurant owner access only

); } const isCustomerView = typeof window !== 'undefined' && window.location.hash === '#menu=customer'; return (
🍽️

MenuCraft

{user.avatar ? ( {user.name} ) : ( {user.name?.slice(0, 1)?.toUpperCase()} )}
Signed in as {user.name}
{view === 'creator' ? : }

Table QR Code

{qrCodeUrl ? ( QR code linking to the public menu ) : (
QR code unavailable
)}

Share this scannable code with guests to open the public menu view on their phone.

Tip: use Print to generate a clean, table-friendly QR sheet for placing at each table.

MenuCraft

Scan to view our menu

{publicMenuUrl}

{qrCodeUrl && QR code linking to the public menu}
); } export default App; if (typeof ReactDOM !== 'undefined' && ReactDOM.createRoot) { ReactDOM.createRoot(document.getElementById('root')).render(); }