How boycany/draggable-dashboard works
Project type and purpose
• This is a single-page web application (SPA) written in Angular (v18.2.0) that provides a customizable dashboard interface.
• The README confirms it’s purely a front-end project generated by the Angular CLI, meant to run in the browser at localhost:4200, with no local backend code included.
File structure
Top-level files and folders:
• angular.json, tsconfig*.json, package.json – build and configuration
• src/index.html, src/main.ts – application entry point
• src/styles.scss – global styles
• src/app/app.module.ts (implicitly) – root module
• src/app/app.routes.ts – routing definitions
• src/app/app.config.ts – application-wide configuration
• src/app/components/widget & widget-options – reusable presentational components
• src/app/pages/dashboard – smart/container component for the dashboard page
• src/app/pages/dashboard/widgets – five distinct “widget” feature components (analytics, revenue, subscribers, views, watch-time)
• src/app/services/dashboard.service.ts – service responsible for fetching dashboard data
• src/app/models/dashboard.ts – TypeScript interfaces/models for dashboard data
README
• Confirms standard Angular development workflow (serve, build, test).
a. Main components to include
• Browser/Client (User’s web browser)
• Angular AppModule (root)
• Router (app.routes.ts) & Router-Outlet
• Container (DashboardComponent)
• Presentational components (WidgetsPanelComponent, WidgetComponent, WidgetOptionsComponent, individual widget components)
• DashboardService (data access layer)
• Dashboard models (interfaces)
• External REST API or data source (e.g., https://api.example.com/dashboard)
b. Relationships and interactions
• The browser loads index.html → bootstraps AppModule → renders AppComponent
• Router directs to DashboardComponent via configured routes
• DashboardComponent injects DashboardService
• DashboardService issues HTTP calls to the external API (using HttpClient)
• DashboardService returns typed model objects (defined in dashboard.ts)
• DashboardComponent distributes data to child components (WidgetsPanel → Widget → specific widget types)
• WidgetOptionsComponent emits events (e.g., sorting or filtering) back to its parent widget
c. Architectural patterns and design principles
• Component-Based Architecture: UI is broken into container (smart) vs. presentational (dumb) components
• Dependency Injection: Services injected into components for data access
• Single Source of Truth: DashboardService holds the data model and state
• Routing Module: Separation of navigation logic (app.routes.ts) from UI components
• Module Encapsulation: AppModule (and potentially feature modules) group related components, services, and routes
d. Relevant technologies, frameworks, libraries
• Angular (CLI, Router, HttpClient, NgModule, Component)
• TypeScript interfaces for models (src/app/models)
• SCSS for component styles
• Karma/Jasmine for unit tests
2. Inside the AppModule boundary, place Router→Router-Outlet → link to DashboardComponent
5. WidgetComponent using a specific child (analytics, revenue, etc.)