css 정리 .
This commit is contained in:
1 parent
97577b6ba3
commit
ecbd81d091
16 files changed
+3778
-485
No files matched your search
@@ -8,6 +8,9 @@ import DashboardContent from './DashboardContent';
|
||||
import BusinessSettingsContent from './BusinessSettingsContent';
|
||||
import { ImageItem } from '../../types/api';
|
||||
|
||||
const WIZARD_STEP_KEY = 'castad_wizard_step';
|
||||
const ACTIVE_ITEM_KEY = 'castad_active_item';
|
||||
|
||||
interface BusinessInfo {
|
||||
customer_name: string;
|
||||
region: string;
|
||||
@@ -23,8 +26,13 @@ interface GenerationFlowProps {
|
||||
|
||||
const GenerationFlow: React.FC<GenerationFlowProps> = ({ onHome, initialActiveItem = '대시보드', initialImageList = [], businessInfo }) => {
|
||||
const scrollContainerRef = useRef<HTMLDivElement>(null);
|
||||
const [activeItem, setActiveItem] = useState(initialActiveItem);
|
||||
const [maxWizardIndex, setMaxWizardIndex] = useState(0);
|
||||
|
||||
// localStorage에서 저장된 상태 복원
|
||||
const savedActiveItem = localStorage.getItem(ACTIVE_ITEM_KEY);
|
||||
const savedWizardStep = localStorage.getItem(WIZARD_STEP_KEY);
|
||||
|
||||
const [activeItem, setActiveItem] = useState(savedActiveItem || initialActiveItem);
|
||||
const [maxWizardIndex, setMaxWizardIndex] = useState(savedWizardStep ? parseInt(savedWizardStep, 10) : 0);
|
||||
|
||||
// URL 이미지를 ImageItem 형태로 변환하여 초기화
|
||||
const [imageList, setImageList] = useState<ImageItem[]>(
|
||||
@@ -56,11 +64,33 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({ onHome, initialActiveIt
|
||||
const sections = scrollContainerRef.current.querySelectorAll('.flow-section');
|
||||
if (sections[index]) {
|
||||
setMaxWizardIndex(prev => Math.max(prev, index));
|
||||
localStorage.setItem(WIZARD_STEP_KEY, index.toString());
|
||||
sections[index].scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// activeItem 변경 시 localStorage에 저장
|
||||
useEffect(() => {
|
||||
localStorage.setItem(ACTIVE_ITEM_KEY, activeItem);
|
||||
}, [activeItem]);
|
||||
|
||||
// 새로고침 시 저장된 위저드 단계로 스크롤
|
||||
useEffect(() => {
|
||||
if (activeItem === '새 프로젝트 만들기' && savedWizardStep) {
|
||||
const stepIndex = parseInt(savedWizardStep, 10);
|
||||
// 약간의 딜레이 후 스크롤 (DOM이 준비될 때까지)
|
||||
setTimeout(() => {
|
||||
if (scrollContainerRef.current) {
|
||||
const sections = scrollContainerRef.current.querySelectorAll('.flow-section');
|
||||
if (sections[stepIndex]) {
|
||||
sections[stepIndex].scrollIntoView({ behavior: 'auto', block: 'start' });
|
||||
}
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const container = scrollContainerRef.current;
|
||||
if (!container || activeItem !== '새 프로젝트 만들기') return;
|
||||
@@ -150,7 +180,7 @@ const GenerationFlow: React.FC<GenerationFlowProps> = ({ onHome, initialActiveIt
|
||||
|
||||
return (
|
||||
<div className="flex w-full h-[100dvh] bg-[#0d1416] text-white overflow-hidden">
|
||||
<Sidebar activeItem={activeItem} onNavigate={setActiveItem} />
|
||||
<Sidebar activeItem={activeItem} onNavigate={setActiveItem} onHome={onHome} />
|
||||
<div className="flex-1 h-full relative overflow-hidden pl-0 md:pl-0">
|
||||
{renderContent()}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user