How basil23l034ec-ux/smart-trolley-admin-dashboard works
1. This repository is a Next.js App Router frontend for a “smart trolley” / customer UX admin dashboard. The codebase is UI-centric: the visible architecture is organized around routes, shared layouts, reusable components, and local mock data rather than a backend API layer.
2. The route surface is small and explicit. There is a root page, a login page, and a dashboard area with dedicated subpages for carts, inventory, payments, products, reports, settings, and trolleys. Each of those routes is a separate page component under src/app/dashboard/*.
3. The main structural boundary is the dashboard shell. src/app/dashboard/layout.tsx likely wraps all dashboard pages with persistent navigation and chrome, while src/components/dashboard/header.tsx, sidebar.tsx, and chatbot.tsx provide the shared top-level admin experience across pages.
4. The application uses a composition-heavy component model built on a large reusable UI primitive set in src/components/ui. The presence of components.json and many atomic controls suggests a shadcn/ui-style system: buttons, dialogs, tables, sheets, tabs, forms, selects, tooltips, etc. Pages assemble these primitives into screen-specific views.
5. Data flow appears mostly local and presentation-driven. src/lib/mock-data.ts is the clearest data source in the tree, implying the dashboard screens are populated from in-repo mock datasets rather than live services. src/lib/utils.ts provides shared helper logic used across components.
6. Responsive behavior is handled through mobile hooks in src/hooks/use-mobile.ts and src/lib/hooks/use-mobile.tsx. These hooks likely drive layout decisions such as collapsing the sidebar, switching between sheet/drawer interactions, and adapting dashboard navigation for smaller screens.
7. Error handling is explicit at the app boundary. src/app/global-error.tsx provides a Next.js-wide fallback for uncaught route/runtime failures, and src/components/ErrorReporter.tsx suggests a separate error capture/reporting concern embedded in the UI.
8. There is a distinct “visual edits” subsystem under src/visual-edits. VisualEditsMessenger.tsx and component-tagger-loader.js indicate integration with an external editing or annotation workflow, probably for tagging components and exchanging messages with an editor/runtime overlay.
9. Styling and runtime setup are standard Next.js front-end infrastructure. src/app/globals.css, postcss.config.mjs, and next.config.ts define the global styling/build behavior, while the project is TypeScript-based (tsconfig.json) and linted via ESLint (eslint.config.mjs).
10. The repo has no visible API routes, database layer, or server-service modules in the tree, so the architecture is largely client-rendered/presentational. The only clearly stated deployment target in the README is Vercel, which reinforces that this is a deployable Next.js frontend rather than a full-stack system.
Main entry points: dashboard/layout.tsx Dashboard layout · mock-data.ts Mock data · app/layout.tsx App layout · ui UI primitives
Components 23
Routes
Next.js App Router entrypoints and page surfaces.
- Root page · Landing entrypoint for the app.
src/app/page.tsx - Login · Authentication entry screen.
src/app/login/page.tsx - Dashboard home · Top-level dashboard landing page.
src/app/dashboard/page.tsx - Carts · Cart management screen.
src/app/dashboard/carts/page.tsx - Inventory · Inventory management screen.
src/app/dashboard/inventory/page.tsx - Payments · Payment operations screen.
src/app/dashboard/payments/page.tsx - Products · Product catalog screen.
src/app/dashboard/products/page.tsx - Reports · Analytics and reporting screen.
src/app/dashboard/reports/page.tsx - Settings · Configuration and preferences screen.
src/app/dashboard/settings/page.tsx - Trolleys · Trolley management screen.
src/app/dashboard/trolleys/page.tsx
Dashboard shell
Persistent chrome and dashboard-specific UI composition.
- Dashboard layout · Persistent dashboard chrome around all dashboard routes.
src/app/dashboard/layout.tsx - Header · Top navigation and status area.
src/components/dashboard/header.tsx - Sidebar · Primary dashboard navigation.
src/components/dashboard/sidebar.tsx - Chatbot · Embedded dashboard assistant panel.
src/components/dashboard/chatbot.tsx
Shared UI
Reusable primitives and app-wide component building blocks.
- UI primitives · Reusable shadcn-style controls and composite widgets.
src/components/ui
Runtime & data
Local data, hooks, styling, and app infrastructure.
- App layout · Global HTML/app shell for the entire site.
src/app/layout.tsx - Error reporter · Client-side error capture/reporting component.
src/components/ErrorReporter.tsx - Mock data · In-repo datasets feeding the dashboard screens.
src/lib/mock-data.ts - Mobile hooks · Viewport-aware behavior for responsive navigation and layouts.
src/lib/hooks/use-mobile.tsx - Global styles · Application-wide CSS baseline and theming.
src/app/globals.css - Next config · Next.js build/runtime configuration.
next.config.ts
Visual edits
Overlay and messaging integration for component editing.
- Visual edits · Component tagging and editor messaging integration.
src/visual-edits/VisualEditsMessenger.tsx - Tagger loader · Loader for component tagging integration.
src/visual-edits/component-tagger-loader.js
Connections 34
- App layout → Root page: wraps · Global app shell contains the root page.
- App layout → Login: wraps · Global app shell contains login.
- App layout → Dashboard layout: hosts · Dashboard route tree is nested under the app shell.
- Dashboard layout → Header: includes · Persistent header in dashboard pages.
- Dashboard layout → Sidebar: includes · Persistent sidebar navigation in dashboard pages.
- Dashboard layout → Chatbot: includes · Shared assistant widget in the dashboard shell.
- Dashboard layout → Dashboard home: wraps · Dashboard layout surrounds the main dashboard landing page.
- Dashboard layout → Carts: wraps · Dashboard layout surrounds the carts page.
- Dashboard layout → Inventory: wraps · Dashboard layout surrounds the inventory page.
- Dashboard layout → Payments: wraps · Dashboard layout surrounds the payments page.
- Dashboard layout → Products: wraps · Dashboard layout surrounds the products page.
- Dashboard layout → Reports: wraps · Dashboard layout surrounds the reports page.
- Dashboard layout → Settings: wraps · Dashboard layout surrounds the settings page.
- Dashboard layout → Trolleys: wraps · Dashboard layout surrounds the trolleys page.
- Dashboard home → Mock data: reads · Dashboard content is driven by local mock datasets.
- Carts → Mock data: reads · Carts screen uses local data.
- Inventory → Mock data: reads · Inventory screen uses local data.
- Payments → Mock data: reads · Payments screen uses local data.
- Products → Mock data: reads · Products screen uses local data.
- Reports → Mock data: reads · Reports screen uses local data.
- Settings → Mock data: reads · Settings screen may use shared mock-backed state.
- Trolleys → Mock data: reads · Trolleys screen uses local data.
- Header → UI primitives: composes · Header is assembled from shared UI controls.
- Sidebar → UI primitives: composes · Sidebar uses shared primitives for navigation and layout.
- Chatbot → UI primitives: composes · Assistant UI is built from reusable controls.
- Dashboard home → UI primitives: composes · Dashboard pages are built from the shared component kit.
- Root page → UI primitives: composes · Root-facing UI uses shared controls.
- Login → UI primitives: composes · Login screen uses shared controls.
- Mobile hooks → Sidebar: adapts · Responsive hooks likely drive sidebar collapse and sheet behavior.
- Mobile hooks → Dashboard layout: adapts · Layout behavior changes on small screens.
- Error reporter → App layout: integrates · Error reporting is embedded at the app boundary.
- Visual edits → Tagger loader: bridges · Editor overlay and tagging loader work together.
- Global styles → App layout: styles · Global stylesheet is loaded by the app shell.
- Next config → App layout: configures · Next.js config governs the app runtime/build.