diff --git a/app/_components/meal.tsx b/app/_components/meal.tsx index 91fb915..7cd5426 100644 --- a/app/_components/meal.tsx +++ b/app/_components/meal.tsx @@ -20,13 +20,8 @@ const CATEGORY_ORDER: Array<{ category: MenuCategory; label: string }> = [ { category: 'DINNER', label: '저녁' }, ]; -function Skeleton({ className }: { className: string }) { - return ; -} - export default function MealSection({ all = false }: MealSectionProps) { const { isLoading, isFetching, isError, error, keys, todayKey, getByDate } = useMenuData(); - const [idx, setIdx] = React.useState(null); React.useEffect(() => { @@ -51,18 +46,6 @@ export default function MealSection({ all = false }: MealSectionProps) { React.useEffect(() => { if (!__DEV__) return; - - console.log('[menus/ui] MealSection 렌더 데이터', { - isLoading, - isFetching, - isError, - error, - idx, - keys, - todayKey, - dateKey, - dayItems, - }); }, [dateKey, dayItems, error, idx, isError, isFetching, isLoading, keys, todayKey]); const mealsByCategory = React.useMemo(() => { @@ -75,7 +58,7 @@ export default function MealSection({ all = false }: MealSectionProps) { dayItems.forEach((item) => { const sanitizedMeals = (item.meals ?? []).filter( - (meal) => !normalizedMarkers.includes(normalizeMealText(meal)), + (meal) => !normalizedMarkers.includes(normalizeMealText(meal)) ); map.set(item.menuCategory, sanitizedMeals); @@ -89,123 +72,85 @@ export default function MealSection({ all = false }: MealSectionProps) { React.useEffect(() => { if (!__DEV__) return; - - console.log('[menus/ui] 카테고리별 식단', { - breakfast: mealsByCategory.get('BREAKFAST'), - lunch: mealsByCategory.get('LUNCH'), - dinner: mealsByCategory.get('DINNER'), - }); }, [mealsByCategory]); - const onPrev = () => { + const onPrevClick = () => { if (atStart) return; setIdx((current) => (current == null ? 0 : Math.max(0, current - 1))); }; - const onNext = () => { + const onNextClick = () => { if (atEnd) return; setIdx((current) => (current == null ? 0 : Math.min(keys.length - 1, current + 1))); }; - const renderMealCards = ({ - textClassName, - wrapperClassName, - cardClassName, - emptyTextClassName, - listClassName, - bodyClassName, - }: { - textClassName: string; - wrapperClassName?: string; - cardClassName?: string; - emptyTextClassName?: string; - listClassName?: string; - bodyClassName?: string; - }) => ( - - {CATEGORY_ORDER.map(({ category, label }) => { - const meals = mealsByCategory.get(category) ?? []; - - return ( - - - {label} + return ( + + + {isError && ( + + + 식단 데이터를 불러오지 못했습니다. - - - - - {isLoading ? ( - - - - - - ) : meals.length === 0 ? ( - - - 등록된 식단 내용이 없습니다. - - - ) : ( - - {meals.map((meal, index) => ( - - {meal} - - ))} - - )} - - ); - })} - - ); - - return ( - - {isError && ( - - - 식단 데이터를 불러오지 못했습니다. - - - )} - - {!all && ( - - - - - - {dateKey || '-'} - - - - + )} + + {!all && ( + + + + + + {dateKey || '-'} + + + + + + )} + + + {CATEGORY_ORDER.map(({ category, label }) => { + const meals = mealsByCategory.get(category) ?? []; + + return ( + + {label} + + + + + {meals.length === 0 ? ( + + + 등록된 식단 내용이 없습니다. + + + ) : ( + + {meals.map((meal, index) => ( + + {meal} + + ))} + + )} + + + ); + })} - )} - - {renderMealCards({ - textClassName: 'text-body05 text-grey-80', - wrapperClassName: 'gap-3 mb-5', - cardClassName: 'flex flex-col', - emptyTextClassName: 'text-grey-30', - listClassName: '', - bodyClassName: 'flex flex-col', - })} + ); } diff --git a/app/_components/Page5.tsx b/app/_components/notice-page.tsx similarity index 92% rename from app/_components/Page5.tsx rename to app/_components/notice-page.tsx index 77cec49..527243b 100644 --- a/app/_components/Page5.tsx +++ b/app/_components/notice-page.tsx @@ -4,8 +4,9 @@ import clsx from 'clsx'; import * as React from 'react'; import { Linking, Pressable, ScrollView, View } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; +import { Footer } from '../../components/footer'; -export function Page5() { +export function NoticePage() { const categories = ['전체', '일반', '학사', '장학', '진로', '학생활동', '학칙개정']; const [selectedCategory, setSelectedCategory] = React.useState('전체'); const [currentPage, setCurrentPage] = React.useState(1); @@ -53,23 +54,19 @@ export function Page5() { ))} - {/* 페이지네이션 */} - - - - - {/* footer 작성 전 */} - + +