검색히스토리 추가 및 번역 수정
This commit is contained in:
1 parent
29cee13da7
commit
044fd21b2d
16 files changed
+629
-171
No files matched your search
@@ -1,4 +1,3 @@
|
||||
|
||||
import React, { useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { CrawlingResponse, TargetPersona } from '../../types/api';
|
||||
|
||||
@@ -1,26 +1,43 @@
|
||||
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const LoadingSection: React.FC = () => {
|
||||
interface LoadingSectionProps {
|
||||
onComplete?: () => void;
|
||||
isComplete?: boolean;
|
||||
}
|
||||
|
||||
const LoadingSection: React.FC<LoadingSectionProps> = ({ onComplete, isComplete }) => {
|
||||
const { t } = useTranslation();
|
||||
const [progress, setProgress] = useState(0);
|
||||
const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const interval = setInterval(() => {
|
||||
intervalRef.current = setInterval(() => {
|
||||
setProgress(prev => {
|
||||
if (prev >= 100) {
|
||||
clearInterval(interval);
|
||||
if (intervalRef.current) clearInterval(intervalRef.current);
|
||||
return 100;
|
||||
}
|
||||
// 느리게 올라가다가 90% 이후 거의 멈춤
|
||||
const increment = prev < 50 ? 1 : prev < 85 ? 0.5 : 0.1;
|
||||
const increment = prev < 70 ? 0.5 : prev < 90 ? 0.2 : 0.1;
|
||||
return Math.min(prev + increment, 100);
|
||||
});
|
||||
}, 100);
|
||||
return () => clearInterval(interval);
|
||||
return () => {
|
||||
if (intervalRef.current) clearInterval(intervalRef.current);
|
||||
};
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isComplete) return;
|
||||
if (intervalRef.current) clearInterval(intervalRef.current);
|
||||
setProgress(100);
|
||||
const timer = setTimeout(() => {
|
||||
onComplete?.();
|
||||
}, 400);
|
||||
return () => clearTimeout(timer);
|
||||
}, [isComplete]);
|
||||
|
||||
return (
|
||||
<div className="loading-container">
|
||||
<div className="loading-content">
|
||||
|
||||
Reference in new issue
Block a user