Search

Architecture Documentation

Overview

This document describes the architecture and structure of the Jiakai Wang personal website. The site is built using Jekyll for static site generation and follows a modular architecture for both JavaScript and CSS.

Directory Structure

JiakaiW.github.io/
├── _data/                    # Jekyll data files (YAML)
│   ├── projects.yml
│   ├── research_themes.yml
│   └── timeline_projects.yml
├── _includes/                # Jekyll includes (reusable HTML components)
│   ├── components/
│   │   └── glass-filters.html  # SVG filter definitions
│   ├── footer.html
│   ├── head.html            # Head section with CSS/JS includes
│   ├── navigation.html
│   └── overlays.html        # Overlay components (search, card, photo)
├── _layouts/                # Jekyll layouts
│   ├── default.html         # Main layout template
│   └── tech-docs.html
├── assets/
│   ├── css/
│   │   ├── base/            # Foundation styles
│   │   │   ├── variables.css    # CSS custom properties (design tokens)
│   │   │   ├── reset.css        # CSS reset and base element styles
│   │   │   ├── typography.css   # Typography rules
│   │   │   └── layout.css       # Page structure and layout
│   │   ├── components/      # Reusable component styles
│   │   │   ├── glass-effects.css    # Glass morphism effects (single source)
│   │   │   ├── navigation.css       # Header and navigation
│   │   │   ├── search-overlay.css   # Search functionality
│   │   │   ├── card-overlay.css     # Card and overlay components
│   │   │   ├── photo-overlay.css    # Photo expansion overlay
│   │   │   ├── code-blocks.css      # Code block styling
│   │   │   ├── carousel.css         # Image carousel
│   │   │   ├── intro-section.css    # Homepage intro section
│   │   │   ├── theme-grid.css       # Research themes grid
│   │   │   └── news-section.css     # News items section
│   │   └── pages/            # Page-specific styles
│   │       ├── docs.css             # Technical documentation page
│   │       ├── gallery.css          # Photo gallery page
│   │       ├── tech-docs.css        # Tech docs layout page
│   │       └── timeline.css         # Timeline widget page
│   └── js/
│       ├── modules/         # ES6 modules (modular architecture)
│       │   ├── core/        # Core functionality
│       │   │   ├── overlay-manager.js   # Unified overlay management
│       │   │   ├── search-manager.js    # Search functionality (Lunr.js)
│       │   │   └── page-init.js         # Page initialization and global exports
│       │   ├── components/  # UI components
│       │   │   ├── project.js           # Project class
│       │   │   ├── research-theme.js    # ResearchTheme class
│       │   │   ├── theme-manager.js     # ThemeManager class
│       │   │   ├── news-loader.js       # News loading (re-exports from news-manager)
│       │   │   ├── news-manager.js      # Unified news manager
│       │   │   └── timeline.js          # Timeline component
│       │   └── utils/       # Utility functions
│       │       ├── mobile-menu.js       # Mobile navigation menu
│       │       ├── gallery.js           # Gallery scrolling
│       │       ├── event-delegation.js  # Event delegation system
│       │       ├── error-handler.js     # Error handling utility
│       │       ├── dom-registry.js      # Centralized DOM element registry
│       │       ├── constants.js         # Application constants
│       │       ├── service-registry.js  # Service registry for dependency injection
│       │       ├── home-utilities.js    # Home page utility functions
│       │       └── overlay-init.js      # Overlay initialization utilities
│       ├── home.js          # Compatibility wrapper (imports home-modular.js)
│       ├── main.js          # Compatibility wrapper (imports main-modular.js)
│       ├── home-modular.js  # Home page initialization
│       ├── main-modular.js  # Main entry point
│       ├── timeline-modular.js  # Timeline page entry point
│       ├── news-modular.js      # News page entry point
│       └── [glass effects]  # Specialized glass rendering scripts
└── [content files]          # Markdown content files

JavaScript Architecture

Module System

The site uses ES6 modules for better code organization and dependency management. All modules are located in assets/js/modules/ and follow a clear structure:

Core Modules (modules/core/)

Core modules provide essential functionality used across the site:

Component Modules (modules/components/)

Component modules represent UI components and their logic:

Utility Modules (modules/utils/)

Utility modules provide helper functions:

Entry Points

Event Delegation System

The site uses a declarative event delegation system via data-action attributes:

Supported Actions:

Benefits:

Backward Compatibility

Global functions are exported via page-init.js for backward compatibility (legacy support):

Note: Modern code should use the event delegation system with data-action attributes or access services via the service registry instead of global functions.

CSS Architecture

Base Styles (base/)

Foundation styles that must load first:

  1. variables.css: CSS custom properties (design tokens)
    • Color palette
    • Glass effect variables (blur, saturation, opacity)
    • Border radius, shadows, transitions
    • Must load first for other files to use variables
  2. reset.css: CSS reset and base element styles
    • Base element styling (a, img)
    • Figure caption styling
  3. typography.css: Typography rules
    • Font family, heading hierarchy
    • Paragraph styling
  4. layout.css: Page structure and layout
    • HTML/body background and structure
    • Main content layout
    • Dark mode styles
    • Premium background pages

Component Styles (components/)

Reusable component stylesheets:

  1. glass-effects.css: Single source of truth for glass morphism
    • Base glass effect (.glass-base)
    • Variants: .glass-light, .glass-heavy, .glass-subtle, .glass-dark
    • Button variant: .btn-glass
    • Uses CSS variables from variables.css
  2. navigation.css: Header and navigation
    • Header styling with glass effect
    • Navigation menu, dropdowns
    • Mobile hamburger menu
    • Search button
  3. search-overlay.css: Search functionality
    • Search overlay and container
    • Search input and results
    • Result item styling
  4. card-overlay.css: Card and overlay components
    • Card styles
    • Expanded card overlay
    • Photo grid
    • Close button
  5. photo-overlay.css: Photo expansion overlay
    • Photo overlay container
    • Expanded photo display
    • Photo caption
  6. code-blocks.css: Code block styling
    • Pre and code elements
    • Inline code
    • Language indicators
    • Scrollbar styling
  7. carousel.css: Image carousel
    • Carousel container
    • Navigation buttons
  8. intro-section.css: Homepage intro section
    • Intro container with glass effect
    • Image containers
    • Tags styling
    • Thumbs up animation
  9. theme-grid.css: Research themes grid
    • Theme grid layout
    • Theme blocks with glass effect
    • Project previews
    • Expanded theme view
  10. news-section.css: News items section
    • News container grid
    • News item cards with glass effect
    • News page header
    • View all button

Page-Specific Styles (pages/)

Styles specific to individual pages:

  1. docs.css: Technical documentation cards
    • Doc card grid layout
    • Card styling with reduced blur for image visibility
    • Content overlay styling
  2. gallery.css: Photo gallery page
    • Photo grid layout
    • Photo card styling
  3. tech-docs.css: Tech docs layout page
    • Page container styling
    • Content layout
  4. timeline.css: Timeline widget page
    • Timeline container and segments
    • Project bars and tooltips

Loading Order

CSS files are loaded in a specific order in _includes/head.html:

  1. variables.css (must be first)
  2. Base styles (reset, typography, layout)
  3. glass-effects.css (before other components)
  4. Component styles (navigation, search, etc.)
  5. Page-specific styles (pages/gallery.css, pages/docs.css, etc.)
  6. Footer styles

HTML Structure

Layouts

Includes

Data Files

Jekyll data files in _data/:

Design System

CSS Variables

All design tokens are defined in assets/css/base/variables.css:

Glass Morphism

The site uses a consistent glass morphism design system:

Dependencies

External Libraries

Internal Dependencies

Browser Support

Card System

The site uses several types of cards for different purposes:

Card Types

  1. Project Cards (.card)
    • Purpose: Display project thumbnails with text overlay
    • Styling: assets/css/components/card-overlay.css
    • Interaction: Expand to show full project content via overlay
    • Event: Uses data-action="expand-card" with data-action-param for URL
    • Note: Projects are now managed via data-driven architecture (_data/projects.yml)
  2. Doc Cards (.doc-card)
    • Purpose: Display technical documentation cards with thumbnails
    • Location: tech-docs/index.md
    • Styling: assets/css/pages/docs.css
    • Features: Background images visible through reduced blur glass effect
    • Layout: Grid layout with variable row spans based on image presence
  3. Theme Blocks (.theme-block)
    • Purpose: Display research themes on homepage
    • Location: index.md
    • Styling: assets/css/components/theme-grid.css
    • Interaction: Expand to show projects within theme
    • Event: Uses data-action="expand-theme" with data-action-param for theme ID
  4. News Items (.news-item)
    • Purpose: Display news/updates
    • Location: Homepage and news/index.md
    • Styling: assets/css/components/news-section.css
    • Features: Category badges, date display, glass effect
  5. Photo Cards (.photo-card)
    • Purpose: Display photos in gallery
    • Location: photo-grid/gallery.md
    • Styling: assets/css/components/card-overlay.css
    • Interaction: Expand to full-size view

Card Best Practices

Performance Considerations

Future Improvements

  1. TypeScript Migration: Gradually migrate to TypeScript for better type safety
  2. Testing Infrastructure: Add unit tests for modules
  3. Documentation: Add JSDoc comments to all modules (in progress)
  4. Build System: Consider adding bundler for production optimization

Migration Notes