Component Architecture
Happy Habitat follows Angular’s component-based architecture with a clear separation between shared components, feature-specific components, and layout components.Technology Stack
The frontend is built with:- Framework: Angular 19.2.0
- Language: TypeScript 5.7.2
- Styling: Tailwind CSS 4.1.13 + DaisyUI 5.1.7
- Charts: Chart.js 4.5.0, Lightweight Charts 5.0.8
- State Management: RxJS 7.8.0 with Angular Signals
- Icons: Font Awesome
Directory Structure
Component Organization
Shared Components
Shared components are reusable across the entire application. They are located insrc/app/shared/ and include:
- UI Components: Generic, highly reusable components like lists, forms, notifications
- Navigation Components: Header, footer, menus, breadcrumbs
- Data Display: Charts, tables, pagination
- Form Controls: File upload, date pickers, filters
hh- prefix for their selectors (e.g., hh-header, hh-generic-list).
Feature Components
Feature components are specific to particular modules or features:- Located in
src/app/components/ - Organized by domain (amenidades, comunicados, documentos, etc.)
- Typically include: list, form, detail, and edit components
- Follow a consistent naming pattern:
{feature}-list,{feature}-form,{feature}-detail
Layout Components
Layout components define the overall page structure for different user roles:- Located in
src/app/layouts/ - Role-based: resident, admincompany, sysadmin, vigilancia, amenidades
- Compose shared components (header, menu, footer) with
<router-outlet> - Define the navigation structure for each role
Angular Features Used
Signals (Angular 19)
The application extensively uses Angular Signals for reactive state management:Standalone Components
All components are standalone (no NgModules):Input/Output Signals
Modern Angular input/output API:Control Flow Syntax
New Angular control flow in templates:Styling Architecture
Tailwind CSS + DaisyUI
The application uses utility-first CSS with Tailwind and DaisyUI component classes:Theme System
DaisyUI provides multiple themes:- Lemonade (default)
- Dark
- Winter
- Forest
- Autumn
- Lofi
NavBarComponent and stored in localStorage.
Component Communication
Parent-Child (Input/Output)
Services (Dependency Injection)
RxJS Observables
Best Practices
- Use Signals: Prefer signals over traditional observables for component state
- Standalone Components: All new components should be standalone
- Type Safety: Use TypeScript interfaces for all data structures
- Responsive Design: Use Tailwind’s responsive classes (sm:, md:, lg:)
- Accessibility: Include proper ARIA labels and keyboard navigation
- DaisyUI Components: Leverage DaisyUI’s pre-built components for consistency
- Component Prefix: Use
hh-prefix for all custom component selectors - Template Syntax: Use new control flow syntax (@if, @for) instead of *ngIf, *ngFor
Next Steps
- Shared Components - Detailed documentation of reusable components
- Layout Components - Role-based layout structures
- Services - Application services and state management