mirror of
https://github.com/shadoll/sLogos.git
synced 2025-12-20 05:28:59 +00:00
5.1 KiB
5.1 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is a Svelte-based logo gallery and quiz game application that displays company/brand logos and provides interactive games like flag quizzes. The project uses Docker for development and deploys to GitHub Pages.
Development Commands
Docker-based Development (Recommended)
make dev- Start development server with live reload at http://localhost:5006make build- Build the Docker containermake start- Start application in backgroundmake stop- Stop the applicationmake restart- Restart the applicationmake logs- View application logsmake run CMD="command"- Run any command inside the container
Data Management
make update-data- Scan logos directory and regenerate data filesnpm run update-data- Same as above, but run directly (inside container)
Asset Generation
make favicon- Generate favicon variantsnpm run generate-variants- Generate SVG color variantsnpm run generate-favicons- Generate favicon filesnpm run pwa-cache-list- Generate PWA cache manifest
Build Commands
npm run build- Build production bundle using Rollupnpm run dev- Development build with live reloadnpm start- Start sirv server on port 5006
Architecture
Tech Stack
- Frontend: Svelte 3.59.2 with SPA routing
- Bundler: Rollup with plugins for Svelte, CSS, and minification
- Routing: svelte-spa-router for single-page navigation
- Styling: CSS with theme support (light/dark/system)
- Development: Docker with live reload
Key Application Structure
Main App (src/App.svelte)
- Central state management through
window.appDataglobal object - Handles routing, theme management, and data collection switching
- Manages search, filtering (tags, brands, variants), and view modes
- Supports multiple collections (logos, flags) via dynamic data loading
Pages (src/pages/)
Home.svelte- Main logo gallery with grid/list/compact viewsGame.svelte- Game selection landing pageFlagQuiz.svelte- Flag identification quiz with adaptive learningCapitalsQuiz.svelte- Country capitals quizGeographyQuiz.svelte- Geography-based quiz gamePreview.svelte- Individual logo preview modal
Components (src/components/)
CardFull.svelte- Full logo display card with actionsHeader.svelte- Navigation and search interfaceActions.svelte- Action buttons for copy/downloadAchievements.svelte- Quiz achievement system- Various card sizes (
CardSmall,CardMiddle) for different views
Data Flow
- Logo data loaded from JSON files in
public/data/(logos.json, flags.json) - Collections switchable via dropdown, stored in localStorage
- Global state shared via
window.appDataobject - Theme persistence with system preference detection
- URL-based state for search/filter sharing
Key Features
Multi-Collection Support
- Supports different data collections (logos, flags)
- Collection switching triggers data reload and state reset
- Each collection has its own data file structure
Advanced Filtering
- Text search across name, title, brand, and metadata
- Tag-based filtering with colored tags
- Brand filtering for logo variants
- Variant filtering (different logo styles)
- Compact mode to show unique brands only
Theme System
- Light/dark/system theme options
- CSS custom properties for theme switching
- Persistent theme preferences
Quiz System
- Adaptive learning algorithms
- Achievement tracking
- Score persistence
- Multiple quiz types with shared logic in
src/quizLogic/
File Structure Conventions
Static Assets
public/logos/- Logo files (SVG, PNG)public/data/- JSON data files generated from asset scanningpublic/build/- Compiled JS/CSS output (generated)
Scripts (scripts/)
update-data.js- Scans asset directories and generates JSON manifestsgenerate-svg-variants.js- Creates color variants of SVG logosgenerate-favicons.js- Generates favicon files from source imagescleanup_worldmap.py- SVG cleanup utilities
Development Files
rollup.config.js- Bundler configuration with dev/prod modesMakefile- Docker development commandscompose.dev.yml- Docker Compose configurationDockerfile.dev- Development container setup
Development Workflow
- Adding New Logos: Place files in
public/logos/, runmake update-data - UI Changes: Edit Svelte files in
src/, changes auto-reload in dev mode - Asset Changes: Regenerate variants with
npm run generate-variants - Deployment: Push to
mainbranch triggers automatic GitHub Pages deployment
Important Notes
- All development should use Docker containers for consistency
- The app uses a global
window.appDataobject for component communication - Theme changes require CSS custom property updates
- Data files are auto-generated - don't edit JSON files directly
- Quiz logic is modular and shared between different quiz types
- SVG logos support automatic color variant generation