"use client"; import React from "react"; import { ChartDataSource } from "../types"; import { Card } from "@/components/ui/card"; import { Database, Globe } from "lucide-react"; interface DataSourceSelectorProps { dataSource: ChartDataSource; onTypeChange: (type: "database" | "api") => void; } /** * 데이터 소스 선택 컴포넌트 * - DB vs API 선택 * - 큰 카드 UI로 직관적인 선택 */ export function DataSourceSelector({ dataSource, onTypeChange }: DataSourceSelectorProps) { return (

1단계: 데이터 소스 선택

차트에 표시할 데이터를 어디서 가져올지 선택하세요

{/* 데이터베이스 옵션 */} onTypeChange("database")} >

데이터베이스

SQL 쿼리로 데이터 조회

✓ 현재 DB 또는 외부 DB
✓ SELECT 쿼리 지원
✓ 실시간 데이터 조회
{/* REST API 옵션 */} onTypeChange("api")} >

REST API

외부 API에서 데이터 가져오기

✓ GET 요청 지원
✓ JSON 응답 파싱
✓ 커스텀 헤더 설정
{/* 선택된 타입 표시 */} {dataSource.type && (
선택됨: {dataSource.type === "database" ? "🗄️ 데이터베이스" : "🌐 REST API"}
)}
); }