# ADMIN_IMPLEMENTATION.md

Summarizes the implementation of the admin panel and related backend/frontend changes for the NocoDB Map Viewer.

# Instuctions.md

Project development instructions and rules for contributors to the canvassing map application.

# README.md

Main documentation for the NocoDB Map Viewer project, including features, setup, and usage.

# build-nocodb.md

Documents the development and requirements of the NocoDB automation script for table setup.

# build-nocodb.sh

Bash script to automate creation of required NocoDB tables and default data for the app.

# docker-compose.yml

Docker Compose file to orchestrate the map-viewer app container and its environment.

# app/Dockerfile

Dockerfile for building the Node.js application image for deployment.

# app/config/index.js

Handles environment config and NocoDB URL parsing for the backend.

# app/controllers/authController.js

Controller for user authentication (login, logout, session check).

# app/controllers/locationsController.js

Controller for CRUD operations on map locations.

# app/controllers/passwordRecoveryController.js

Controller for handling password recovery requests via email. Validates email format, looks up users in the database, and sends password recovery emails while maintaining security by not revealing whether accounts exist.

# app/controllers/settingsController.js

Controller for application settings, start location, and walk sheet config.

# app/controllers/shiftsController.js

# app/controllers/shiftsController.js

Controller for handling shift management, signup/cancellation, and admin operations on volunteer shifts.

# app/controllers/dataConvertController.js

Controller for handling CSV upload and batch geocoding of addresses. Parses CSV files, validates address data, uses the geocoding service to get coordinates, and provides real-time progress updates via Server-Sent Events (SSE).

# app/controllers/dashboardController.js

Controller for aggregating and calculating dashboard statistics from locations and users data.

# app/controllers/usersController.js

Controller for user management (list, create, delete users).

# app/middleware/auth.js

Express middleware for authentication and admin access control.

# app/middleware/rateLimiter.js

Express middleware for API rate limiting, with Cloudflare IP support.

# app/package.json

Node.js project manifest, dependencies, and scripts for the backend app.

# app/server.js

Main Express server entry point for the map application backend.

# app/server copy.js

Legacy or backup version of the main server file, possibly for reference or migration.

# app/services/geocoding.js

Service for geocoding and reverse geocoding using external APIs, with caching. Updated to include forwardGeocodeSearch function for returning multiple address search results for the unified search feature.

# app/services/nocodb.js

Service for interacting with the NocoDB API (CRUD, config, etc).

# app/services/qrcode.js

Service for generating QR codes and handling QR-related logic.

# app/services/email.js

Service for sending emails via SMTP, including password recovery emails using nodemailer. Supports multiple SMTP providers and includes connection verification and error handling.

# app/services/emailTemplates.js

Service for loading and rendering email templates with variable substitution. Handles HTML and plain text email generation with caching support and template variable replacement functionality.

# app/templates/email/password-recovery.txt

Plain text email template for password recovery notifications. Contains user-friendly formatting with password display and security warnings.

# app/templates/email/password-recovery.html

HTML email template for password recovery notifications. Features responsive design with styled password display box and security warnings for better user experience.

# app/utils/helpers.js

Utility functions for geographic data, validation, and helpers used across the backend.

# app/utils/logger.js

Winston logger configuration for backend logging.

# app/public/admin.html

Admin panel HTML page for managing start location, walk sheet, shift management, and user management.

# app/public/css/admin.css

CSS styles specific to the admin panel UI.

# app/public/css/modules/apartment-popup.css

Styles for the apartment building popup, ensuring it is responsive and user-friendly.

# app/public/css/modules/base.css

Contains base styles, including CSS variables for theming, resets, and default body styles.

# app/public/css/modules/buttons.css

Defines styles for all button types, states (hover, disabled), and variants (primary, danger, etc.).

# app/public/css/modules/cache-busting.css

Styles for the cache busting update notification that prompts users to refresh the page.

# app/public/css/modules/dashboard.css

Styles for the dashboard panel including cards, charts, and responsive grid layouts.

# app/public/css/modules/doc-search.css

Styles for the documentation search component in the header.

# app/public/css/modules/unified-search.css

Styles for the unified search component that combines documentation and map address search functionality. Includes mode toggle buttons, search input styling, results display, and responsive design for both desktop and mobile.

# app/public/css/modules/forms.css

Styles for form elements, input fields, and the slide-up edit footer.

# app/public/css/modules/layout.css

Defines the main application layout, including the header, app container, and map container.

# app/public/css/modules/leaflet-custom.css

Customizations for the Leaflet.js library, including popups and marker styles.

# app/public/css/modules/map-controls.css

Styles for map controls, such as the crosshairs and move controls.

# app/public/css/modules/mobile-ui.css

Styles for mobile-specific UI elements like the mobile dropdown menu and floating sidebar.

# app/public/css/modules/modal.css

Styles for all modal dialogs used throughout the application.

# app/public/css/modules/notifications.css

Styles for status messages and the global loading overlay.

# app/public/css/modules/print.css

Print-specific styles to ensure the map prints correctly.

# app/public/css/modules/qr-code.css

Styles for the QR code generation modal and related components.

# app/public/css/modules/responsive.css

Contains all media queries for responsive design, adapting the layout for different screen sizes.

# app/public/css/modules/start-location-marker.css

Defines the animated styles for the distinctive start location marker.

# app/public/css/shifts.css

CSS styles for the volunteer shifts page, including grid view, calendar view, and view toggle functionality.

# app/public/css/style.css

Main stylesheet that imports all modular CSS files from the `public/css/modules/` directory. Acts as the central entry point for all application styles, organizing them into logical modules for better maintainability. Referenced in all HTML files to load the complete application styling system.

# app/public/favicon.ico

Favicon for the web application.

# app/public/index.html

Main map viewer HTML page for the canvassing application. Features the unified search system with keyboard shortcut support (Ctrl+K), responsive header with user authentication, mobile-friendly dropdown navigation, and comprehensive map interface. Includes the "Confirm Address" functionality that requires users to confirm the geocoded address before saving location data. Contains all necessary script imports for Leaflet.js, MarkerCluster, and the modular JavaScript application architecture.

# app/public/login.html

Login page HTML for user authentication.

# app/public/shifts.html

Volunteer shifts management and signup page HTML with both grid and calendar view options.

# app/public/user.html

User profile page HTML for displaying user information and account management.

# app/public/css/user.css

CSS styles for the user profile page and user management components in the admin panel.

# app/public/js/admin.js

JavaScript for admin panel functionality (map, start location, walk sheet, shift management, and user management).

# app/public/js/dashboard.js

JavaScript for rendering dashboard charts and statistics using Chart.js in the admin panel.

# app/public/js/user.js

JavaScript for user profile page functionality and user account management.

# app/public/js/auth.js

JavaScript for authentication logic and user session management.

# app/public/js/config.js

Global configuration constants for the frontend app.

# app/public/js/location-manager.js

JavaScript for loading, displaying, and managing map locations on the frontend. Includes address confirmation validation that prevents saving locations until the geocoded address is confirmed by the user.

# app/public/js/main.js

Main entry point for initializing the frontend application. Orchestrates the complete application startup sequence including domain configuration loading, user authentication verification, map initialization, and location loading. Manages the unified search system initialization, auto-refresh functionality, viewport handling for responsive design, and global error handling. Serves as the central coordinator for all application modules and features.

# app/public/js/map-search.js

JavaScript module for handling map address search functionality. Provides search capabilities using the geocoding API, displays search results with temporary markers, and integrates with the location management system.

# app/public/js/search-manager.js

JavaScript module for managing the unified search system that combines documentation and map address search. Handles mode switching, result display, keyboard shortcuts, and integration between docs search and map search functionalities.

# app/public/js/map-manager.js

JavaScript for initializing and managing the Leaflet map instance.

# app/public/js/map.js.backup

Backup or legacy version of the main map JavaScript logic.

# app/public/js/shifts.js

JavaScript for volunteer shift signup, management, and UI logic with both grid and calendar view functionality. Features include view toggling, calendar navigation, shift color-coding, and interactive shift popups. Updated to use shift titles directly from signup records.

# app/public/js/ui-controls.js

JavaScript for UI controls, event handlers, and user interaction logic. Includes address confirmation functionality that manages state for ensuring users confirm geocoded addresses before saving locations.

# app/public/js/utils.js

Utility functions for the frontend (escaping HTML, parsing geolocation, etc).

# app/public/js/data-convert.js

Frontend JavaScript for the Convert Data admin section. Handles file upload UI, drag-and-drop, real-time progress updates, visual representation of geocoding results on a map, and saving successful results to the database.

# app/routes/admin.js

Express router for admin-only endpoints (start location, walk sheet config).

# app/routes/dashboard.js

Express router for dashboard API endpoints, providing stats for the admin dashboard.

# app/routes/auth.js

Express router for authentication endpoints (login, logout, check).

# app/routes/debug.js

Express router for debug endpoints (session info, table structure, etc).

# app/routes/geocoding.js

Express router for geocoding and reverse geocoding endpoints. Updated to include /search endpoint for returning multiple address results for the unified search functionality.

# app/routes/index.js

Main router that mounts all sub-routes for the backend API.

# app/routes/locations.js

Express router for CRUD endpoints on map locations.

# app/routes/qr.js

Express router for QR code generation endpoints.

# app/routes/settings.js

Express router for application settings endpoints (start location, walk sheet).

# app/routes/shifts.js

Express router for volunteer shift management endpoints (public and admin).

# app/routes/users.js

Express router for user management endpoints (list, create, delete users).

# app/routes/dataConvert.js

Express routes for data conversion features. Handles CSV file upload with multer middleware and provides endpoints for processing CSV files and saving geocoded results to the database.

# app/routes/external.js

Express router for external data integration endpoints, including Socrata API integration for accessing and processing external government datasets.

# app/utils/cacheBusting.js

Utility for managing cache busting functionality to ensure users get the latest version of the application when updates are deployed. Handles versioning and cache invalidation strategies.

