feat(core)!: introduce runtime extension registry and flat module conventions
BREAKING CHANGE: sup config now derives entries from package.json#exports and a server/client glob instead of manual lists; module structure follows flat + barrel convention with .server.js/.client.js runtime suffixes
This commit is contained in:
@@ -1,33 +1,20 @@
|
||||
'use client';
|
||||
|
||||
import { getClientWidgets } from '../../dashboard/clientRegistry.js';
|
||||
import '../../dashboard/widgets/index.client.js';
|
||||
import '../../../dashboard.client.js';
|
||||
|
||||
// Évalué après tous les imports : les auto-registrations sont complètes
|
||||
const sortedWidgets = getClientWidgets();
|
||||
import { getWidgets } from '../registry.js';
|
||||
|
||||
export default function DashboardPage({ stats }) {
|
||||
const loading = stats === null || stats === undefined;
|
||||
const widgets = getWidgets();
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4 sm:gap-6 lg:gap-8">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<h1 className="text-lg sm:text-xl font-semibold text-neutral-900 dark:text-white">
|
||||
Tableau de bord
|
||||
</h1>
|
||||
<p className="mt-1 text-[13px] text-neutral-500 dark:text-neutral-400">Vue d'ensemble de votre application</p>
|
||||
</div>
|
||||
<div>
|
||||
<h1 className="text-lg sm:text-xl font-semibold text-neutral-900 dark:text-white">Tableau de bord</h1>
|
||||
<p className="mt-1 text-[13px] text-neutral-500 dark:text-neutral-400">Vue d'ensemble de votre application</p>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-4 sm:gap-6">
|
||||
{sortedWidgets.map(({ id, Component }) => (
|
||||
<Component
|
||||
key={id}
|
||||
data={loading ? null : (stats[id] ?? null)}
|
||||
loading={loading}
|
||||
/>
|
||||
{widgets.map(({ id, Component }) => (
|
||||
<Component key={id} data={loading ? null : (stats[id] ?? null)} loading={loading} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
'use client';
|
||||
|
||||
import { registerPage } from '../registry.js';
|
||||
import DashboardPage from './DashboardPage.client.js';
|
||||
import UsersPage from './UsersPage.client.js';
|
||||
import UserEditPage from './UserEditPage.client.js';
|
||||
import RolesPage from './RolesPage.client.js';
|
||||
import RoleEditPage from './RoleEditPage.client.js';
|
||||
import ProfilePage from './ProfilePage.client.js';
|
||||
|
||||
// Pages core — le slug correspond au premier segment après /admin/. Les
|
||||
// routes paramétrées (users/edit/:id, roles/edit/:id, roles/new) sont
|
||||
// résolues dans AdminPage.client.js via le slug "namespace:form".
|
||||
registerPage({ slug: 'dashboard', Component: DashboardPage, title: 'Tableau de bord' });
|
||||
registerPage({ slug: 'users', Component: UsersPage, title: 'Utilisateurs' });
|
||||
registerPage({ slug: 'roles', Component: RolesPage, title: 'Rôles' });
|
||||
registerPage({ slug: 'profile', Component: ProfilePage, title: 'Profil' });
|
||||
registerPage({ slug: 'users:edit', Component: UserEditPage, title: 'Modifier utilisateur' });
|
||||
registerPage({ slug: 'roles:edit', Component: RoleEditPage, title: 'Modifier rôle' });
|
||||
Reference in New Issue
Block a user