보일러 플레이팅 레벨

This commit is contained in:
Lectom C Han
2025-07-30 00:23:24 +09:00
commit ba9b7a27ef
30 changed files with 4561 additions and 0 deletions

24
.gitignore vendored Normal file
View File

@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
dist
dist-ssr
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

28
GEMINI.md Normal file
View File

@@ -0,0 +1,28 @@
# Q&A 뷰어 프로젝트
## 1. 프로젝트 개요
- **목표**: Q&A 게시판 데이터를 시각적으로 쉽게 조회할 수 있는 동적 인터페이스를 구축합니다.
- **핵심 아이디어**: 백엔드 API를 통해 데이터 스키마를 동적으로 조회하고, 해당 스키마에 맞춰 테이블, 폼(데이터 생성/수정) 등의 UI를 자동으로 렌더링하여 생산성을 극대화합니다.
## 2. 핵심 기능
- API를 통한 동적 데이터 스키마 조회
- 스키마 기반 동적 테이블 UI 렌더링
- 스키마 기반 동적 폼 UI 렌더링 (데이터 생성/수정)
- OIDC 표준을 이용한 사용자 인증
## 3. 기술 스택
- **Package Manager**: `pnpm`
- **Framework**: `React`
- **Build Tool**: `Vite`
- **Styling**: `Tailwind CSS`
- **UI Components**: `shadcn/ui`
- **State Management**: `Zustand`
- **Formatter/Linter**: `Biome`
## 4. 주요 아키텍처 및 결정 사항
- **인증**: OIDC (OpenID Connect) 표준을 준수하여 인증을 구현합니다.
- **데이터**: PoC(Proof of Concept) 레벨에서는 별도의 데이터베이스를 사용하지 않고, Mock 데이터를 활용하여 핵심 기능 개발에 집중합니다.

50
README.md Normal file
View File

@@ -0,0 +1,50 @@
Tools
search_feedbacks
Searches for feedback entries by channelId
Inputs:
projectId (number): The project ID to search for feedbacks.
channelId (number): The channel ID to search for feedbacks.
searchText (string?): The text to search for in the feedbacks. If not provided, all feedbacks will be returned.
page (number): The page number to retrieve.
limit (number): The number of feedbacks to retrieve per page.
find_issue_by_id
Finds an issue by ID
Inputs:
projectId (number): The project ID to search for feedbacks.
issueId (number): The issue ID to search for feedbacks.
search_issues
Searches for issues by project
Inputs
projectId (number): The project ID to search for feedbacks.
page (number): The page number to retrieve.
limit (number): The number of feedbacks to retrieve per page.
Installation
requirements:
Node.js v20 or later
Step 1: Install the ABC User Feedback
To communicate with the MCP Server, an active ABC User Feedback API server is required.
Step 2: Configure AI Agent
Please add the following configuration for an AI Agent like Claude Desktop or Cline.
Set the environment variables or arguments as follows:
AUF_BASE_URL: (required) ABC User Feedback API base URL.
AUF_API_KEY: (required) ABC User Feedback API key. You can create API Key in Settings page in the User Feedback Admin.
{
"mcpServers": {
"mcp-abc-user-feedback": {
"command": "node",
"args": [
"path/to/index.js"
],
"env": {
"AUF_BASE_URL" : "FILL_HERE",
"AUF_API_KEY" : "FILL_HERE"
}
}
}
}

45
TODO.md Normal file
View File

@@ -0,0 +1,45 @@
# Q&A 뷰어 프로젝트: 할 일 목록
## 🚀 1단계: 프로젝트 초기 설정
- [x] Vite + React + TypeScript 프로젝트 생성 (완료 시간: 2025-07-29T12:00:00)
- [x] pnpm 워크스페이스 설정 (완료 시간: 2025-07-29T12:01:00)
- [x] Biome 포맷터/린터 설정 (완료 시간: 2025-07-29T12:02:00)
- [x] Tailwind CSS 설정 (완료 시간: 2025-07-29T12:03:00)
- [x] shadcn/ui 초기화 및 기본 컴포넌트 추가 (완료 시간: 2025-07-29T12:04:00)
- [x] Zustand 상태 관리 라이브러리 설치 (완료 시간: 2025-07-29T12:05:00)
- [x] pnpm 워크스페이스를 단일 프로젝트 구조로 변경 (viewer를 루트로 설정) (완료 시간: 2025-07-29T12:06:00)
## 🏗️ 2단계: 핵심 기능 개발
- [x] Vite 프록시를 이용한 동적 API 서비스 모듈 구현 (완료 시간: 2025-07-29T12:08:00)
- [x] React Router를 이용한 동적 라우팅 설정 (완료 시간: 2025-07-29T12:09:00)
- [x] 피드백 페이지 기능 구현 (완료 시간: 2025-07-30T00:15:00)
- `feedback.ts` 서비<EC849C><EBB984><EFBFBD>: 피드백 생성/조회, 이슈 검색 API 연동
- `FeedbackPage.tsx`: 피드백 생성 폼 및 목록 UI 구현
- [ ] 스키마 기반 동적 테이블 컴포넌트 개발
- [ ] 스키마 기반 동적 폼 컴포넌트 개발
- [ ] 데이터 목록 조회 페이지 구현
- [ ] 데이터 상세 조회/수정 페이지 구현
## 🔐 3단계: 인증 기능 개발
- [ ] OIDC 클라이언트 라이브러리 설치 및 설정
- [ ] 로그인/로그아웃 기능 구현
- [ ] 인증 상태에 따른 라우팅 처리 (Public/Private Routes)
## ✨ 4단계: 리팩토링 및 환경 개선
- [x] 빌드 및 스타일링 환경 안정화 (완료 시간: 2025-07-30T00:10:00)
- Tailwind CSS v4 -> v3 다운그레이드
- PostCSS 설정을 `vite.config.ts`에 통합하여 빌드 오류 해결
- `shadcn/ui` 경로 별칭 문제 및 테마 설정 복구
- [x] 설정 파일 TypeScript 마이그레이션 (완료 시간: 2025-07-30T00:05:00)
- `tailwind.config.ts`, `postcss.config.ts`로 전환
- [x] 피드백 페이지 UI 개선 (완료 시간: 2025-07-30T00:15:00)
- `Card`, `Separator` 컴포넌트를 활용한 레이아웃 재구성
- [x] 개발 환경 개선 (완료 시간: 2025-07-30T00:20:00)
- `.env.example` 파일 추가
- [ ] 전역 레이아웃 및 네비게이션 UI 개선
- [ ] 예외 처리 및 로딩/에러 상태 UI 구현
- [ ] 최종 코드 리뷰 및 리팩토링

11
viewer/.env.example Normal file
View File

@@ -0,0 +1,11 @@
# API 서버의 기본 URL
VITE_API_BASE_URL=API_BASE_URL
# API 요청 시 필요한 인증 키
VITE_API_KEY=
# 기본으로 사용할 프로젝트 ID
VITE_DEFAULT_PROJECT_ID=1
# 기본으로 사용할 채널 ID
VITE_DEFAULT_CHANNEL_ID=4

69
viewer/README.md Normal file
View File

@@ -0,0 +1,69 @@
# React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
## Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
```js
export default tseslint.config([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Remove tseslint.configs.recommended and replace with this
...tseslint.configs.recommendedTypeChecked,
// Alternatively, use this for stricter rules
...tseslint.configs.strictTypeChecked,
// Optionally, add this for stylistic rules
...tseslint.configs.stylisticTypeChecked,
// Other configs...
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
```js
// eslint.config.js
import reactX from 'eslint-plugin-react-x'
import reactDom from 'eslint-plugin-react-dom'
export default tseslint.config([
globalIgnores(['dist']),
{
files: ['**/*.{ts,tsx}'],
extends: [
// Other configs...
// Enable lint rules for React
reactX.configs['recommended-typescript'],
// Enable lint rules for React DOM
reactDom.configs.recommended,
],
languageOptions: {
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
// other options...
},
},
])
```

34
viewer/biome.json Normal file
View File

@@ -0,0 +1,34 @@
{
"$schema": "https://biomejs.dev/schemas/2.1.2/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false
},
"formatter": {
"enabled": true,
"indentStyle": "tab"
},
"linter": {
"enabled": true,
"rules": {
"recommended": true
}
},
"javascript": {
"formatter": {
"quoteStyle": "double"
}
},
"assist": {
"enabled": true,
"actions": {
"source": {
"organizeImports": "on"
}
}
}
}

16
viewer/components.json Normal file
View File

@@ -0,0 +1,16 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.ts",
"css": "src/index.css",
"baseColor": "neutral",
"cssVariables": true
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}

13
viewer/index.html Normal file
View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>

45
viewer/package.json Normal file
View File

@@ -0,0 +1,45 @@
{
"name": "viewer",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"format": "biome format --write .",
"lint": "biome lint --apply .",
"preview": "vite preview",
"shadcn": "shadcn-ui"
},
"dependencies": {
"@radix-ui/react-separator": "^1.1.7",
"@radix-ui/react-slot": "^1.2.3",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"lucide-react": "^0.533.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-router-dom": "^7.7.1",
"tailwind-merge": "^3.3.1",
"zustand": "^5.0.6"
},
"devDependencies": {
"@biomejs/biome": "^2.1.2",
"@eslint/js": "^9.30.1",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"@vitejs/plugin-react": "^4.6.0",
"autoprefixer": "^10.4.21",
"eslint": "^9.30.1",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.20",
"globals": "^16.3.0",
"postcss": "^8.5.6",
"tailwindcss": "^3.4.17",
"tailwindcss-animate": "^1.0.7",
"tw-animate-css": "^1.3.6",
"typescript": "~5.8.3",
"typescript-eslint": "^8.35.1",
"vite": "^7.0.4"
}
}

3293
viewer/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

1
viewer/public/vite.svg Normal file
View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

35
viewer/src/App.tsx Normal file
View File

@@ -0,0 +1,35 @@
// src/App.tsx
import {
BrowserRouter,
Routes,
Route,
Navigate,
} from 'react-router-dom';
import { FeedbackPage } from '@/pages/FeedbackPage';
function App() {
const defaultProjectId = import.meta.env.VITE_DEFAULT_PROJECT_ID || 'default';
const defaultChannelId = import.meta.env.VITE_DEFAULT_CHANNEL_ID || 'general';
return (
<BrowserRouter>
<Routes>
<Route
path="/projects/:projectId/channels/:channelId"
element={<FeedbackPage />}
/>
{/* .env.local에 설정된 기본 프로젝트/채널로 리디렉션합니다. */}
<Route
path="/"
element={
<Navigate
to={`/projects/${defaultProjectId}/channels/${defaultChannelId}`}
/>
}
/>
</Routes>
</BrowserRouter>
);
}
export default App;

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -0,0 +1,59 @@
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/lib/utils";
const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
{
variants: {
variant: {
default:
"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
destructive:
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
outline:
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
secondary:
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
ghost:
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-9 px-4 py-2 has-[>svg]:px-3",
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
icon: "size-9",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
},
);
function Button({
className,
variant,
size,
asChild = false,
...props
}: React.ComponentProps<"button"> &
VariantProps<typeof buttonVariants> & {
asChild?: boolean;
}) {
const Comp = asChild ? Slot : "button";
return (
<Comp
data-slot="button"
className={cn(buttonVariants({ variant, size, className }))}
{...props}
/>
);
}
export { Button, buttonVariants };

View File

@@ -0,0 +1,92 @@
import * as React from "react"
import { cn } from "@/lib/utils"
function Card({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card"
className={cn(
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
className
)}
{...props}
/>
)
}
function CardHeader({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-header"
className={cn(
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
className
)}
{...props}
/>
)
}
function CardTitle({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-title"
className={cn("leading-none font-semibold", className)}
{...props}
/>
)
}
function CardDescription({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-description"
className={cn("text-muted-foreground text-sm", className)}
{...props}
/>
)
}
function CardAction({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-action"
className={cn(
"col-start-2 row-span-2 row-start-1 self-start justify-self-end",
className
)}
{...props}
/>
)
}
function CardContent({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-content"
className={cn("px-6", className)}
{...props}
/>
)
}
function CardFooter({ className, ...props }: React.ComponentProps<"div">) {
return (
<div
data-slot="card-footer"
className={cn("flex items-center px-6 [.border-t]:pt-6", className)}
{...props}
/>
)
}
export {
Card,
CardHeader,
CardFooter,
CardTitle,
CardAction,
CardDescription,
CardContent,
}

View File

@@ -0,0 +1,21 @@
import * as React from "react"
import { cn } from "@/lib/utils"
function Input({ className, type, ...props }: React.ComponentProps<"input">) {
return (
<input
type={type}
data-slot="input"
className={cn(
"file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
className
)}
{...props}
/>
)
}
export { Input }

View File

@@ -0,0 +1,26 @@
import * as React from "react"
import * as SeparatorPrimitive from "@radix-ui/react-separator"
import { cn } from "@/lib/utils"
function Separator({
className,
orientation = "horizontal",
decorative = true,
...props
}: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
return (
<SeparatorPrimitive.Root
data-slot="separator"
decorative={decorative}
orientation={orientation}
className={cn(
"bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
className
)}
{...props}
/>
)
}
export { Separator }

View File

@@ -0,0 +1,18 @@
import * as React from "react"
import { cn } from "@/lib/utils"
function Textarea({ className, ...props }: React.ComponentProps<"textarea">) {
return (
<textarea
data-slot="textarea"
className={cn(
"border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
className
)}
{...props}
/>
)
}
export { Textarea }

123
viewer/src/index.css Normal file
View File

@@ -0,0 +1,123 @@
@import "tw-animate-css";
@custom-variant dark (&:is(.dark *));
@tailwind base;
@tailwind components;
@tailwind utilities;
@theme inline {
--radius-sm: calc(var(--radius) - 4px);
--radius-md: calc(var(--radius) - 2px);
--radius-lg: var(--radius);
--radius-xl: calc(var(--radius) + 4px);
--color-background: var(--background);
--color-foreground: var(--foreground);
--color-card: var(--card);
--color-card-foreground: var(--card-foreground);
--color-popover: var(--popover);
--color-popover-foreground: var(--popover-foreground);
--color-primary: var(--primary);
--color-primary-foreground: var(--primary-foreground);
--color-secondary: var(--secondary);
--color-secondary-foreground: var(--secondary-foreground);
--color-muted: var(--muted);
--color-muted-foreground: var(--muted-foreground);
--color-accent: var(--accent);
--color-accent-foreground: var(--accent-foreground);
--color-destructive: var(--destructive);
--color-border: var(--border);
--color-input: var(--input);
--color-ring: var(--ring);
--color-chart-1: var(--chart-1);
--color-chart-2: var(--chart-2);
--color-chart-3: var(--chart-3);
--color-chart-4: var(--chart-4);
--color-chart-5: var(--chart-5);
--color-sidebar: var(--sidebar);
--color-sidebar-foreground: var(--sidebar-foreground);
--color-sidebar-primary: var(--sidebar-primary);
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
--color-sidebar-accent: var(--sidebar-accent);
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
--color-sidebar-border: var(--sidebar-border);
--color-sidebar-ring: var(--sidebar-ring);
}
:root {
--radius: 0.625rem;
--background: oklch(1 0 0);
--foreground: oklch(0.145 0 0);
--card: oklch(1 0 0);
--card-foreground: oklch(0.145 0 0);
--popover: oklch(1 0 0);
--popover-foreground: oklch(0.145 0 0);
--primary: oklch(0.205 0 0);
--primary-foreground: oklch(0.985 0 0);
--secondary: oklch(0.97 0 0);
--secondary-foreground: oklch(0.205 0 0);
--muted: oklch(0.97 0 0);
--muted-foreground: oklch(0.556 0 0);
--accent: oklch(0.97 0 0);
--accent-foreground: oklch(0.205 0 0);
--destructive: oklch(0.577 0.245 27.325);
--border: oklch(0.922 0 0);
--input: oklch(0.922 0 0);
--ring: oklch(0.708 0 0);
--chart-1: oklch(0.646 0.222 41.116);
--chart-2: oklch(0.6 0.118 184.704);
--chart-3: oklch(0.398 0.07 227.392);
--chart-4: oklch(0.828 0.189 84.429);
--chart-5: oklch(0.769 0.188 70.08);
--sidebar: oklch(0.985 0 0);
--sidebar-foreground: oklch(0.145 0 0);
--sidebar-primary: oklch(0.205 0 0);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.97 0 0);
--sidebar-accent-foreground: oklch(0.205 0 0);
--sidebar-border: oklch(0.922 0 0);
--sidebar-ring: oklch(0.708 0 0);
}
.dark {
--background: oklch(0.145 0 0);
--foreground: oklch(0.985 0 0);
--card: oklch(0.205 0 0);
--card-foreground: oklch(0.985 0 0);
--popover: oklch(0.205 0 0);
--popover-foreground: oklch(0.985 0 0);
--primary: oklch(0.922 0 0);
--primary-foreground: oklch(0.205 0 0);
--secondary: oklch(0.269 0 0);
--secondary-foreground: oklch(0.985 0 0);
--muted: oklch(0.269 0 0);
--muted-foreground: oklch(0.708 0 0);
--accent: oklch(0.269 0 0);
--accent-foreground: oklch(0.985 0 0);
--destructive: oklch(0.704 0.191 22.216);
--border: oklch(1 0 0 / 10%);
--input: oklch(1 0 0 / 15%);
--ring: oklch(0.556 0 0);
--chart-1: oklch(0.488 0.243 264.376);
--chart-2: oklch(0.696 0.17 162.48);
--chart-3: oklch(0.769 0.188 70.08);
--chart-4: oklch(0.627 0.265 303.9);
--chart-5: oklch(0.645 0.246 16.439);
--sidebar: oklch(0.205 0 0);
--sidebar-foreground: oklch(0.985 0 0);
--sidebar-primary: oklch(0.488 0.243 264.376);
--sidebar-primary-foreground: oklch(0.985 0 0);
--sidebar-accent: oklch(0.269 0 0);
--sidebar-accent-foreground: oklch(0.985 0 0);
--sidebar-border: oklch(1 0 0 / 10%);
--sidebar-ring: oklch(0.556 0 0);
}
@layer base {
* {
@apply border-border outline-ring/50;
}
body {
@apply bg-background text-foreground;
}
}

6
viewer/src/lib/utils.ts Normal file
View File

@@ -0,0 +1,6 @@
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

10
viewer/src/main.tsx Normal file
View File

@@ -0,0 +1,10 @@
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./index.css";
import App from "./App.tsx";
createRoot(document.getElementById("root")!).render(
<StrictMode>
<App />
</StrictMode>,
);

View File

@@ -0,0 +1,230 @@
// src/pages/FeedbackPage.tsx
import { useEffect, useState, useCallback } from "react";
import { useParams } from "react-router-dom";
import {
getFeedbacks,
createFeedback,
searchIssues,
type Feedback,
type Issue,
} from "@/services/feedback";
import { Button } from "@/components/ui/button";
import { Textarea } from "@/components/ui/textarea";
import { Input } from "@/components/ui/input";
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card";
import { Separator } from "@/components/ui/separator";
// 디바운스 훅
function useDebounce(value: string, delay: number) {
const [debouncedValue, setDebouncedValue] = useState(value);
useEffect(() => {
const handler = setTimeout(() => {
setDebouncedValue(value);
}, delay);
return () => {
clearTimeout(handler);
};
}, [value, delay]);
return debouncedValue;
}
export function FeedbackPage() {
const { projectId, channelId } = useParams<{
projectId: string;
channelId: string;
}>();
const [feedbacks, setFeedbacks] = useState<Feedback[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
// 피드백 생성 폼 상태
const [message, setMessage] = useState("");
const [issueSearch, setIssueSearch] = useState("");
const [searchedIssues, setSearchedIssues] = useState<Issue[]>([]);
const [selectedIssues, setSelectedIssues] = useState<Issue[]>([]);
const [isSubmitting, setIsSubmitting] = useState(false);
const debouncedSearchTerm = useDebounce(issueSearch, 500);
const fetchFeedbacks = useCallback(async () => {
if (!projectId || !channelId) return;
try {
setLoading(true);
const data = await getFeedbacks(projectId, channelId);
setFeedbacks(data);
setError(null);
} catch (err) {
setError("피드백을 불러오지 못했습니다.");
console.error(err);
} finally {
setLoading(false);
}
}, [projectId, channelId]);
useEffect(() => {
fetchFeedbacks();
}, [fetchFeedbacks]);
useEffect(() => {
if (debouncedSearchTerm && projectId) {
searchIssues(projectId, debouncedSearchTerm).then(setSearchedIssues);
} else {
setSearchedIssues([]);
}
}, [debouncedSearchTerm, projectId]);
const handleCreateFeedback = async () => {
if (!projectId || !channelId || !message || selectedIssues.length === 0) {
alert("메시지를 입력하고, 하나 이상의 이슈를 선택해주세요.");
return;
}
setIsSubmitting(true);
try {
await createFeedback(projectId, channelId, {
message,
issueNames: selectedIssues.map((issue) => issue.name),
});
setMessage("");
setIssueSearch("");
setSelectedIssues([]);
setSearchedIssues([]);
await fetchFeedbacks(); // 목록 새로고침
} catch (err) {
setError("피드백 생성에 실패했습니다.");
console.error(err);
} finally {
setIsSubmitting(false);
}
};
const toggleIssueSelection = (issue: Issue) => {
setSelectedIssues((prev) =>
prev.some((i) => i.id === issue.id)
? prev.filter((i) => i.id !== issue.id)
: [...prev, issue],
);
setIssueSearch("");
setSearchedIssues([]);
};
return (
<div className="container mx-auto p-4 md:p-8">
<header className="mb-8">
<h1 className="text-3xl font-bold tracking-tight"></h1>
<p className="text-muted-foreground mt-1">
: {projectId} / : {channelId}
</p>
</header>
<div className="grid gap-8">
<Card>
<CardHeader>
<CardTitle> </CardTitle>
<CardDescription>
.
</CardDescription>
</CardHeader>
<CardContent className="space-y-4">
<Textarea
placeholder="피드백 메시지를 입력하세요..."
value={message}
onChange={(e) => setMessage(e.target.value)}
rows={5}
/>
<div className="relative">
<Input
placeholder="연결할 이슈 이름 검색..."
value={issueSearch}
onChange={(e) => setIssueSearch(e.target.value)}
/>
{searchedIssues.length > 0 && (
<Card className="absolute w-full mt-2 z-10">
<CardContent className="p-0">
<ul className="max-h-48 overflow-y-auto">
{searchedIssues.map((issue, index) => (
<li key={issue.id}>
<button
type="button"
className={`w-full text-left p-3 text-sm hover:bg-accent ${
selectedIssues.some((i) => i.id === issue.id)
? "bg-muted"
: ""
}`}
onClick={() => toggleIssueSelection(issue)}
>
{issue.name}
</button>
{index < searchedIssues.length - 1 && (
<Separator />
)}
</li>
))}
</ul>
</CardContent>
</Card>
)}
</div>
{selectedIssues.length > 0 && (
<div>
<h3 className="text-sm font-medium mb-2"> :</h3>
<div className="flex flex-wrap gap-2">
{selectedIssues.map((issue) => (
<span
key={issue.id}
className="bg-secondary text-secondary-foreground px-3 py-1 rounded-full text-sm"
>
{issue.name}
</span>
))}
</div>
</div>
)}
</CardContent>
<CardFooter>
<Button onClick={handleCreateFeedback} disabled={isSubmitting}>
{isSubmitting ? "제출 중..." : "피드백 제출"}
</Button>
</CardFooter>
</Card>
<Card>
<CardHeader>
<CardTitle> </CardTitle>
<CardDescription>
.
</CardDescription>
</CardHeader>
<CardContent>
{loading && <p> ...</p>}
{error && <p className="text-destructive">{error}</p>}
{!loading && !error && (
<ul className="space-y-4">
{feedbacks.map((feedback, index) => (
<li key={feedback.id}>
<div className="p-4 border rounded-md bg-background">
<p>{feedback.content}</p>
{/* 피드백에 연결된 이슈 등 추가 정보 표시 가능 */}
</div>
{index < feedbacks.length - 1 && <Separator className="my-4" />}
</li>
))}
{feedbacks.length === 0 && (
<p className="text-muted-foreground text-center">
.
</p>
)}
</ul>
)}
</CardContent>
</Card>
</div>
</div>
);
}

View File

@@ -0,0 +1,105 @@
// src/services/feedback.ts
// API 응답과 요청 본문에 대한 타입을 정의합니다.
// 실제 API 명세에 따라 더 구체적으로 작성할 수 있습니다.
export interface Feedback {
id: string;
content: string;
// ... 다른 필드들
}
export interface Issue {
id: string;
name: string;
}
export interface CreateFeedbackRequest {
message: string;
issueNames: string[];
}
const getApiBaseUrl = (projectId: string, channelId:string) =>
`/api/projects/${projectId}/channels/${channelId}/feedbacks`;
/**
* 특정 채널의 피드백 목록을 조회합니다.
* @param projectId 프로젝트 ID
* @param channelId 채널 ID
* @returns 피드백 목록 Promise
*/
export const getFeedbacks = async (
projectId: string,
channelId: string,
): Promise<Feedback[]> => {
const url = getApiBaseUrl(projectId, channelId);
const response = await fetch(url);
if (!response.ok) {
throw new Error("피드백 목록을 불러오는 데 실패했습니다.");
}
return response.json();
};
/**
* 특정 채널에 새로운 피드백을 생성합니다.
* @param projectId 프로젝트 ID
* @param channelId 채널 ID
* @param feedbackData 생성할 피드백 데이터
* @returns 생성된 피드백 Promise
*/
export const createFeedback = async (
projectId: string,
channelId: string,
feedbackData: CreateFeedbackRequest,
): Promise<Feedback> => {
const url = getApiBaseUrl(projectId, channelId);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(feedbackData),
});
if (!response.ok) {
throw new Error("피드백 생성에 실패했습니다.");
}
return response.json();
};
/**
* 프로젝트의 이슈를 검색합니다.
* @param projectId 프로젝트 ID
* @param query 검색어
* @returns 이슈 목록 Promise
*/
export const searchIssues = async (
projectId: string,
query: string,
): Promise<Issue[]> => {
const url = `/api/projects/${projectId}/issues/search`;
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
query: { name: query },
limit: 10,
page: 1,
sort: { createdAt: "ASC" },
}),
});
if (!response.ok) {
throw new Error("이슈 검색에 실패했습니다.");
}
const result = await response.json();
// API 응답이 { items: Issue[] } 형태일 경우를 가정
return result.items || [];
};
// 여기에 다른 API 함수들을 추가할 수 있습니다. (예: updateFeedback, deleteFeedback)

1
viewer/src/vite-env.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
/// <reference types="vite/client" />

80
viewer/tailwind.config.ts Normal file
View File

@@ -0,0 +1,80 @@
import type { Config } from "tailwindcss";
import tailwindcssAnimate from "tailwindcss-animate";
const config: Config = {
darkMode: ["class"],
content: [
"./pages/**/*.{ts,tsx}",
"./components/**/*.{ts,tsx}",
"./app/**/*.{ts,tsx}",
"./src/**/*.{ts,tsx}",
],
theme: {
container: {
center: true,
padding: "2rem",
screens: {
"2xl": "1400px",
},
},
extend: {
colors: {
border: "hsl(var(--border))",
input: "hsl(var(--input))",
ring: "hsl(var(--ring))",
background: "hsl(var(--background))",
foreground: "hsl(var(--foreground))",
primary: {
DEFAULT: "hsl(var(--primary))",
foreground: "hsl(var(--primary-foreground))",
},
secondary: {
DEFAULT: "hsl(var(--secondary))",
foreground: "hsl(var(--secondary-foreground))",
},
destructive: {
DEFAULT: "hsl(var(--destructive))",
foreground: "hsl(var(--destructive-foreground))",
},
muted: {
DEFAULT: "hsl(var(--muted))",
foreground: "hsl(var(--muted-foreground))",
},
accent: {
DEFAULT: "hsl(var(--accent))",
foreground: "hsl(var(--accent-foreground))",
},
popover: {
DEFAULT: "hsl(var(--popover))",
foreground: "hsl(var(--popover-foreground))",
},
card: {
DEFAULT: "hsl(var(--card))",
foreground: "hsl(var(--card-foreground))",
},
},
borderRadius: {
lg: "var(--radius)",
md: "calc(var(--radius) - 2px)",
sm: "calc(var(--radius) - 4px)",
},
keyframes: {
"accordion-down": {
from: { height: "0" },
to: { height: "var(--radix-accordion-content-height)" },
},
"accordion-up": {
from: { height: "var(--radix-accordion-content-height)" },
to: { height: "0" },
},
},
animation: {
"accordion-down": "accordion-down 0.2s ease-out",
"accordion-up": "accordion-up 0.2s ease-out",
},
},
},
plugins: [tailwindcssAnimate],
};
export default config;

31
viewer/tsconfig.app.json Normal file
View File

@@ -0,0 +1,31 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
"target": "ES2022",
"useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
"jsx": "react-jsx",
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["src"]
}

32
viewer/tsconfig.json Normal file
View File

@@ -0,0 +1,32 @@
{
"compilerOptions": {
"target": "ES2022",
"useDefineForClassFields": true,
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
]
}
},
"include": ["src"],
"references": [{ "path": "./tsconfig.node.json" }]
}

25
viewer/tsconfig.node.json Normal file
View File

@@ -0,0 +1,25 @@
{
"compilerOptions": {
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
"target": "ES2023",
"lib": ["ES2023"],
"module": "ESNext",
"skipLibCheck": true,
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"moduleDetection": "force",
"noEmit": true,
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"erasableSyntaxOnly": true,
"noFallthroughCasesInSwitch": true,
"noUncheckedSideEffectImports": true
},
"include": ["vite.config.ts"]
}

37
viewer/vite.config.ts Normal file
View File

@@ -0,0 +1,37 @@
import path from "path";
import react from "@vitejs/plugin-react";
import { defineConfig, loadEnv } from "vite";
import tailwindcss from "tailwindcss";
import autoprefixer from "autoprefixer";
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");
return {
plugins: [react()],
css: {
postcss: {
plugins: [tailwindcss, autoprefixer],
},
},
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
},
},
server: {
proxy: {
"/api": {
target: "https://feedback.hmac.kr",
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, "/_api"),
configure: (proxy, options) => {
proxy.on("proxyReq", (proxyReq, req, res) => {
proxyReq.setHeader("X_API_KEY", env.VITE_API_KEY);
});
},
},
},
},
};
});