-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/onboarding-final
- Loading branch information
Showing
66 changed files
with
450 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"use server"; | ||
|
||
import instance from "@/apis/instance"; | ||
import FIESTA_ENDPOINTS from "@/config/apiEndpoints"; | ||
import { generateUrlWithParams } from "@/utils/generateUrlWithParams"; | ||
|
||
import { thisWeekFestivalKeys } from "./thisWeekFestivalKeys"; | ||
import { | ||
PaginationParamter, | ||
ThisWeekFestivalData, | ||
} from "./thisWeekFestivalType"; | ||
|
||
const defaultParams: PaginationParamter = { page: 0, size: 6 }; | ||
const ENDPOINT = FIESTA_ENDPOINTS.festivals; | ||
|
||
export async function getThisWeekFestival( | ||
params: PaginationParamter = defaultParams, | ||
) { | ||
const endpoint = ENDPOINT.thisWeek; | ||
const { data } = await instance.get<ThisWeekFestivalData>( | ||
generateUrlWithParams(endpoint, params), | ||
{ | ||
next: { | ||
revalidate: 10, | ||
tags: thisWeekFestivalKeys.all, | ||
}, | ||
}, | ||
); | ||
return data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { PaginationParamter } from "./thisWeekFestivalType"; | ||
|
||
const defaultParams: PaginationParamter = { page: 0, size: 6 }; | ||
|
||
export const thisWeekFestivalKeys = { | ||
all: ["thisWeekFestival"], | ||
list: (params: PaginationParamter = defaultParams) => [ | ||
thisWeekFestivalKeys.all, | ||
params, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
export interface PaginationParamter { | ||
page: number; | ||
size: number; | ||
} | ||
|
||
export interface PaginationMetaData { | ||
offset: number; | ||
pageNumber: number; | ||
pageSize: number; | ||
totalElements: number; | ||
totalPages: number; | ||
} | ||
|
||
export interface FestivalListModel { | ||
festivalId: number; | ||
name: string; | ||
sido: string; | ||
sigungu: string; | ||
thumbnailImage: string; | ||
startDate: string; | ||
endDate: string; | ||
} | ||
|
||
export interface FestivalResponse<T> { | ||
statusCode: number; | ||
status: string; | ||
message: string; | ||
data: T; | ||
} | ||
|
||
export type ThisWeekFestivalResponse = FestivalResponse<ThisWeekFestivalData>; | ||
|
||
export interface ThisWeekFestivalData | ||
extends ThisWeekFestivalContent, | ||
PaginationMetaData {} | ||
|
||
export interface ThisWeekFestivalContent { | ||
content: FestivalListModel[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import { env } from "@/env"; | ||
|
||
import { env } from "../env"; | ||
import { | ||
ClientError, | ||
createFiestaError, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import Link from "next/link"; | ||
|
||
import { getThisWeekFestival } from "@/apis/festivals/thisweek/thisWeekFestival"; | ||
import { FestivalTile } from "@/components/core/List"; | ||
import { DateTag } from "@/components/core/Tag"; | ||
import { ArrowRightSmallIcon } from "@/components/icons"; | ||
import { FIESTA_ENDPOINTS } from "@/config"; | ||
import { getDday } from "@/lib/dayjs"; | ||
|
||
const FestivalThisWeek = async () => { | ||
const thisWeekFestivals = await getThisWeekFestival(); | ||
return ( | ||
<section className="flex w-full flex-col gap-[12px]"> | ||
<div className="flex w-full justify-between"> | ||
<div className="flex gap-[4px] text-title-bold text-gray-scale-900"> | ||
이번주 페스티벌 | ||
</div> | ||
|
||
<Link href={`${FIESTA_ENDPOINTS.festivals.thisWeek}?page=0&size=6`}> | ||
<ArrowRightSmallIcon | ||
width={24} | ||
height={24} | ||
className="text-gray-scale-900" | ||
/> | ||
</Link> | ||
</div> | ||
|
||
<div className="flex w-full flex-col gap-[16px]"> | ||
{thisWeekFestivals.content.splice(0, 3).map((festival) => ( | ||
<FestivalTile | ||
key={festival.name} | ||
href={`/featival/${festival.festivalId}`} | ||
festival={festival} | ||
> | ||
<DateTag label={getDday(festival.startDate, festival.endDate)} /> | ||
</FestivalTile> | ||
))} | ||
</div> | ||
</section> | ||
); | ||
}; | ||
|
||
export default FestivalThisWeek; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { createSearchParamsCache, parseAsInteger } from "nuqs/server"; | ||
|
||
import { getThisWeekFestival } from "@/apis/festivals/thisweek/thisWeekFestival"; | ||
import Pagination from "@/components/Pagination/Pagination"; | ||
import { FIESTA_ENDPOINTS } from "@/config"; | ||
import { DefaultHeader } from "@/layout/Mobile/MobileHeader"; | ||
|
||
import ThisWeekFestivalView from "./view"; | ||
|
||
const searchParamsCache = createSearchParamsCache({ | ||
page: parseAsInteger.withDefault(0), | ||
size: parseAsInteger.withDefault(6), | ||
}); | ||
|
||
interface TrendPageProps { | ||
searchParams: Record<string, string>; | ||
} | ||
|
||
export default async function TrendPage({ searchParams }: TrendPageProps) { | ||
const parsedParams = searchParamsCache.parse(searchParams); | ||
const festivals = await getThisWeekFestival(parsedParams); | ||
|
||
return ( | ||
<div className="relative mb-[60px] mt-[44px]"> | ||
<DefaultHeader href="/" label="이번주 페스티벌" /> | ||
<ThisWeekFestivalView festivals={festivals} /> | ||
<Pagination | ||
currentPath={FIESTA_ENDPOINTS.festivals.thisWeek} | ||
currentPage={parsedParams.page} | ||
totalPage={festivals.totalPages} | ||
size={parsedParams.size} | ||
/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { ThisWeekFestivalData } from "@/apis/festivals/thisweek/thisWeekFestivalType"; | ||
import { FestivalTile } from "@/components/core/List"; | ||
import { DateTag } from "@/components/core/Tag"; | ||
import { getDday } from "@/lib/dayjs"; | ||
|
||
interface Props { | ||
festivals: ThisWeekFestivalData; | ||
} | ||
|
||
const ThisWeekFestivalView = ({ festivals }: Props) => { | ||
return ( | ||
<div className="h-full w-full p-[16px]"> | ||
<div className="flex w-full flex-col gap-[10px]"> | ||
{festivals.content.map((festival) => ( | ||
<FestivalTile | ||
key={festival.name} | ||
href={`/featival/${festival.festivalId}`} | ||
festival={festival} | ||
> | ||
<DateTag label={getDday(festival.startDate, festival.endDate)} /> | ||
</FestivalTile> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ThisWeekFestivalView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.