# eric202501/hw-sd3 architecture

> Architecture diagram of the GitHub repository eric202501/hw-sd3, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eric202501/hw-sd3
- Repository: https://github.com/eric202501/hw-sd3

## Overview

Based on your file tree and README, the project “NCU Map” is a single-page Vue.js application meant to provide a landmark search experience using a map canvas. The three main functions (searching, displaying markers, and showing details) are implemented as separate Vue components, with data (in JSON format) stored under the assets folder.

##### Main Components
- Frontend Framework: Highlight Vue.js as the main framework, and also list Bootstrap for the CSS styling.
- Entry Point: The index.html file which loads the application.
- Core Application: The “src” folder where the App.vue serves as the root component.
- Components:
- SearchBar: Handles text input. (see src/components/SearchBar.vue)
- MapCanvas: Responsible for rendering the map and displaying search results/markers. (see src/components/MapCanvas.vue)
- ButtonMenu or other supporting components: (e.g., ButtonMenu.vue) which may be used for filtering or categorized searches.
- Data Assets: The JSON files under src/assets (data.json and data2.json) that store landmark information.
- Build/Dev Tool: Vite (configured in vite.config.js) which is used to bundle and serve the application.

##### Relationships/Interactions
- User Interaction: A user’s input via the SearchBar (text input “this.searchInput”) triggers the search functionality.
- Data Flow:
- The SearchBar communicates (likely via Vue events or props) the search query.
- Processed results are then passed to the MapCanvas via a function call (e.g., showResult(result)).
- The MapCanvas uses the landmark “name” property from the JSON data to display markers; clicking on markers might trigger a detail view.
- Another component (implied by showDetail(name)) is responsible for showing the detailed information for a selected landmark.

##### Architectural Patterns/Design Principles
- Component-Based Architecture: Emphasize that the application is built as individual, reusable Vue components.
- Frontend-Only Architecture: This is a client-side application; there is no separate back-end service noted.
- Separation of Concerns: Clearly separate UI (search input, map canvas) from data (assets) and styling (Bootstrap, CSS files in src/main.css).

##### Elements
- From the User Browser to the SearchBar (user input).
- From SearchBar to MapCanvas (transfer of the search result array).
- From MapCanvas to Detail Display Component (on landmark selection).
- A listing of technologies/frameworks next to each component, e.g., “Vue.js”, “Bootstrap”, “Vite”.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global Nodes
    UserBrowser("User Browser"):::ui
    Index("index.html"):::ui

    %% User Browser loads index.html and interacts with app
    UserBrowser -->|"loads"| Index

    %% Vue Application Subgraph
    subgraph "Vue Application"
        App("App.vue"):::core
        SearchBar("SearchBar Component"):::core
        MapCanvas("MapCanvas Component"):::core
        Detail("Detail Display Component"):::core
        Button("ButtonMenu Component"):::core
    end

    Index -->|"boots"| App
    UserBrowser -->|"interacts"| SearchBar

    %% Component Interactions
    SearchBar -->|"searchQuery"| MapCanvas
    MapCanvas -->|"showDetail"| Detail

    %% Data Assets Subgraph
    subgraph "Data Assets (JSON)"
        d1("data.json"):::data
        d2("data2.json"):::data
    end

    d1 -->|"data"| SearchBar
    d1 -->|"data"| MapCanvas
    d2 -->|"data"| SearchBar
    d2 -->|"data"| MapCanvas

    %% Build Tools & Libraries Subgraph
    subgraph "Build Tools & Libraries"
        pkg("package.json"):::build
        css("src/main.css"):::build
        vite("vite.config.js"):::build
    end

    pkg -->|"deps"| App
    css -->|"styles"| App
    vite -->|"buildTool"| App

    %% Styles for Classes
    classDef ui fill:#DDEEFF,stroke:#333,stroke-width:2px;
    classDef core fill:#FFDDEE,stroke:#333,stroke-width:2px;
    classDef data fill:#EEFFDD,stroke:#333,stroke-width:2px;
    classDef build fill:#FFEEDD,stroke:#333,stroke-width:2px;

    %% Click Events
    click Index "https://github.com/eric202501/hw-sd3/blob/main/index.html"
    click App "https://github.com/eric202501/hw-sd3/blob/main/src/App.vue"
    click SearchBar "https://github.com/eric202501/hw-sd3/blob/main/src/components/SearchBar.vue"
    click MapCanvas "https://github.com/eric202501/hw-sd3/blob/main/src/components/MapCanvas.vue"
    click Button "https://github.com/eric202501/hw-sd3/blob/main/src/components/ButtonMenu.vue"
    click d1 "https://github.com/eric202501/hw-sd3/blob/main/src/assets/data.json"
    click d2 "https://github.com/eric202501/hw-sd3/blob/main/src/assets/data2.json"
    click pkg "https://github.com/eric202501/hw-sd3/blob/main/package.json"
    click css "https://github.com/eric202501/hw-sd3/blob/main/src/main.css"
    click vite "https://github.com/eric202501/hw-sd3/blob/main/vite.config.js"
```
