/**
* 봇 카드 컴포넌트
*/
import { memo } from 'react';
import { motion } from 'framer-motion';
import { Play, Square, RefreshCw, RotateCcw, Pencil, Trash2 } from 'lucide-react';
import { Tooltip } from '@/components/common';
// X 아이콘 컴포넌트
export const XIcon = ({ size = 20, fill = 'currentColor' }) => (
);
// Meilisearch 아이콘 컴포넌트
export const MeilisearchIcon = ({ size = 20 }) => (
);
/**
* 리스트형 봇 (Meilisearch용) - 한 줄에 모든 정보
*/
export const BotListItem = memo(function BotListItem({
bot,
index,
isInitialLoad,
syncing,
statusInfo,
onSync,
onToggle,
onAnimationComplete,
formatTime,
formatInterval,
}) {
return (
{/* 상태 표시 */}
{/* 이름 */}
{bot.name}
{/* 통계 */}
{bot.schedules_added || 0}
추가
{bot.last_check_at ? formatTime(bot.last_check_at) : '-'}
{/* 버튼 */}
);
});
/**
* 미니 카드형 봇 (YouTube용) - 컴팩트한 카드
*/
export const BotMiniCard = memo(function BotMiniCard({
bot,
index,
isInitialLoad,
syncing,
statusInfo,
onSync,
onToggle,
onAnimationComplete,
formatTime,
formatInterval,
}) {
return (
{/* 메인 영역 */}
{bot.name}
{statusInfo.text}
{/* 간단 통계 */}
총 {bot.schedules_added || 0}
•
최근 0 ? 'text-green-600' : 'text-gray-400'}>+{bot.last_added_count || 0}
•
{formatInterval(bot.check_interval)}
{/* 마지막 업데이트 */}
{bot.last_check_at ? formatTime(bot.last_check_at) : '대기 중'}
{/* 오류 메시지 */}
{bot.status === 'error' && bot.error_message && (
{bot.error_message}
)}
{/* 호버시 나타나는 액션 버튼 */}
);
});
/**
* 테이블 행 봇
*/
export const BotTableRow = memo(function BotTableRow({
bot,
index,
isInitialLoad,
syncing,
statusInfo,
onSync,
onToggle,
onEdit,
onDelete,
onAnimationComplete,
formatTime,
formatInterval,
}) {
return (
{bot.name}
|
{statusInfo.text}
|
{bot.schedules_added || 0} |
0 ? 'text-green-600 font-medium' : 'text-gray-400'}>
+{bot.last_added_count || 0}
|
{formatInterval(bot.check_interval)} |
{bot.last_check_at ? formatTime(bot.last_check_at) : '-'}
|
{/* 전체 동기화 */}
{/* 시작/정지 */}
{/* 수정 (YouTube만) */}
{bot.type === 'youtube' && onEdit && (
)}
{/* 삭제 (YouTube만) */}
{bot.type === 'youtube' && onDelete && (
)}
|
);
});
/**
* 테이블 래퍼
*/
export const BotTable = ({ children }) => (
| 이름 |
상태 |
총 추가 |
최근 |
간격 |
마지막 업데이트 |
액션 |
{children}
);
// 기본 카드 (호환성 유지)
const BotCard = BotMiniCard;
export default BotCard;