Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HOT 페스티벌 리스트 페이지 구현 #29

Merged
merged 38 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c02a89f
✅ test: test script 추가 #25
froggy1014 Aug 15, 2024
7ff7ebe
🔧 chore: isEmpty 유틸 함수 생성
froggy1014 Aug 15, 2024
87c2dd8
✨ feat: 쿼리스트링 관련 유틸 함수 추가 #25
froggy1014 Aug 15, 2024
99ae4a9
💅 style: 로고 및 폴백 로고 추가
froggy1014 Aug 15, 2024
80d89b5
💅 style: 홈헤더 스타일 수정
froggy1014 Aug 15, 2024
6e50eb5
🔧 chore: 홈 페이지 관련 페이지 파일 위치 수정
froggy1014 Aug 15, 2024
c69f568
✨ feat: getTrendFestival 함수 추가
froggy1014 Aug 15, 2024
c48b429
Merge branch 'feature/instance' into feature/hot-festival
froggy1014 Aug 15, 2024
180f353
Merge branch 'feature/msw-setup' into feature/hot-festival
froggy1014 Aug 17, 2024
0488492
♻️ refactor: trendFestivalCard 컴포넌트 리팩토링 및 스토리북 수정 #26
froggy1014 Aug 17, 2024
d4d4453
♻️ refactor: 쿼리 클리이언트 인스턴스 생성시 useState 사용안하게끔 수정 #26
froggy1014 Aug 17, 2024
2c3aff3
♻️ refactor: defaultHeader button -\> Link 로 수정 #26
froggy1014 Aug 17, 2024
c005f54
✨ feat: daysjs 사용 관련 코드 커스텀 훅으로 분리 #26
froggy1014 Aug 17, 2024
1d31c22
🔨 settings: caching 확인을 위한 logging 활성화 및 이미지 외부 hostname 활성화 #26
froggy1014 Aug 17, 2024
552b88e
🔨 settings: 엔드포인트 상수화 및 index 파일 생성 #26
froggy1014 Aug 17, 2024
873b61f
🔨 settings: 리액트쿼리 defaultOption과 prefetch 래퍼 컴포넌트 생성 #26
froggy1014 Aug 17, 2024
54a1312
✨ feat: hotFestival 타입, 키, 페칭 정의 #26
froggy1014 Aug 17, 2024
d31ff2e
✨ feat: hotFestival 리스트 페이지 서버컴포넌트로 구현 #26
froggy1014 Aug 17, 2024
de0c8ff
🔨 settings: nuqs 패키지 설치 #26
froggy1014 Aug 17, 2024
9ff98df
✨ feat: 서버사이드 페이지네이션 컴포넌트 구현 및 기본 세팅 #26
froggy1014 Aug 17, 2024
052a570
✨ feat: api route에 tag revalidate 구현 #26
froggy1014 Aug 17, 2024
c8073ef
Merge branch 'develop' into feature/hot-festival
froggy1014 Aug 17, 2024
9189579
🔧 chore: mock server 더미데이터 수정
froggy1014 Aug 17, 2024
dddff62
🔧 chore: 목업 파일 삭제 #26
froggy1014 Aug 17, 2024
d01acab
🔧 chore: hotFestival 파일 위치 변경 #26
froggy1014 Aug 17, 2024
0eac02c
♻️ refactor: 타입 파일 위치 변경 #26
froggy1014 Aug 17, 2024
cd1efce
🔧 chore: 컴포넌트 이름 변경
froggy1014 Aug 17, 2024
3030be1
✅ test: 목업 데이터를 활용한 빌드 스크립트 추가 #30
froggy1014 Aug 17, 2024
0e4479e
🔧 chore: hotFestival 키값 오타 수정
froggy1014 Aug 17, 2024
49ef582
👷 cicd: cI에서 PR에 특정 라벨 존재시에 빌드 스킵 #26
froggy1014 Aug 17, 2024
4cbac39
👷 cicd: curly brasket 추가
froggy1014 Aug 17, 2024
ead93b3
👷 cicd: 라벨 체크 조건문 수정
froggy1014 Aug 17, 2024
d57e318
👷 cicd: head commit 도 조건문에 추가
froggy1014 Aug 17, 2024
2320c7b
👷 cicd: push에 preview deployment 비활성화
froggy1014 Aug 17, 2024
922da78
🔨 settings: 축제 사진 제공사 호스트네임 추가 #26
froggy1014 Aug 18, 2024
db7592b
🐛 fix: useDayjs 훅 함수로 변경 #26
froggy1014 Aug 18, 2024
ac9dd6b
♻️ refactor: 피드백 반영 #29
froggy1014 Aug 18, 2024
9335b01
🔧 chore: 미사용 프롭스 제거
froggy1014 Aug 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ on:
branches:
- develop
paths:
- '**/*.stories.tsx'
- "**/*.stories.tsx"

jobs:
chromatic:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-build') }}
name: Run Chromatic Deployment
# Operating System
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
build:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-build') }}
uses: ./.github/workflows/_build.yaml
with:
NODE_VERSION: 20.x
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Vercel Preview Deployment
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]

jobs:
Deploy-Preview:
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-build') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}
12 changes: 12 additions & 0 deletions next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ const jiti = createJiti(fileURLToPath(import.meta.url));
jiti("./src/env");

const nextConfig = {
images: {
remotePatterns: [
{
hostname: "placehold.co",
},
],
},
logging: {
fetches: {
fullUrl: true,
},
},
experimental: { instrumentationHook: true },
webpack(config) {
// SVG 가져오기를 처리하는 기존 규칙을 가져옵니다.
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"dev": "next dev",
"dev:mock": "NODE_ENV=test next dev",
"build:mock": "NODE_ENV=test next build",
"build": "next build",
"start": "next start",
"prepare": "husky",
Expand All @@ -26,6 +27,7 @@
"clsx": "^2.1.1",
"dayjs": "^1.11.12",
"next": "14.2.4",
"nuqs": "^1.17.8",
"react": "^18",
"react-daum-postcode": "^3.1.3",
"react-dom": "^18",
Expand Down
18 changes: 18 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added public/images/fallbackLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 0 additions & 26 deletions src/apis/festival/festival.d.ts

This file was deleted.

17 changes: 0 additions & 17 deletions src/apis/festival/index.ts

This file was deleted.

28 changes: 28 additions & 0 deletions src/apis/festivals/hotFestival/hotFestival.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"use server";

import instance from "@/apis/instance";
import FIESTA_ENDPOINTS from "@/config/apiEndpoints";
import { generateUrlWithParams } from "@/utils/generateUrlWithParams";

import { hotFestivalKeys } from "./hotFestivalkeys";
import { HostFestivalData, PaginationParamter } from "./hotFestivalType";

const defaultParams: PaginationParamter = { page: 0, size: 6 };
const ENDPOINT = FIESTA_ENDPOINTS.festivals;

export async function getHotFestival(
params: PaginationParamter = defaultParams,
) {
const endpoint = ENDPOINT.mostlike;

const { data } = await instance.get<HostFestivalData>(
generateUrlWithParams(endpoint, params),
{
next: {
revalidate: 85600,
froggy1014 marked this conversation as resolved.
Show resolved Hide resolved
tags: hotFestivalKeys.all,
},
},
);
return data;
}
35 changes: 35 additions & 0 deletions src/apis/festivals/hotFestival/hotFestivalType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
export type PaginationParamter = {
page: number;
size: number;
};

export type FestivalListModel = {
festivalId: number;
name: string;
sido: string;
sigungu: string;
thumbnailImage: string;
startDate: string;
endDate: string;
};

export type HotFestivalResponse = {
statusCode: number;
status: string;
message: string;
data: HostFestivalData;
};

export interface HostFestivalData extends HotFestivalList, PageMetaData {}

export interface HotFestivalList {
content: FestivalListModel[];
}

export interface PageMetaData {
offset: number;
pageNumber: number;
pageSize: number;
totalElements: number;
totalPages: number;
}
10 changes: 10 additions & 0 deletions src/apis/festivals/hotFestival/hotFestivalkeys.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { PaginationParamter } from "./hotFestivalType";
const defaultParams: PaginationParamter = { page: 0, size: 6 };

export const hotFestivalKeys = {
all: ["hotFestival"],
list: (params: PaginationParamter = defaultParams) => [
hotFestivalKeys.all,
params,
],
};
44 changes: 44 additions & 0 deletions src/app/(home)/_components/FestivalHot.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import Link from "next/link";
import { FC } from "react";

import { HostFestivalData } from "@/apis/festivals/hotFestival/hotFestivalType";
import { TrendFestivalCard } from "@/components/core/Card";
import { ArrowRightSmallIcon } from "@/components/icons";
import { FIESTA_ENDPOINTS } from "@/config";

interface Props {
hotFestivals: HostFestivalData;
}

const FestivalHot: FC<Props> = ({ hotFestivals }) => {
return (
<section className="flex w-full flex-col gap-[12px]">
<div className="flex w-full justify-between">
<div className="flex gap-[4px]">
<span className="text-title-bold text-primary-01">HOT</span>
<span className="text-title-bold text-gray-scale-900">페스티벌</span>
</div>

<Link href={`${FIESTA_ENDPOINTS.festivals.mostlike}?page=0&size=6`}>
<ArrowRightSmallIcon
width={24}
height={24}
className="text-gray-scale-900"
/>
</Link>
</div>

<div className="flex w-full gap-[16px]">
{hotFestivals.content.splice(0, 2).map((v) => (
froggy1014 marked this conversation as resolved.
Show resolved Hide resolved
<TrendFestivalCard
key={v.festivalId}
href={`/featival/${v.festivalId}`}
festival={v}
/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P4

다른 mapping 로직에선 매핑값 네이밍이 festival 등으로 명시 되어있던데
이 부분도 일관성 있게 hotFestival로 네이밍 개선하는 것이 어떨까요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

일단 리스트 목록들은 모두 같은 festivalModel을 갖고 있어서 festival로 수정하도록 하겠습니다 ! ㅎㅎ

))}
</div>
</section>
);
};

export default FestivalHot;
31 changes: 31 additions & 0 deletions src/app/(home)/festivals/mostlike/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { createSearchParamsCache, parseAsInteger } from "nuqs/server";

import { getHotFestival } from "@/apis/festivals/hotFestival/hotFestival";
import Pagination from "@/components/Pagination/Pagination";
import { DefaultHeader } from "@/layout/Mobile/MobileHeader";

import TrendTestView from "./view";

const searchParamsCache = createSearchParamsCache({
page: parseAsInteger.withDefault(0),
size: parseAsInteger.withDefault(6),
});

interface HotFestivalPageProps {
searchParams: Record<string, string>;
}

export default async function HotFestivalPage({
searchParams,
}: HotFestivalPageProps) {
const parsedParams = searchParamsCache.parse(searchParams);
const festivals = await getHotFestival(parsedParams);

return (
<div className="relative mb-[60px] mt-[44px]">
<DefaultHeader href="/" label="HOT 페스티벌" />
<TrendTestView festivals={festivals} />
<Pagination currentPage={parsedParams.page} />
</div>
);
}
24 changes: 24 additions & 0 deletions src/app/(home)/festivals/mostlike/view.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { HostFestivalData } from "@/apis/festivals/hotFestival/hotFestivalType";
import { TrendFestivalCard } from "@/components/core/Card";

interface Props {
festivals: HostFestivalData;
}

const HotFestivalView = ({ festivals }: Props) => {
return (
<div className="h-full w-full p-[16px]">
<div className="grid w-full grid-cols-2 gap-[16px]">
{festivals.content.map((festival) => (
<TrendFestivalCard
key={festival.festivalId}
href={`/featival/${festival.festivalId}`}
festival={festival}
/>
))}
</div>
</div>
);
};

export default HotFestivalView;
6 changes: 4 additions & 2 deletions src/app/page.tsx → src/app/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { getHotFestival } from "@/apis/festivals/hotFestival/hotFestival";
import { HomeHeader } from "@/layout/Mobile/MobileHeader";
import NavigationBar from "@/layout/Mobile/NavigationBar";

import HomeView from "./view";

export default function Home() {
export default async function Home() {
const hotFestivals = await getHotFestival();
return (
<div className="mb-[60px] mt-[44px]">
<HomeHeader />
<HomeView />
<HomeView hotFestivals={hotFestivals} />
<NavigationBar />
</div>
);
Expand Down
17 changes: 17 additions & 0 deletions src/app/(home)/view.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { HostFestivalData } from "@/apis/festivals/hotFestival/hotFestivalType";

import FestivalHot from "./_components/FestivalHot";

interface Props {
hotFestivals: HostFestivalData;
}

const HomeView = ({ hotFestivals }: Props) => {
return (
<main className="flex flex-wrap gap-4 px-[16px]">
<FestivalHot hotFestivals={hotFestivals} />
</main>
);
};

export default HomeView;
Loading