feat(manager): Media page, photo field for products and categories (platform-v2 step 5.2)

- Management → Media (src/pages/media/): every picture and video, search,
  pictures / videos, batch upload (many files or drop on the page) with a
  result per file, details (preview, display name, kind, resolution, length,
  file size, uploaded file, when / who, the sizes made, what uses it, delete
  off while used).
- MediaField: upload on the spot (into the library and set at once), pick
  from the library (MediaPicker, which can also upload), remove; after an
  upload on the spot "Name it after the product / category" renames it in
  Latin letters. Used by the product editor and the category dialog.
- nav: `anyPerm` (any of the keys that manage pictures); the route guard uses
  the same rule. Product rows have test ids.
- @xenia/i18n: latin() (Greek to Latin, the way venues write it) + tests.
- tests: manager media.test.mjs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-17 15:57:50 +02:00
co-authored by Claude Opus 5.5
parent 5ad4c4ef55
commit e09056a7a4
20 changed files with 810 additions and 57 deletions
+6 -1
View File
@@ -10,16 +10,19 @@
// permission need core.dashboard.access (what their APIs check, require_manager).
// Finer keys (pricing.manage, expenses.manage…) replace these when phase 6
// converts those routers.
// anyPerm instead of perm: any one of these keys is enough (the media library)
// label a key in the i18n `manager` namespace
import {
LayoutDashboard, LayoutGrid, ShoppingBag,
BookUser, Users, Receipt, CreditCard,
Package, TableProperties, UserCog, CalendarDays, Trash2, Boxes,
BarChart2, TrendingUp, Users2, ShoppingCart, Tag, Activity, Printer, ConciergeBell, FileText,
AppWindow, Settings, CookingPot, Truck, StickyNote, Percent, Plug, BadgeCheck, MonitorSmartphone, LogIn, ShieldCheck, QrCode,
AppWindow, Settings, CookingPot, Truck, StickyNote, Percent, Plug, BadgeCheck, MonitorSmartphone, LogIn, ShieldCheck, QrCode, Images,
} from 'lucide-react'
const DASH = 'core.dashboard.access'
// The media library: whoever manages something that shows pictures (routers/media.py MANAGE)
const MEDIA = ['catalog.menu.manage', 'customer_display.manage', 'signage.manage', 'menu_tablet.manage']
export const NAV = [
{
@@ -58,6 +61,7 @@ export const NAV = [
group: 'management', icon: Package, label: 'nav.management',
children: [
{ to: '/management/products', icon: Package, label: 'nav.products', module: 'catalog', perm: 'catalog.menu.manage' },
{ to: '/management/media', icon: Images, label: 'nav.media', module: 'core', anyPerm: MEDIA },
{ to: '/management/tables', icon: TableProperties, label: 'nav.tablesConfig', module: 'catalog', perm: 'catalog.tables.manage' },
{ to: '/management/staff', icon: UserCog, label: 'nav.staff', module: 'core', perm: 'core.staff.manage' },
{ to: '/management/sessions', icon: LogIn, label: 'nav.sessions', module: 'core', perm: 'core.staff.manage' },
@@ -129,5 +133,6 @@ export function pageFor(pathname) {
export function canSee(page, { modules, permissions }) {
if (!page) return true
if (page.module && !modules.has(page.module)) return false
if (page.anyPerm) return page.anyPerm.some(k => permissions.has(k))
return !page.perm || permissions.has(page.perm)
}