CityShob is an interactive platform designed to facilitate and streamline geo-object searches, offering robust UI components, lazy-loaded categories, and a streamlined, user-friendly experience. Built with Angular 18, RxJS, and Tailwind, CityShob leverages an Angular signal-based state management approach to deliver an efficient, reactive, and highly responsive interface.
Follow these instructions to clone, install, build, and run CityShob locally:
- Clone the repository:
git clone https://github.com/HackPoint/cityshob.git
- Navigate to the application directory and install dependencies:
cd <application-location> npm install
- Build the application:
nx run widget:build
- Run Docker Compose to start services:
docker-compose up --build
- Seed the database (if required):
npm run seed
- Seed the database (if required):
nx run widget-ui:serve
- Access the application: Open http://localhost:4200 in your browser.
- Tailwind CSS: Enables rapid, utility-first CSS styling. Tailwind allows for efficient component styling without needing custom CSS, enabling developers to focus on building responsive and consistent UI elements.
- RxJS: Used extensively for state management and reactive programming within Angular components. By leveraging RxJS, CityShob provides a seamless, responsive UI experience.
- Docker: Used to containerize the application, ensuring a consistent environment for development, testing, and deployment. Docker enables simplified setup with
docker-composefor a full-service local environment.
To implement multilingual support, we would leverage Angular's i18n library on the client side. For managing the translations of geo-object names and types, here’s the recommended approach:
- Define Translation Keys: Define translation keys for each category, type, and text item, allowing Angular’s
i18nservice to handle text translations efficiently across components. - Store Translations on Server: Store translations in JSON or a database, accessible via an API endpoint. This enables language updates without needing client changes.
- Dynamic Loading: Allow the application to request translations based on the user’s language preference. With Angular’s
LOCALE_IDandtranslateService, the UI would load the relevant language assets dynamically. - User Preferences: Store the user’s language preference in local storage or as part of the user profile on the server. This allows persistence of language settings across sessions.
To handle server-sent data in different formats (e.g., PascalCase while using camelCase internally), we would use a mapping solution to reformat the data upon retrieval. For instance, if the server returns SubCategories and Children, we would convert these to subCategories and children using an interceptor or a utility function.
function formatKeys(obj: any): any {
if (Array.isArray(obj)) {
return obj.map((item) => formatKeys(item));
} else if (obj !== null && typeof obj === 'object') {
return Object.keys(obj).reduce((acc, key) => {
const camelCaseKey = key.charAt(0).toLowerCase() + key.slice(1);
acc[camelCaseKey] = formatKeys(obj[key]);
return acc;
}, {} as any);
}
return obj;
}TBD
- Page Load: The user opens the page.
- Initial Data Fetch: Default categories are loaded and displayed.
- Dropdown Selection: The user selects a category from the dropdown.
- Dropdown Update: Updates the UI with the chosen category and triggers data filtering.
- Search Interaction: The user enters search terms.
- Filtered Fetch: Based on search terms, a filtered data request is sent.
- Results Displayed: Matching categories and subcategories are shown.
- Lazy Loading in Accordion: When expanding a category, lazy-loaded data retrieval occurs only for that section.
This project utilizes Angular’s latest features, including signals and reactive state management, for optimal performance. Tailwind CSS provides the styling foundation, ensuring a visually consistent and responsive UI. Docker streamlines setup and ensures compatibility across development and production environments.
