|
1 | 1 | import React from 'react';
|
2 |
| -import type { Level } from '@/entities/slop/model/model'; |
3 |
| -import LevelChip from '@/entities/slop/ui/level-chip'; |
| 2 | +import type { Slope } from '@/entities/slope'; |
| 3 | +import LevelChip from '@/entities/slope/ui/level-chip'; |
4 | 4 | import CheckIcon from '@/shared/icons/check';
|
5 | 5 | import CloseIcon from '@/shared/icons/close';
|
6 | 6 | import { cn } from '@/shared/lib';
|
7 | 7 | import useSlopStore from '../hooks/useSlopStore';
|
8 | 8 |
|
9 | 9 | interface SlopStatusListProps {
|
10 |
| - list: { |
11 |
| - key: string; |
12 |
| - name: string; |
13 |
| - level: Level; |
14 |
| - isOpenDuringDay: boolean; |
15 |
| - isOpenDuringWeek: boolean; |
16 |
| - isOpenDuringNight: boolean; |
17 |
| - }[]; |
| 10 | + slopes?: Slope[]; |
18 | 11 | }
|
19 | 12 |
|
20 |
| -const SlopStatusList = ({ list }: SlopStatusListProps) => { |
| 13 | +const SlopStatusList = ({ slopes }: SlopStatusListProps) => { |
21 | 14 | const { selectedSlop, setSelectedSlop } = useSlopStore();
|
22 | 15 |
|
23 | 16 | const handleSlopClick = ({ id }: { id: string }) => {
|
@@ -47,26 +40,26 @@ const SlopStatusList = ({ list }: SlopStatusListProps) => {
|
47 | 40 | </tr>
|
48 | 41 | </thead>
|
49 | 42 | <tbody>
|
50 |
| - {list.map((item) => ( |
| 43 | + {slopes?.map((slope) => ( |
51 | 44 | <tr
|
52 |
| - key={item.key} |
53 |
| - className={cn(selectedSlop === item.key && 'bg-main-5')} |
54 |
| - onClick={() => handleSlopClick({ id: item.key })} |
| 45 | + key={slope.name} |
| 46 | + className={cn(selectedSlop === slope.name && 'bg-main-5')} |
| 47 | + onClick={() => handleSlopClick({ id: slope.name })} |
55 | 48 | >
|
56 | 49 | <td className={cn('body1-semibold py-[12px] pl-5 text-left text-gray-80')}>
|
57 |
| - {item.name} |
| 50 | + {slope.name} |
58 | 51 | </td>
|
59 | 52 | <td className={cn('text-center')}>
|
60 |
| - <LevelChip level={item.level} className={cn('m-auto')} /> |
| 53 | + <LevelChip level={slope.difficulty} className={cn('m-auto')} /> |
61 | 54 | </td>
|
62 | 55 | <td className={cn('text-center')}>
|
63 |
| - <StatusIcon isOpen={item.isOpenDuringDay} className={cn('m-auto')} /> |
| 56 | + <StatusIcon isOpen={slope.isDayOperating} className={cn('m-auto')} /> |
64 | 57 | </td>
|
65 | 58 | <td className={cn('text-center')}>
|
66 |
| - <StatusIcon isOpen={item.isOpenDuringWeek} className={cn('m-auto')} /> |
| 59 | + <StatusIcon isOpen={slope.isNightOperating} className={cn('m-auto')} /> |
67 | 60 | </td>
|
68 | 61 | <td className={cn('pr-5 text-center')}>
|
69 |
| - <StatusIcon isOpen={item.isOpenDuringNight} className={cn('m-auto')} /> |
| 62 | + <StatusIcon isOpen={slope.isLateNightOperating} className={cn('m-auto')} /> |
70 | 63 | </td>
|
71 | 64 | </tr>
|
72 | 65 | ))}
|
|
0 commit comments