From e2b7649b7b853792af7f965303e1203c5537d135 Mon Sep 17 00:00:00 2001 From: Sumin Jeon Date: Sun, 5 Jan 2025 15:52:46 +0900 Subject: [PATCH] style(fe): delete the title if no data (#2273) * style: delete the title if no data * fix(fe): fix by deleting unnecessary fractions --- .../(main)/_components/ContestCards.tsx | 81 +++++++++++-------- .../(main)/_components/ProblemCards.tsx | 55 ++++++++----- apps/frontend/app/(client)/(main)/page.tsx | 34 ++------ 3 files changed, 85 insertions(+), 85 deletions(-) diff --git a/apps/frontend/app/(client)/(main)/_components/ContestCards.tsx b/apps/frontend/app/(client)/(main)/_components/ContestCards.tsx index 4854c30ee1..edfea5f384 100644 --- a/apps/frontend/app/(client)/(main)/_components/ContestCards.tsx +++ b/apps/frontend/app/(client)/(main)/_components/ContestCards.tsx @@ -1,9 +1,55 @@ +import { Button } from '@/components/shadcn/button' import { fetcher } from '@/libs/utils' import type { Contest } from '@/types/type' import type { Route } from 'next' import Link from 'next/link' import ContestCard from './ContestCard' +export default async function ContestCards() { + const contests = await getContests() + + return ( + contests.length > 0 && ( +
+
+

Contest 🏆

+ + + +
+
+ {contests.slice(0, 2).map((contest) => { + return ( + + + + ) + })} +
+
+ {contests.map((contest) => { + return ( + + + + ) + })} +
+
+ ) + ) +} + const getContests = async () => { const data: { ongoing: Contest[] @@ -20,38 +66,3 @@ const getContests = async () => { return contests.slice(0, 3) } - -export default async function ContestCards() { - const contests = await getContests() - - return ( - <> -
- {contests.slice(0, 2).map((contest) => { - return ( - - - - ) - })} -
-
- {contests.map((contest) => { - return ( - - - - ) - })} -
- - ) -} diff --git a/apps/frontend/app/(client)/(main)/_components/ProblemCards.tsx b/apps/frontend/app/(client)/(main)/_components/ProblemCards.tsx index 57f39b1794..27e2d3b871 100644 --- a/apps/frontend/app/(client)/(main)/_components/ProblemCards.tsx +++ b/apps/frontend/app/(client)/(main)/_components/ProblemCards.tsx @@ -1,3 +1,4 @@ +import { Button } from '@/components/shadcn/button' import Link from 'next/link' import { getProblemList } from '../../_libs/apis/problem' import ProblemCard from './ProblemCard' @@ -9,29 +10,39 @@ export default async function ProblemCards() { }) return ( - <> -
- {problems.slice(0, 2).map((problem) => ( - - + problems.length > 0 && ( +
+
+

Problem ✨

+ + - ))} +
+
+ {problems.slice(0, 2).map((problem) => ( + + + + ))} +
+
+ {problems.map((problem) => ( + + + + ))} +
-
- {problems.map((problem) => ( - - - - ))} -
- + ) ) } diff --git a/apps/frontend/app/(client)/(main)/page.tsx b/apps/frontend/app/(client)/(main)/page.tsx index 7a08a929ac..7c11ada7cf 100644 --- a/apps/frontend/app/(client)/(main)/page.tsx +++ b/apps/frontend/app/(client)/(main)/page.tsx @@ -1,7 +1,5 @@ import FetchErrorFallback from '@/components/FetchErrorFallback' -import { Button } from '@/components/shadcn/button' import { ErrorBoundary } from '@suspensive/react' -import Link from 'next/link' import Carousel from './_components/Carousel' import ContestCards from './_components/ContestCards' import ProblemCards from './_components/ProblemCards' @@ -60,33 +58,13 @@ export default function Home() {
*/} -
-
-

Contest 🏆

- - - -
- - - -
+ + + -
-
-

Problem ✨

- - - -
- - - -
+ + + ) }