# samuel-chow-demon/sam_info architecture

> Architecture diagram of the GitHub repository samuel-chow-demon/sam_info, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/samuel-chow-demon/sam_info
- Repository: https://github.com/samuel-chow-demon/sam_info

## Overview

##### Project type and purpose
- This is a single-page frontend application (a portfolio site) built with React and Vite.
- It loads static data (YAML files) to drive site content and uses React Three Fiber for 3D badge displays.

##### File structure
- Top-level:
- package.json, vite.config.js, index.html – define dependencies, build & dev server config, and the single HTML entry.
- src/:
- main.jsx – bootstraps the React app into the DOM.
- App.jsx – root component orchestrating layout & routing-like tab state.
- components/ – all UI pieces: dashboard, about, education, work experience, portfolio, etc.
- data/ – YAML files with content for each section (About.yaml, SkillsAndLang.yaml, etc.).
- hook/ – custom hooks (useYamlCfgStyle) to load & style YAML configs.
- threeFiber/ – subfolders for React Three Fiber UI, 3D components, and badge groups.

##### README for additional insights
- Very brief: “Sam Info Project. An Embedded App for Sam Portfolio.” Confirms it’s a static portfolio SPA.

a. Main components
1. Developer & Build Tools (VSCode, CLI)
2. Vite Dev Server / Bundler
3. Static Entry (index.html)
4. React Runtime (main.jsx → App.jsx)
5. Content Loader (YAML parser via useYamlCfgStyle hook)
6. UI Components (About, Dashboard, Portfolio, etc.)
7. 3D Renderer (React Three Fiber + three.js)
8. Utility Modules (ImgLibrary, style.js, constant.js)
9. Public Assets (public/)
10. Deployment Target (Static host / CDN)

b. Relationships & interactions
- Developer invokes Vite → starts Dev Server or Build → outputs bundled JS/CSS.
- index.html loads bundle into browser.
- main.jsx calls ReactDOM.render(App) → mounts root component.
- App.jsx uses hooks to fetch YAML data and passes it to UI components.
- Some components delegate to threeFiber/ for 3D badge rendering: they mount a Canvas, load textures via utility/iconTexture, then render badge groups.
- Utility modules supply cross-cutting functions (e.g., ImgLibrary maps names to image URLs).
- Public/ assets are referenced by components or utility library at runtime.

c. Architectural patterns & principles
- Component-based UI (React).
- Separation of concerns: data (YAML) vs. presentation (JSX components).
- Hook abstraction for config‐style loading.
- Layered approach: data loader → UI components → 3D engine → browser.

d. Key technologies
- Vite (dev server & bundler)
- React & ReactDOM
- React Three Fiber + three.js
- YAML loader (JS-based parser via custom hook)
- CSS for styling (index.css & style.js helpers)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Build & Dev Tools"
        Dev["Developer (VSCode, CLI)"]:::build
        Vite["Vite Dev Server / Bundler"]:::build
        Dev -->|uses| Vite
    end

    Vite -->|"builds"| Bundle["Bundled JS/CSS"]:::build

    Bundle -->|"served by"| indexHTML["index.html"]:::build
    click indexHTML "https://github.com/samuel-chow-demon/sam_info/blob/main/index.html"

    indexHTML -->|"loads bundle into"| Browser["Browser (Runtime)"]:::runtime

    subgraph "React App (Runtime)"
        main["main.jsx"]:::react
        click main "https://github.com/samuel-chow-demon/sam_info/blob/main/src/main.jsx"
        App["App.jsx"]:::react
        click App "https://github.com/samuel-chow-demon/sam_info/blob/main/src/App.jsx"
        main -->|"mounts"| App

        subgraph "Data Loader Layer"
            hook["useYamlCfgStyle"]:::data
            click hook "https://github.com/samuel-chow-demon/sam_info/blob/main/src/hook/useYamlCfgStyle.jsx"
            YAML["YAML Content Files"]:::data
            hook -->|"parses"| YAML
        end

        subgraph "Static Data Files"
            AboutY["About.yaml"]:::data
            click AboutY "https://github.com/samuel-chow-demon/sam_info/blob/main/src/data/About.yaml"
            CategoryY["Category.yaml"]:::data
            click CategoryY "https://github.com/samuel-chow-demon/sam_info/blob/main/src/data/Category.yaml"
            CertPubY["CertAndPublicate.yaml"]:::data
            click CertPubY "https://github.com/samuel-chow-demon/sam_info/blob/main/src/data/CertAndPublicate.yaml"
            EducationY["Education.yaml"]:::data
            click EducationY "https://github.com/samuel-chow-demon/sam_info/blob/main/src/data/Education.yaml"
            PortfolioY["Portfolio.yaml"]:::data
            click PortfolioY "https://github.com/samuel-chow-demon/sam_info/blob/main/src/data/Portfolio.yaml"
            ProgLangY["ProgLang.yaml"]:::data
            click ProgLangY "https://github.com/samuel-chow-demon/sam_info/blob/main/src/data/ProgLang.yaml"
            SkillsY["SkillsAndLang.yaml"]:::data
            click SkillsY "https://github.com/samuel-chow-demon/sam_info/blob/main/src/data/SkillsAndLang.yaml"
            WorkExpY["WorkExp.yaml"]:::data
            click WorkExpY "https://github.com/samuel-chow-demon/sam_info/blob/main/src/data/WorkExp.yaml"
        end

        YAML --> hook
        App --> hook

        subgraph "UI Components"
            compDash["Dashboard.jsx"]:::ui
            click compDash "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/Dashboard.jsx"
            compAbout["About.jsx"]:::ui
            click compAbout "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/About.jsx"
            compEdu["Education.jsx"]:::ui
            click compEdu "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/Education.jsx"
            compWork["WorkExperience.jsx"]:::ui
            click compWork "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/WorkExperience.jsx"
            compSkill["SkillAndLang.jsx"]:::ui
            click compSkill "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/SkillAndLang.jsx"
            compCert["CertAndPublicate.jsx"]:::ui
            click compCert "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/CertAndPublicate.jsx"
            compPort["Portfolio.jsx"]:::ui
            click compPort "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/Portfolio.jsx"
            compPortCont["PortfolioContent.jsx"]:::ui
            click compPortCont "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/PortfolioContent.jsx"
            compContentCont["ContentContainer.jsx"]:::ui
            click compContentCont "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/ContentContainer.jsx"
            compInfo["InfoBar.jsx"]:::ui
            click compInfo "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/InfoBar.jsx"
            compProgBar["ProgressBarWithLabel.jsx"]:::ui
            click compProgBar "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/ProgressBarWithLabel.jsx"
            compVideo["VideoPlayer.jsx"]:::ui
            click compVideo "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/VideoPlayer.jsx"
            compIcon["IconComponent.jsx"]:::ui
            click compIcon "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/IconComponent.jsx"
            compLoading["Loading.jsx"]:::ui
            click compLoading "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/Loading.jsx"
            compScroll["ScrollButton.jsx"]:::ui
            click compScroll "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/ScrollButton.jsx"
            compScrollComp["ScrollButtonComponent.jsx"]:::ui
            click compScrollComp "https://github.com/samuel-chow-demon/sam_info/blob/main/src/components/ScrollButtonComponent.jsx"
        end

        App --> compDash
        App --> compAbout
        App --> compEdu
        App --> compWork
        App --> compSkill
        App --> compCert
        App --> compPort

        subgraph "3D Rendering Layer"
            subgraph "UI Controls"
                gui["GUI.js"]:::three
                click gui "https://github.com/samuel-chow-demon/sam_info/blob/main/src/threeFiber/UI/GUI.js"
                useGui["useGuiControl.jsx"]:::three
                click useGui "https://github.com/samuel-chow-demon/sam_info/blob/main/src/threeFiber/UI/useGuiControl.jsx"
            end

            subgraph "3D Components"
                badge["Badge.jsx"]:::three
                click badge "https://github.com/samuel-chow-demon/sam_info/blob/main/src/threeFiber/components/Badge.jsx"
            end

            subgraph "Badge Groups"
                displayAll["DisplayAllBadge.jsx"]:::three
                click displayAll "https://github.com/samuel-chow-demon/sam_info/blob/main/src/threeFiber/group/DisplayAllBadge.jsx"
                proLang["ProLangBadge.jsx"]:::three
                click proLang "https://github.com/samuel-chow-demon/sam_info/blob/main/src/threeFiber/group/ProLangBadge.jsx"
            end

            compPort --> displayAll
            compPort --> proLang
            displayAll --> badge
            proLang --> badge
            gui --> badge
            useGui --> gui
            App -->|"renders"| displayAll
        end

        subgraph "Utility Modules"
            imgLib["ImgLibrary.js"]:::util
            click imgLib "https://github.com/samuel-chow-demon/sam_info/blob/main/src/utility/ImgLibrary.js"
            iconTex["iconTexture.js"]:::util
            click iconTex "https://github.com/samuel-chow-demon/sam_info/blob/main/src/utility/iconTexture.js"
            styleUtil["style.js"]:::util
            click styleUtil "https://github.com/samuel-chow-demon/sam_info/blob/main/src/utility/style.js"
            constant["constant.js"]:::util
            click constant "https://github.com/samuel-chow-demon/sam_info/blob/main/src/script/constant.js"
        end

        App --> imgLib
        badge --> iconTex

        subgraph "Static Assets"
            public["public/"]:::static
        end

        compIcon --> public
        iconTex --> public
    end

    Bundle --> public
    public --> Browser
    Browser --> App

    subgraph "Deployment"
        deploy["Static Host/CDN"]:::deploy
        Bundle --> deploy
        public --> deploy
    end

    classDef build fill:#D0E8FF,stroke:#0B69A5;
    classDef runtime fill:#E8F4FF,stroke:#4791DB;
    classDef react fill:#D1E7DD,stroke:#2F855A;
    classDef data fill:#DFF2BF,stroke:#90A046;
    classDef ui fill:#FFE5B4,stroke:#E68A00;
    classDef three fill:#E5D4F4,stroke:#7D46A0;
    classDef util fill:#F0F0F0,stroke:#525252;
    classDef static fill:#FFF4BF,stroke:#E0A800;
    classDef deploy fill:#FFEFE0,stroke:#DD6B20;
```
