Add main menu page with role-based modules (#7)
- `/` is now the main menu; orders/receipts page moved to `/receipts` - Module registry (features/menu/modules.ts) drives both the menu tiles and route guards (ModuleRoute); admin sees every module - Menu: module search with Ctrl+K, profile with logout, responsive grid, palette matching the login page - «← Головне меню» link on receipts and cash registers pages; «Каси» moved from the receipts toolbar into the menu Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { useState } from 'react'
|
||||
import type { FormEvent } from 'react'
|
||||
import { Link, Navigate } from 'react-router-dom'
|
||||
import { Link } from 'react-router-dom'
|
||||
|
||||
import {
|
||||
checkCashRegister,
|
||||
@@ -55,8 +55,6 @@ export function CashRegistersPage() {
|
||||
const [busy, setBusy] = useState(false)
|
||||
const [message, setMessage] = useState<{ tone: 'ok' | 'error'; text: string } | null>(null)
|
||||
|
||||
if (user && user.role !== 'admin') return <Navigate to="/" replace />
|
||||
|
||||
async function run(action: () => Promise<unknown>, okText: string) {
|
||||
setBusy(true)
|
||||
try {
|
||||
@@ -123,10 +121,12 @@ export function CashRegistersPage() {
|
||||
return (
|
||||
<div className="dashboard-shell">
|
||||
<header className="dashboard-topbar">
|
||||
<span className="dashboard-brand">Assistant System</span>
|
||||
<Link to="/" className="orders-link-btn">
|
||||
← До замовлень
|
||||
</Link>
|
||||
<div className="dashboard-topbar-start">
|
||||
<Link to="/" className="orders-link-btn">
|
||||
← Головне меню
|
||||
</Link>
|
||||
<span className="dashboard-brand">Assistant System</span>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main className="orders-body">
|
||||
|
||||
Reference in New Issue
Block a user