# yunha2604-hub/battle-study architecture

> Architecture diagram of the GitHub repository yunha2604-hub/battle-study, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yunha2604-hub/battle-study
- Repository: https://github.com/yunha2604-hub/battle-study

## Overview

Battle Study is a student quiz-battle and teacher assessment prototype built as a Next.js app. Students enter through the landing page, reach the lobby, choose a battle mode, answer questions, and view results; teachers configure assessments and review student outcomes. The README also describes school rankings, analytics, custom rooms, and AI-assisted quiz/report generation. The supplied source excerpts show client-side state and route/component wiring, but no backend or external AI integration; README-only capabilities are represented without implying those services exist.

Main entry points: [`src/context/BattleStudyContext.tsx`](https://github.com/yunha2604-hub/battle-study/blob/main/src/context/BattleStudyContext.tsx) (Shared app state), [`src/components/Lobby.tsx`](https://github.com/yunha2604-hub/battle-study/blob/main/src/components/Lobby.tsx) (Lobby and rankings), [`src/components/GlobalHeader.tsx`](https://github.com/yunha2604-hub/battle-study/blob/main/src/components/GlobalHeader.tsx) (Global navigation), [`src/app/page.tsx`](https://github.com/yunha2604-hub/battle-study/blob/main/src/app/page.tsx) (Landing route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_student["Student experience"]
  node_landing_route["Landing route<br/>[page.tsx]"]
  node_landing_view["Landing screen<br/>[LandingPage.tsx]"]
  node_lobby_route["Lobby route<br/>[page.tsx]"]
  node_lobby_view["Lobby and rankings<br/>[Lobby.tsx]"]
  node_analytics_route["Analytics route<br/>[page.tsx]"]
  node_analytics_view["Player analytics"]
end

subgraph group_gameplay["Battle modes"]
  node_raid_route["Dungeon route<br/>[page.tsx]"]
  node_battle_route["Battle route<br/>[page.tsx]"]
  node_battle_view["Quiz battle<br/>[BattleArena.tsx]"]
  node_confirm_modal["Battle confirmation"]
  node_custom_room["Custom room"]
  node_deathmatch_route["School match route<br/>[page.tsx]"]
  node_deathmatch_view["School deathmatch"]
  node_result_route["Result route<br/>[page.tsx]"]
  node_result_view["Match results<br/>[ResultPage.tsx]"]
end

subgraph group_teacher["Teacher assessment"]
  node_teacher_route["Teacher route<br/>[page.tsx]"]
  node_teacher_dashboard["Assessment dashboard"]
  node_assessment_route["Assessment route<br/>[page.tsx]"]
  node_assessment_view["Assessment exam"]
end

subgraph group_shared["App coordination"]
  node_app_state["Shared app state"]
  node_header["Global navigation<br/>[GlobalHeader.tsx]"]
end

node_student_actor(("Student"))
node_teacher_actor(("Teacher"))

node_student_actor -->|"opens"| node_landing_route
node_teacher_actor -->|"opens"| node_landing_route
node_landing_route -->|"renders"| node_landing_view
node_landing_route -->|"invokes entry"| node_app_state
node_landing_view -->|"renders"| node_header
node_app_state -->|"navigates"| node_battle_route
node_app_state -->|"opens"| node_confirm_modal
node_lobby_route -->|"renders"| node_lobby_view
node_lobby_route -->|"reads state"| node_app_state
node_lobby_view -->|"renders"| node_header
node_lobby_view -->|"renders"| node_confirm_modal
node_lobby_view -->|"renders"| node_analytics_view
node_lobby_view -->|"offers dungeon"| node_raid_route
node_lobby_view -->|"offers team match"| node_deathmatch_route
node_analytics_route -->|"renders"| node_lobby_view
node_raid_route -->|"renders"| node_lobby_view
node_battle_route -->|"renders"| node_battle_view
node_battle_route -->|"reads match state"| node_app_state
node_battle_view -->|"renders"| node_header
node_battle_view -->|"finishes match"| node_app_state
node_deathmatch_route -->|"renders"| node_deathmatch_view
node_deathmatch_route -->|"reads state"| node_app_state
node_deathmatch_view -->|"renders"| node_header
node_result_route -->|"renders"| node_result_view
node_result_route -->|"reads results"| node_app_state
node_app_state -->|"navigates"| node_result_route
node_teacher_route -->|"renders"| node_teacher_dashboard
node_teacher_route -->|"reads assessment state"| node_app_state
node_teacher_dashboard -->|"renders"| node_header
node_teacher_dashboard -->|"starts assessment"| node_assessment_route
node_assessment_route -->|"renders"| node_assessment_view
node_assessment_view -->|"uses assessment types"| node_teacher_dashboard
node_header -->|"navigates"| node_lobby_route
node_header -->|"navigates"| node_deathmatch_route
node_header -->|"navigates"| node_analytics_route

click node_landing_route "https://github.com/yunha2604-hub/battle-study/blob/main/src/app/page.tsx"
click node_landing_view "https://github.com/yunha2604-hub/battle-study/blob/main/src/components/LandingPage.tsx"
click node_lobby_route "https://github.com/yunha2604-hub/battle-study/blob/main/src/app/lobby/page.tsx"
click node_lobby_view "https://github.com/yunha2604-hub/battle-study/blob/main/src/components/Lobby.tsx"
click node_analytics_route "https://github.com/yunha2604-hub/battle-study/blob/main/src/app/analytics/page.tsx"
click node_analytics_view "https://github.com/yunha2604-hub/battle-study/blob/main/src/components/PlayerAnalytics.tsx"
click node_raid_route "https://github.com/yunha2604-hub/battle-study/blob/main/src/app/shadow-raid/page.tsx"
click node_battle_route "https://github.com/yunha2604-hub/battle-study/blob/main/src/app/battle/page.tsx"
click node_battle_view "https://github.com/yunha2604-hub/battle-study/blob/main/src/components/BattleArena.tsx"
click node_confirm_modal "https://github.com/yunha2604-hub/battle-study/blob/main/src/components/BattleConfirmModal.tsx"
click node_custom_room "https://github.com/yunha2604-hub/battle-study/blob/main/src/components/CustomRoomWaiting.tsx"
click node_deathmatch_route "https://github.com/yunha2604-hub/battle-study/blob/main/src/app/deathmatch/page.tsx"
click node_deathmatch_view "https://github.com/yunha2604-hub/battle-study/blob/main/src/components/SchoolDeathmatchArena.tsx"
click node_result_route "https://github.com/yunha2604-hub/battle-study/blob/main/src/app/result/page.tsx"
click node_result_view "https://github.com/yunha2604-hub/battle-study/blob/main/src/components/ResultPage.tsx"
click node_teacher_route "https://github.com/yunha2604-hub/battle-study/blob/main/src/app/teacher/page.tsx"
click node_teacher_dashboard "https://github.com/yunha2604-hub/battle-study/blob/main/src/components/TeacherDashboard.tsx"
click node_assessment_route "https://github.com/yunha2604-hub/battle-study/blob/main/src/app/assessment-test/page.tsx"
click node_assessment_view "https://github.com/yunha2604-hub/battle-study/blob/main/src/components/AssessmentExamView.tsx"
click node_app_state "https://github.com/yunha2604-hub/battle-study/blob/main/src/context/BattleStudyContext.tsx"
click node_header "https://github.com/yunha2604-hub/battle-study/blob/main/src/components/GlobalHeader.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_landing_route,node_landing_view,node_lobby_route,node_lobby_view,node_analytics_route,node_analytics_view toneBlue
class node_raid_route,node_battle_route,node_battle_view,node_confirm_modal,node_custom_room,node_deathmatch_route,node_deathmatch_view,node_result_route,node_result_view toneAmber
class node_teacher_route,node_teacher_dashboard,node_assessment_route,node_assessment_view toneMint
class node_app_state,node_header toneRose
class node_student_actor,node_teacher_actor toneIndigo
```

## Components

### Student experience

- [Landing route](https://github.com/yunha2604-hub/battle-study/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Landing screen](https://github.com/yunha2604-hub/battle-study/blob/main/src/components/LandingPage.tsx): `src/components/LandingPage.tsx`
- [Lobby route](https://github.com/yunha2604-hub/battle-study/blob/main/src/app/lobby/page.tsx): `src/app/lobby/page.tsx`
- [Lobby and rankings](https://github.com/yunha2604-hub/battle-study/blob/main/src/components/Lobby.tsx): `src/components/Lobby.tsx`
- [Analytics route](https://github.com/yunha2604-hub/battle-study/blob/main/src/app/analytics/page.tsx): `src/app/analytics/page.tsx`
- [Player analytics](https://github.com/yunha2604-hub/battle-study/blob/main/src/components/PlayerAnalytics.tsx): `src/components/PlayerAnalytics.tsx`

### Battle modes

- [Dungeon route](https://github.com/yunha2604-hub/battle-study/blob/main/src/app/shadow-raid/page.tsx): `src/app/shadow-raid/page.tsx`
- [Battle route](https://github.com/yunha2604-hub/battle-study/blob/main/src/app/battle/page.tsx): `src/app/battle/page.tsx`
- [Quiz battle](https://github.com/yunha2604-hub/battle-study/blob/main/src/components/BattleArena.tsx): `src/components/BattleArena.tsx`
- [Battle confirmation](https://github.com/yunha2604-hub/battle-study/blob/main/src/components/BattleConfirmModal.tsx): `src/components/BattleConfirmModal.tsx`
- [Custom room](https://github.com/yunha2604-hub/battle-study/blob/main/src/components/CustomRoomWaiting.tsx): `src/components/CustomRoomWaiting.tsx`
- [School match route](https://github.com/yunha2604-hub/battle-study/blob/main/src/app/deathmatch/page.tsx): `src/app/deathmatch/page.tsx`
- [School deathmatch](https://github.com/yunha2604-hub/battle-study/blob/main/src/components/SchoolDeathmatchArena.tsx): `src/components/SchoolDeathmatchArena.tsx`
- [Result route](https://github.com/yunha2604-hub/battle-study/blob/main/src/app/result/page.tsx): `src/app/result/page.tsx`
- [Match results](https://github.com/yunha2604-hub/battle-study/blob/main/src/components/ResultPage.tsx): `src/components/ResultPage.tsx`

### Teacher assessment

- [Teacher route](https://github.com/yunha2604-hub/battle-study/blob/main/src/app/teacher/page.tsx): `src/app/teacher/page.tsx`
- [Assessment dashboard](https://github.com/yunha2604-hub/battle-study/blob/main/src/components/TeacherDashboard.tsx): `src/components/TeacherDashboard.tsx`
- [Assessment route](https://github.com/yunha2604-hub/battle-study/blob/main/src/app/assessment-test/page.tsx): `src/app/assessment-test/page.tsx`
- [Assessment exam](https://github.com/yunha2604-hub/battle-study/blob/main/src/components/AssessmentExamView.tsx): `src/components/AssessmentExamView.tsx`

### App coordination

- [Shared app state](https://github.com/yunha2604-hub/battle-study/blob/main/src/context/BattleStudyContext.tsx): `src/context/BattleStudyContext.tsx`
- [Global navigation](https://github.com/yunha2604-hub/battle-study/blob/main/src/components/GlobalHeader.tsx): `src/components/GlobalHeader.tsx`

### Other components

- **Student**
- **Teacher**

## Connections

- Student → Landing route: opens (evidence: `README.md`)
- Teacher → Landing route: opens (evidence: `README.md`)
- Landing route → Landing screen: renders (evidence: `src/app/page.tsx`)
- Landing route → Shared app state: invokes entry (evidence: `src/app/page.tsx`)
- Landing screen → Global navigation: renders (evidence: `src/components/LandingPage.tsx`)
- Shared app state → Battle route: navigates (evidence: `src/context/BattleStudyContext.tsx`)
- Shared app state → Battle confirmation: opens (evidence: `src/context/BattleStudyContext.tsx`)
- Lobby route → Lobby and rankings: renders (evidence: `src/app/lobby/page.tsx`)
- Lobby route → Shared app state: reads state (evidence: `src/app/lobby/page.tsx`)
- Lobby and rankings → Global navigation: renders (evidence: `src/components/Lobby.tsx`)
- Lobby and rankings → Battle confirmation: renders (evidence: `src/components/Lobby.tsx`)
- Lobby and rankings → Player analytics: renders (evidence: `src/components/Lobby.tsx`)
- Lobby and rankings → Dungeon route: offers dungeon (evidence: `README.md`)
- Lobby and rankings → School match route: offers team match (evidence: `README.md`)
- Analytics route → Lobby and rankings: renders (evidence: `src/app/analytics/page.tsx`)
- Dungeon route → Lobby and rankings: renders (evidence: `src/app/shadow-raid/page.tsx`)
- Battle route → Quiz battle: renders (evidence: `src/app/battle/page.tsx`)
- Battle route → Shared app state: reads match state (evidence: `src/app/battle/page.tsx`)
- Quiz battle → Global navigation: renders (evidence: `src/components/BattleArena.tsx`)
- Quiz battle → Shared app state: finishes match (evidence: `src/app/battle/page.tsx`)
- School match route → School deathmatch: renders (evidence: `src/app/deathmatch/page.tsx`)
- School match route → Shared app state: reads state (evidence: `src/app/deathmatch/page.tsx`)
- School deathmatch → Global navigation: renders (evidence: `src/components/SchoolDeathmatchArena.tsx`)
- Result route → Match results: renders (evidence: `src/app/result/page.tsx`)
- Result route → Shared app state: reads results (evidence: `src/app/result/page.tsx`)
- Shared app state → Result route: navigates (evidence: `src/context/BattleStudyContext.tsx`)
- Teacher route → Assessment dashboard: renders (evidence: `src/app/teacher/page.tsx`)
- Teacher route → Shared app state: reads assessment state (evidence: `src/app/teacher/page.tsx`)
- Assessment dashboard → Global navigation: renders (evidence: `src/components/TeacherDashboard.tsx`)
- Assessment dashboard → Assessment route: starts assessment
- Assessment route → Assessment exam: renders (evidence: `src/app/assessment-test/page.tsx`)
- Assessment exam → Assessment dashboard: uses assessment types (evidence: `src/components/AssessmentExamView.tsx`)
- Global navigation → Lobby route: navigates (evidence: `src/components/GlobalHeader.tsx`)
- Global navigation → School match route: navigates (evidence: `src/components/GlobalHeader.tsx`)
- Global navigation → Analytics route: navigates (evidence: `src/components/GlobalHeader.tsx`)
