Commit graph

17 commits

Author SHA1 Message Date
Derek Slenk
96e2619aa2 feat: Add shared components and styling for icewatch application
All checks were successful
CI / Validate i18n Files (pull_request) Successful in 19s
Dependency Review / Review Dependencies (pull_request) Successful in 26s
CI / TypeScript Type Check (pull_request) Successful in 1m20s
CI / Lint Code (pull_request) Successful in 1m37s
CI / Build Project (pull_request) Successful in 1m32s
CI / Security Checks (pull_request) Successful in 1m35s
CI / Run Tests (Node 20) (pull_request) Successful in 1m42s
CI / Run Tests (Node 18) (pull_request) Successful in 1m49s
Code Quality / Code Quality Checks (pull_request) Successful in 1m57s
CI / Test Coverage (pull_request) Successful in 1m32s
- Created example-shared-components.html to demonstrate TypeScript-based shared header and footer components.
- Added original-style.css for theming with CSS variables and dark mode support.
- Introduced style-backup.css for legacy styles.
- Developed test-refactored.html for testing map components with Leaflet integration.
- Updated deployment documentation to reflect changes in log file paths and service names.
- Renamed project from "great-lakes-ice-report" to "icewatch" in package.json and package-lock.json.
- Updated Caddyfile for new log file path.
- Added S3 bucket policy for public read access to greatlakes-conditions.
- Removed old service file and created new systemd service for icewatch.
2025-07-17 13:56:32 -04:00
Claude Code
ec60d6bd2a Add version footer and disable map scroll wheel zoom
- Add build-time version generation script that captures git commit info
- Create /api/version endpoint to serve version data
- Add version footer component showing commit SHA, date, and branch
- Link version SHA to commit on git.deco.sh for easy navigation
- Fix footer text duplication issue with i18n translations
- Disable mouse wheel zoom on map, require +/- buttons for better UX
- Update service worker cache to v4 with new version-footer.js

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-07 22:37:20 -04:00
Claude Code
5151e87824 Add TypeScript frontend build system with shared components
- Set up esbuild for fast TypeScript compilation of frontend code
- Create SharedHeader component with factories for main/admin/privacy pages
- Create SharedFooter component with standard and minimal variants
- Add frontend build scripts (build:frontend, watch:frontend, dev:full)
- Configure TypeScript for browser environment with DOM types
- Add example page demonstrating shared component usage
- Update .gitignore to exclude compiled frontend files

Benefits:
- Type-safe frontend components
- Consistent headers/footers across all pages
- Single source of truth for common UI elements
- Built-in i18n and theme toggle support

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-07 19:46:19 -04:00
Claude Code
8b1787ec47 Add comprehensive internationalization (i18n) with Spanish language support
This major feature introduces complete internationalization architecture with Spanish (Mexico) as the first additional language:

## New Features:
- **I18n Architecture**: Complete client-side and server-side internationalization system
- **Spanish (Mexico) Support**: Full es-MX translations for all user-facing text
- **Language Selector**: Dynamic language switching UI component in header
- **API Endpoints**: RESTful endpoints for serving translations (/api/i18n)
- **Progressive Enhancement**: Language detection via Accept-Language header and cookies

## Technical Implementation:
- **Frontend**: Client-side i18n.js with automatic DOM translation and language selector
- **Backend**: Server-side i18n service with locale detection middleware
- **Build Process**: Automated copying of translation files to dist/ directory
- **Responsive Design**: Language selector integrated into header controls layout

## Files Added:
- public/i18n.js - Client-side internationalization library
- src/i18n/index.ts - Server-side i18n service
- src/i18n/locales/en.json - English translations
- src/i18n/locales/es-MX.json - Spanish (Mexico) translations
- src/routes/i18n.ts - API endpoints for translations

## Files Modified:
- package.json - Updated build process to include i18n files
- public/index.html - Added i18n attributes and language selector
- public/app.js - Integrated dynamic translation updates
- src/server.ts - Added locale detection middleware
- src/scss/pages/_index.scss - Language selector styling

This implementation supports easy addition of future languages and maintains backward compatibility while providing a seamless multilingual experience.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-07 12:25:44 -04:00
Deco Vander
ebafb1fa5a Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-07-06 00:13:37 -04:00
Claude Code
96dc6bde42 Add Mapbox static map generation for non-JavaScript users
- Implement MapImageService using Mapbox Static Images API
- Add server-side /table route with HTML form submission
- Generate static map images with auto-fit positioning based on actual location coordinates
- Add progressive enhancement with noscript fallbacks and Basic View button
- Update map center coordinates to proper Grand Rapids location
- Add numbered pins with color coding (red for regular, orange for persistent reports)
- Remove server-side caching to ensure fresh map images
- Fix theme toggle icon centering in CSS mixins

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-06 00:09:23 -04:00
Claude Code
30fdd72cc5 Add coordinate validation and ESLint integration
- Add explicit latitude/longitude validation in location submissions
- Implement ESLint with TypeScript support and flat config
- Auto-fix 621 formatting issues across codebase
- Add comprehensive tests for coordinate validation
- Update documentation with lint scripts and validation rules
- Maintain 128 passing tests with enhanced security

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 22:12:37 -04:00
Claude Code
88f7e72501 Fix critical security vulnerabilities in location endpoints
SECURITY FIXES:
- Remove dangerous public DELETE /api/locations/:id endpoint
- Add rate limiting to POST /api/locations (10 requests per 15 minutes)
- Add input validation with length limits (500 chars address, 1000 chars description)
- Add suspicious activity logging for abuse detection
- Install express-rate-limit for protection against spam/DoS

CHANGES:
- Removed LocationDeleteRequest interface (no longer needed)
- Updated tests to expect new security validation behavior
- Added comprehensive tests for length validation
- Fixed test setup issue with undefined constants

Security Impact:
- CRITICAL: Prevents unauthorized deletion of location reports
- HIGH: Prevents spam submissions and DoS attacks
- MEDIUM: Prevents buffer overflow and injection attacks via oversized inputs

All 125 tests passing with new security validations.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 21:54:23 -04:00
Claude Code
4bcc99d44b Add comprehensive TypeScript test suite with Jest
- Configure Jest for TypeScript testing with ts-jest preset
- Create comprehensive unit tests for Location model (15 tests)
- Create comprehensive unit tests for ProfanityWord model (16 tests)
- Create comprehensive unit tests for ProfanityFilterService (30+ tests)
- Create integration tests for public API routes (18 tests)
- Add test database setup and teardown utilities
- Configure coverage reporting with 80% threshold
- Install testing dependencies (@types/jest, ts-jest, @types/supertest)

Test Coverage:
- Location model: Full CRUD operations, validation, cleanup
- ProfanityWord model: Full CRUD operations, constraints, case handling
- ProfanityFilterService: Text analysis, custom words, filtering
- Public API routes: Configuration, location reporting, error handling
- Request validation: JSON parsing, content types, edge cases

Features:
- In-memory SQLite databases for isolated testing
- Comprehensive test setup with proper cleanup
- Mock profanity filters for controlled testing
- Type-safe test implementations with TypeScript
- Detailed test scenarios for edge cases and error conditions

All tests passing: 67 total tests across models and integration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 21:30:07 -04:00
Claude Code
612475727e Add comprehensive OpenAPI/Swagger API documentation
- Install swagger-ui-express and swagger-jsdoc dependencies
- Create comprehensive OpenAPI 3.0 specification with detailed schemas
- Add interactive Swagger UI at /api-docs endpoint
- Document all public API endpoints (/api/config, /api/locations)
- Document admin authentication and management endpoints
- Include comprehensive request/response schemas and examples
- Add authentication documentation for admin endpoints
- Update CLAUDE.md with API documentation information

Features:
- Complete API specification with OpenAPI 3.0 standard
- Interactive documentation interface with Swagger UI
- Detailed request/response examples for all endpoints
- Authentication flows for admin functionality
- Error response documentation with examples
- Type-safe integration with existing TypeScript architecture

API Documentation available at: /api-docs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 21:21:31 -04:00
Claude Code
c4cf921a54 Add comprehensive TypeScript support and conversion
- Convert entire backend to TypeScript with strict type checking
- Add comprehensive type definitions and interfaces
- Create typed models for Location and ProfanityWord with database operations
- Convert all services to TypeScript (DatabaseService, ProfanityFilterService)
- Convert all API routes with proper request/response typing
- Add TypeScript build system and development scripts
- Update package.json with TypeScript dependencies and scripts
- Configure tsconfig.json with strict typing and build settings
- Update CLAUDE.md documentation for TypeScript development
- Add .gitignore rules for TypeScript build artifacts

Architecture improvements:
- Full type safety throughout the application
- Typed database operations and API endpoints
- Proper error handling with typed exceptions
- Strict optional property handling
- Type-safe dependency injection for routes

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-05 21:15:29 -04:00
Deco Vander
9716fe9f1d Configure CSS as generated asset, not committed to git
- Added public/style.css to .gitignore
- Removed style.css from git tracking (git rm --cached)
- Enhanced package.json scripts for better CSS workflow:
  - postinstall: Auto-builds CSS on npm install
  - build-css:dev: Development build with source maps
  - start: Now builds CSS before starting server
  - dev: Builds CSS before development mode
- Updated README with CSS development documentation
- Explains SCSS organization and build process
- Documents all CSS-related npm scripts

Benefits:
 Cleaner repository (no generated files)
 Prevents merge conflicts in generated CSS
 Automatic CSS generation on new machine setup
 Source of truth is SCSS files only
 Consistent build process across environments
2025-07-04 14:43:52 -04:00
Deco Vander
9628da957b Resolve merge conflicts between feature/css-optimization and main
- Resolved conflicts in admin.html to keep CSS optimization changes
- Regenerated package-lock.json after merge
- All features from both branches are now integrated
2025-07-04 14:28:50 -04:00
Deco Vander
f83e087541 Optimize CSS architecture with SCSS modular system
## Major CSS/SCSS Improvements
-  Set up modular SCSS architecture with variables, mixins, and components
-  Created organized directory structure: src/scss/ with variables, mixins, pages/
-  Removed ~300+ lines of inline CSS from admin.html
-  Added comprehensive design system with consistent spacing, colors, typography
-  Created reusable mixins for buttons, cards, tables, forms, and layouts
-  Implemented responsive breakpoint mixins for mobile/tablet/desktop
-  Added utility classes for common layouts and spacing

## Build System
-  Added sass and concurrently as dev dependencies
-  Created npm scripts: build-css, watch-css, dev-with-css
-  Automated SCSS compilation to compressed CSS
-  Set up development workflow with CSS watching

## Admin Panel Enhancements
-  Added complete tab navigation system (Location Reports + Profanity Filter)
-  Integrated profanity management UI with forms and tables
-  Consistent styling across all components using SCSS mixins
-  Improved responsive design for mobile devices

## Benefits
- 🎯 Maintainable: All styles centralized in modular SCSS files
- 📱 Responsive: Better mobile experience with consistent breakpoints
- 🎨 Consistent: Design system ensures visual consistency
-  Efficient: Compressed CSS output, no inline styles
- 🔧 Developer-friendly: Easy to extend and modify styles

The application now has professional-grade CSS architecture that's easy to maintain and extend.
2025-07-04 11:30:34 -04:00
Deco Vander
c7f39e4939 feat: isolate profanity filter with separate database
- Create dedicated ProfanityFilter class with isolated SQLite database
- Separate profanity.db from main application database to prevent SQLITE_MISUSE errors
- Add comprehensive custom word management (CRUD operations)
- Implement advanced profanity detection with leetspeak and pattern matching
- Add admin UI for managing custom profanity words
- Add extensive test suites for both profanity filter and API routes
- Update server.js to use isolated profanity filter
- Add proper database initialization and cleanup methods
- Support in-memory databases for testing

Breaking changes:
- Profanity filter now uses separate database file
- Updated admin API endpoints for profanity management
- Enhanced profanity detection capabilities
2025-07-04 00:03:24 -04:00
Deco Vander
d9559f71fe Update HTML files to use Bunny.net CDN for static assets
- Updated all static asset URLs to use iceymi.b-cdn.net CDN
- Changed favicon, CSS, and JS file references in index.html, admin.html, and privacy.html
- API calls remain pointed to origin server for dynamic content
- Ready for CDN deployment with proper cache separation
2025-07-03 20:44:16 -04:00
Deco Vander
edfdeb5117 Initial commit: ICE Watch Michigan community safety tool
- Node.js/Express backend with SQLite database
- Interactive map with real-time location tracking
- MapBox API integration for fast geocoding
- Admin panel for content moderation
- 24-hour auto-expiring reports
- Deployment scripts for Debian 12 ARM64
- Caddy reverse proxy with automatic HTTPS
2025-07-02 23:27:22 -04:00