-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTagPage.tsx
More file actions
45 lines (40 loc) · 1.28 KB
/
TagPage.tsx
File metadata and controls
45 lines (40 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { ReviewStepLayout, TagSection } from '@/components';
import { useNavigate } from 'react-router-dom';
import { useReviewStore } from '@/store';
import { useEffect } from 'react';
import { tagSections } from '@/constants';
export default function ReviewTagsPage() {
const { isInitialized, tags, toggleTag } = useReviewStore();
const navigate = useNavigate();
useEffect(() => {
if (!isInitialized) {
navigate('/review');
}
}, [isInitialized, navigate]);
const canProceed = tags.sound.length > 0 && tags.environment.length > 0;
const handleNext = () => {
navigate('/review/form');
};
return (
<ReviewStepLayout
title="관람하신 상영관은 어땠나요?"
description="최대 5개까지 선택할 수 있어요."
onClickBack={() => navigate('/review/rating')}
onClickNext={handleNext}
disabled={!canProceed}
>
<div className="flex flex-col overflow-y-auto pb-[88px]">
{tagSections.map(({ key, title, required, options }) => (
<TagSection
key={key}
title={title}
options={options}
required={required}
selected={tags[key]}
onChange={(value) => toggleTag(key, value)}
/>
))}
</div>
</ReviewStepLayout>
);
}