feat(festival-bot): 비활성 월일 때 '대기 중' 상태 표시

봇 목록 API에 active_months 노출. 봇이 켜져 있어도 현재 달이 활성
월이 아니면 카드 상태를 초록 '실행 중' 대신 amber '대기 중'으로 표시.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
caadiq 2026-06-06 23:04:38 +09:00
parent d24f8cabe3
commit 543371db23
2 changed files with 24 additions and 3 deletions

View file

@ -37,6 +37,7 @@ const botResponse = {
text_filters: { type: 'array', items: { type: 'string' } }, text_filters: { type: 'array', items: { type: 'string' } },
// 축제 봇 전용 필드 // 축제 봇 전용 필드
search_url: { type: 'string' }, search_url: { type: 'string' },
active_months: { type: ['array', 'null'], items: { type: 'integer' } },
}, },
}; };
@ -144,6 +145,7 @@ export default async function botsRoutes(fastify) {
botData.db_id = bot.dbId; botData.db_id = bot.dbId;
botData.search_url = bot.searchUrl; botData.search_url = bot.searchUrl;
botData.cron_interval = checkInterval; botData.cron_interval = checkInterval;
botData.active_months = bot.activeMonths || null;
} }
result.push(botData); result.push(botData);

View file

@ -2,7 +2,7 @@ import { useState, useEffect, useMemo } from 'react';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useQuery, useQueryClient } from '@tanstack/react-query'; import { useQuery, useQueryClient } from '@tanstack/react-query';
import { motion, AnimatePresence } from 'framer-motion'; import { motion, AnimatePresence } from 'framer-motion';
import { Home, ChevronRight, Bot, CheckCircle, XCircle, RefreshCw, Plus, Youtube, PartyPopper } from 'lucide-react'; import { Home, ChevronRight, Bot, CheckCircle, XCircle, RefreshCw, Plus, Youtube, PartyPopper, Clock } from 'lucide-react';
import { Toast, Tooltip, AnimatedNumber } from '@/components/common'; import { Toast, Tooltip, AnimatedNumber } from '@/components/common';
import { AdminLayout, XIcon, MeilisearchIcon, BotTableRow, BotTable, YouTubeBotDialog, XBotDialog, FestivalBotDialog } from '@/components/pc/admin'; import { AdminLayout, XIcon, MeilisearchIcon, BotTableRow, BotTable, YouTubeBotDialog, XBotDialog, FestivalBotDialog } from '@/components/pc/admin';
import { useAdminAuth } from '@/hooks/pc/admin'; import { useAdminAuth } from '@/hooks/pc/admin';
@ -191,7 +191,26 @@ function ScheduleBots() {
}; };
// //
const getStatusInfo = (status) => { // ( )
const isInactiveMonth = (bot) => {
const months = bot?.active_months;
if (!Array.isArray(months) || months.length === 0 || months.length >= 12) return false;
const currentMonth = new Date().getMonth() + 1;
return !months.includes(currentMonth);
};
const getStatusInfo = (bot) => {
const status = bot?.status;
//
if (status === 'running' && isInactiveMonth(bot)) {
return {
icon: <Clock size={16} />,
text: '대기 중',
color: 'text-amber-500',
bg: 'bg-amber-50',
dot: 'bg-amber-400',
};
}
switch (status) { switch (status) {
case 'running': case 'running':
return { return {
@ -523,7 +542,7 @@ function ScheduleBots() {
index={index} index={index}
isInitialLoad={isInitialLoad} isInitialLoad={isInitialLoad}
syncing={syncing} syncing={syncing}
statusInfo={getStatusInfo(bot.status)} statusInfo={getStatusInfo(bot)}
onSync={handleSyncAllVideos} onSync={handleSyncAllVideos}
onToggle={toggleBot} onToggle={toggleBot}
onEdit={(bot) => { onEdit={(bot) => {