# ahin99/oop_hw2 architecture

> Architecture diagram of the GitHub repository ahin99/oop_hw2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ahin99/oop_hw2
- Repository: https://github.com/ahin99/oop_hw2

## Overview

Character OOP Visualizer is a client-side Next.js app for exploring class inheritance and character behavior. Users choose a class in the inheritance panel, create characters, then manage them on a board: attack with an item, level up, or delete. The page owns character and code-view state, invokes the attack rules, and supplies generated snippets and outcomes to the code panel. The README also documents class defaults, polymorphic special-item attacks, and UML viewing. Edges reflect shown callbacks and imports; unsampled board and modal wiring is omitted where the excerpts do not establish it.

Main entry points: [`app/page.tsx`](https://github.com/ahin99/oop_hw2/blob/main/app/page.tsx) (App workflow), [`lib/characterRules.ts`](https://github.com/ahin99/oop_hw2/blob/main/lib/characterRules.ts) (Character rules), [`components/ProfileAvatar.tsx`](https://github.com/ahin99/oop_hw2/blob/main/components/ProfileAvatar.tsx) (Profile avatar), [`components/CreateCharacterModal.tsx`](https://github.com/ahin99/oop_hw2/blob/main/components/CreateCharacterModal.tsx) (Create modal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Character interface"]
  node_page["App workflow<br/>[page.tsx]"]
  node_inheritance["Inheritance panel"]
  node_board["Character board<br/>[CharacterBoard.tsx]"]
  node_card["Character card<br/>[CharacterCard.tsx]"]
  node_create["Create modal"]
  node_attack["Attack modal<br/>[AttackModal.tsx]"]
  node_levelup["Level-up modal<br/>[LevelUpModal.tsx]"]
  node_delete["Delete modal"]
  node_avatar["Profile avatar<br/>[ProfileAvatar.tsx]"]
  node_uml["UML diagram<br/>[uml-diagram.pdf]"]
end

subgraph group_domain["Character behavior"]
  node_rules["Character rules<br/>[characterRules.ts]"]
  node_types["Domain types<br/>[types.ts]"]
end

subgraph group_presentation["Execution explanation"]
  node_snippets["Code snippets<br/>[codeSnippets.ts]"]
  node_viewer["Code viewer<br/>[CodeViewer.tsx]"]
end

node_user(("User"))

node_user -->|"uses"| node_page
node_page -->|"renders"| node_inheritance
node_page -->|"renders"| node_board
node_page -->|"renders"| node_viewer
node_page -.->|"renders"| node_attack
node_page -.->|"renders"| node_create
node_page -.->|"renders"| node_levelup
node_page -.->|"renders"| node_delete
node_page -->|"calculates attacks"| node_rules
node_page -->|"builds code view"| node_snippets
node_inheritance -->|"requests creation"| node_page
node_inheritance -->|"embeds diagram"| node_uml
node_board -->|"renders"| node_card
node_card -->|"renders"| node_avatar
node_create -->|"renders"| node_avatar
node_attack -->|"renders"| node_avatar
node_levelup -->|"renders"| node_avatar
node_delete -->|"renders"| node_avatar
node_attack -->|"submits attack"| node_page
node_levelup -->|"submits level-up"| node_page
node_delete -.->|"confirms deletion"| node_page
node_create -->|"submits character"| node_page
node_attack -->|"uses item options"| node_rules
node_create -->|"uses defaults"| node_rules
node_page -->|"passes view state"| node_viewer
node_rules -->|"provides class defaults"| node_snippets
node_viewer -->|"reads view type"| node_types
node_rules -->|"uses domain types"| node_types

click node_page "https://github.com/ahin99/oop_hw2/blob/main/app/page.tsx"
click node_inheritance "https://github.com/ahin99/oop_hw2/blob/main/components/InheritancePanel.tsx"
click node_board "https://github.com/ahin99/oop_hw2/blob/main/components/CharacterBoard.tsx"
click node_card "https://github.com/ahin99/oop_hw2/blob/main/components/CharacterCard.tsx"
click node_create "https://github.com/ahin99/oop_hw2/blob/main/components/CreateCharacterModal.tsx"
click node_attack "https://github.com/ahin99/oop_hw2/blob/main/components/AttackModal.tsx"
click node_levelup "https://github.com/ahin99/oop_hw2/blob/main/components/LevelUpModal.tsx"
click node_delete "https://github.com/ahin99/oop_hw2/blob/main/components/DeleteCharacterModal.tsx"
click node_avatar "https://github.com/ahin99/oop_hw2/blob/main/components/ProfileAvatar.tsx"
click node_rules "https://github.com/ahin99/oop_hw2/blob/main/lib/characterRules.ts"
click node_types "https://github.com/ahin99/oop_hw2/blob/main/lib/types.ts"
click node_snippets "https://github.com/ahin99/oop_hw2/blob/main/lib/codeSnippets.ts"
click node_viewer "https://github.com/ahin99/oop_hw2/blob/main/components/CodeViewer.tsx"
click node_uml "https://github.com/ahin99/oop_hw2/blob/main/public/uml-diagram.pdf"

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_page,node_inheritance,node_board,node_card,node_create,node_attack,node_levelup,node_delete,node_avatar,node_uml,node_user toneBlue
class node_rules,node_types toneAmber
class node_snippets,node_viewer toneMint
```

## Components

### Character interface

- [App workflow](https://github.com/ahin99/oop_hw2/blob/main/app/page.tsx): `app/page.tsx`
- [Inheritance panel](https://github.com/ahin99/oop_hw2/blob/main/components/InheritancePanel.tsx): `components/InheritancePanel.tsx`
- [Character board](https://github.com/ahin99/oop_hw2/blob/main/components/CharacterBoard.tsx): `components/CharacterBoard.tsx`
- [Character card](https://github.com/ahin99/oop_hw2/blob/main/components/CharacterCard.tsx): `components/CharacterCard.tsx`
- [Create modal](https://github.com/ahin99/oop_hw2/blob/main/components/CreateCharacterModal.tsx): `components/CreateCharacterModal.tsx`
- [Attack modal](https://github.com/ahin99/oop_hw2/blob/main/components/AttackModal.tsx): `components/AttackModal.tsx`
- [Level-up modal](https://github.com/ahin99/oop_hw2/blob/main/components/LevelUpModal.tsx): `components/LevelUpModal.tsx`
- [Delete modal](https://github.com/ahin99/oop_hw2/blob/main/components/DeleteCharacterModal.tsx): `components/DeleteCharacterModal.tsx`
- [Profile avatar](https://github.com/ahin99/oop_hw2/blob/main/components/ProfileAvatar.tsx): `components/ProfileAvatar.tsx`
- [UML diagram](https://github.com/ahin99/oop_hw2/blob/main/public/uml-diagram.pdf): `public/uml-diagram.pdf`

### Character behavior

- [Character rules](https://github.com/ahin99/oop_hw2/blob/main/lib/characterRules.ts): `lib/characterRules.ts`
- [Domain types](https://github.com/ahin99/oop_hw2/blob/main/lib/types.ts): `lib/types.ts`

### Execution explanation

- [Code snippets](https://github.com/ahin99/oop_hw2/blob/main/lib/codeSnippets.ts): `lib/codeSnippets.ts`
- [Code viewer](https://github.com/ahin99/oop_hw2/blob/main/components/CodeViewer.tsx): `components/CodeViewer.tsx`

### Other components

- **User**

## Connections

- User → App workflow: uses (evidence: `README.md`)
- App workflow → Inheritance panel: renders (evidence: `app/page.tsx`)
- App workflow → Character board: renders (evidence: `app/page.tsx`)
- App workflow → Code viewer: renders (evidence: `app/page.tsx`)
- App workflow → Attack modal: renders (evidence: `app/page.tsx`)
- App workflow → Create modal: renders (evidence: `app/page.tsx`)
- App workflow → Level-up modal: renders (evidence: `app/page.tsx`)
- App workflow → Delete modal: renders (evidence: `app/page.tsx`)
- App workflow → Character rules: calculates attacks (evidence: `app/page.tsx`)
- App workflow → Code snippets: builds code view (evidence: `app/page.tsx`)
- Inheritance panel → App workflow: requests creation (evidence: `components/InheritancePanel.tsx`)
- Inheritance panel → UML diagram: embeds diagram (evidence: `components/InheritancePanel.tsx`)
- Character board → Character card: renders (evidence: `components/CharacterBoard.tsx`)
- Character card → Profile avatar: renders (evidence: `components/CharacterCard.tsx`)
- Create modal → Profile avatar: renders (evidence: `components/CreateCharacterModal.tsx`)
- Attack modal → Profile avatar: renders (evidence: `components/AttackModal.tsx`)
- Level-up modal → Profile avatar: renders (evidence: `components/LevelUpModal.tsx`)
- Delete modal → Profile avatar: renders (evidence: `components/DeleteCharacterModal.tsx`)
- Attack modal → App workflow: submits attack (evidence: `components/AttackModal.tsx`)
- Level-up modal → App workflow: submits level-up (evidence: `components/LevelUpModal.tsx`)
- Delete modal → App workflow: confirms deletion (evidence: `app/page.tsx`)
- Create modal → App workflow: submits character (evidence: `components/CreateCharacterModal.tsx`)
- Attack modal → Character rules: uses item options (evidence: `components/AttackModal.tsx`)
- Create modal → Character rules: uses defaults (evidence: `components/CreateCharacterModal.tsx`)
- App workflow → Code viewer: passes view state (evidence: `app/page.tsx`)
- Character rules → Code snippets: provides class defaults (evidence: `lib/codeSnippets.ts`)
- Code viewer → Domain types: reads view type (evidence: `components/CodeViewer.tsx`)
- Character rules → Domain types: uses domain types (evidence: `lib/characterRules.ts`)
