Basic Architecture of Sport Web

This commit is contained in:
Nông Đức Huy
2026-08-11 13:37:25 +07:00
commit 8032fff6ac
262 changed files with 20348 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
import { PERMISSIONS, type Permission } from '@sport/types';
/**
* The sidebar is derived from the same permission catalog the API guards use.
*
* A user who cannot read orders never sees an Orders link, so the UI has no
* dead ends. This is presentation only — hiding a link is not authorization.
* The API re-checks every request, because a hidden link is one devtools
* inspection away from being visible.
*/
export interface NavItem {
href: string;
label: string;
permission: Permission;
}
export interface NavSection {
title: string;
items: NavItem[];
}
export const NAVIGATION: NavSection[] = [
{
title: 'Catalog',
items: [
{ href: '/products', label: 'Products', permission: PERMISSIONS.PRODUCT_READ },
{ href: '/categories', label: 'Categories', permission: PERMISSIONS.CATEGORY_READ },
{ href: '/collections', label: 'Collections', permission: PERMISSIONS.COLLECTION_READ },
{ href: '/brands', label: 'Brands', permission: PERMISSIONS.BRAND_READ },
{ href: '/inventory', label: 'Inventory', permission: PERMISSIONS.INVENTORY_READ },
{ href: '/media', label: 'Media', permission: PERMISSIONS.MEDIA_READ },
],
},
{
title: 'Sales',
items: [
{ href: '/orders', label: 'Orders', permission: PERMISSIONS.ORDER_READ },
{ href: '/customers', label: 'Customers', permission: PERMISSIONS.CUSTOMER_READ },
],
},
{
title: 'Marketing',
items: [
{ href: '/promotions', label: 'Promotions', permission: PERMISSIONS.PROMOTION_MANAGE },
{ href: '/coupons', label: 'Coupons', permission: PERMISSIONS.COUPON_MANAGE },
{ href: '/reviews', label: 'Reviews', permission: PERMISSIONS.REVIEW_MODERATE },
{ href: '/cms', label: 'Content', permission: PERMISSIONS.CMS_READ },
],
},
{
title: 'Settings',
items: [
{ href: '/settings/users', label: 'Users', permission: PERMISSIONS.USER_READ },
{ href: '/settings/roles', label: 'Roles', permission: PERMISSIONS.ROLE_READ },
],
},
];