fix: 봇 상태 표시 및 일정 추가 애니메이션 개선

- 봇 lastAddedCount를 실제 추가시에만 업데이트 (0으로 덮어쓰지 않음)
- 일정 추가 폼 애니메이션 타이밍 개선 (첫 로딩: 딜레이, 카테고리 변경: 즉시)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
caadiq 2026-01-19 21:31:43 +09:00
parent 1a9fa54981
commit 2d469739b7
2 changed files with 30 additions and 25 deletions

View file

@ -72,13 +72,17 @@ async function schedulerPlugin(fastify, opts) {
try {
const result = await syncFn(bot);
const status = await getStatus(botId);
await updateStatus(botId, {
const updateData = {
status: 'running',
lastCheckAt: new Date().toISOString(),
lastAddedCount: result.addedCount,
totalAdded: (status.totalAdded || 0) + result.addedCount,
errorMessage: null,
});
};
// 실제로 추가된 경우에만 lastAddedCount 업데이트
if (result.addedCount > 0) {
updateData.lastAddedCount = result.addedCount;
}
await updateStatus(botId, updateData);
fastify.log.info(`[${botId}] 동기화 완료: ${result.addedCount}개 추가`);
} catch (err) {
await updateStatus(botId, {
@ -98,11 +102,15 @@ async function schedulerPlugin(fastify, opts) {
try {
const result = await syncFn(bot);
const status = await getStatus(botId);
await updateStatus(botId, {
const updateData = {
lastCheckAt: new Date().toISOString(),
lastAddedCount: result.addedCount,
totalAdded: (status.totalAdded || 0) + result.addedCount,
});
};
// 실제로 추가된 경우에만 lastAddedCount 업데이트
if (result.addedCount > 0) {
updateData.lastAddedCount = result.addedCount;
}
await updateStatus(botId, updateData);
fastify.log.info(`[${botId}] 초기 동기화 완료: ${result.addedCount}개 추가`);
} catch (err) {
fastify.log.error(`[${botId}] 초기 동기화 오류: ${err.message}`);

View file

@ -29,20 +29,6 @@ const itemVariants = {
},
};
const formVariants = {
hidden: { opacity: 0, y: 20 },
visible: {
opacity: 1,
y: 0,
transition: { duration: 0.3, ease: "easeOut", delay: 0.3 },
},
exit: {
opacity: 0,
y: -10,
transition: { duration: 0.2 },
},
};
// ID
const CATEGORY_IDS = {
YOUTUBE: 2,
@ -59,6 +45,7 @@ function ScheduleFormPage() {
const [categories, setCategories] = useState([]);
const [selectedCategory, setSelectedCategory] = useState(null);
const [loading, setLoading] = useState(true);
const [isInitialLoad, setIsInitialLoad] = useState(true);
//
useEffect(() => {
@ -160,7 +147,10 @@ function ScheduleFormPage() {
<CategorySelector
categories={categories}
selectedId={selectedCategory}
onChange={setSelectedCategory}
onChange={(id) => {
setSelectedCategory(id);
setIsInitialLoad(false);
}}
/>
</motion.div>
@ -168,10 +158,17 @@ function ScheduleFormPage() {
<AnimatePresence mode="wait">
<motion.div
key={selectedCategory}
variants={formVariants}
initial="hidden"
animate="visible"
exit="exit"
initial={{ opacity: 0, y: 10 }}
animate={{
opacity: 1,
y: 0,
transition: {
duration: isInitialLoad ? 0.4 : 0.15,
ease: "easeOut",
delay: isInitialLoad ? 0.3 : 0,
},
}}
exit={{ opacity: 0, y: -10, transition: { duration: 0.1 } }}
>
{renderForm()}
</motion.div>