From 2f82b74b29c645554efc0c9d91b202c69c05bb93 Mon Sep 17 00:00:00 2001 From: bongtta Date: Thu, 27 Nov 2025 01:03:10 +0900 Subject: [PATCH 01/15] =?UTF-8?q?feat:=20=EC=97=94=EB=93=9C=ED=8F=AC?= =?UTF-8?q?=EC=9D=B8=ED=8A=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/client/src/shared/constants/api.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/client/src/shared/constants/api.ts b/apps/client/src/shared/constants/api.ts index 2a826f98..9b6cf3e4 100644 --- a/apps/client/src/shared/constants/api.ts +++ b/apps/client/src/shared/constants/api.ts @@ -50,7 +50,8 @@ export const END_POINT = { GET_TICKETING: '/performances/reservation', GET_LATEST_PERFORMANCES: '/performances/info', GET_SUGGEST_PERFORMANCE: '/performances/recommend', - GET_SUGGEST_MUSIC_PERFORMANCE: '/performances/recommend/performance', + GET_SUGGEST_MUSIC_PERFORMANCE: (performanceSize: number, songSize: number) => + `performances/v4/song/recommend?performanceSize=${performanceSize}&songSize=${songSize}`, //타임 테이블 GET_AVAILABLE_FESTIVALS: '/user/timetables/festivals', From a58969978c5576e33c1fa29cfe313b82093d3fbe Mon Sep 17 00:00:00 2001 From: bongtta Date: Thu, 27 Nov 2025 01:05:56 +0900 Subject: [PATCH 02/15] =?UTF-8?q?feat:=20=ED=83=80=EC=9E=85=20=EC=A0=95?= =?UTF-8?q?=EC=9D=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/client/src/shared/types/home-response.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/apps/client/src/shared/types/home-response.ts b/apps/client/src/shared/types/home-response.ts index 8fa1e28f..6b2ece25 100644 --- a/apps/client/src/shared/types/home-response.ts +++ b/apps/client/src/shared/types/home-response.ts @@ -63,3 +63,22 @@ export interface SuggestMusicPerformanceResponse { export interface SuggestMusicResponse { musics: musics[]; } + +export interface RecommendSong { + songId: string; + artistName: string; + artworkUrl: string; + previewUrl: string; +} + +export interface RecommendPerformances { + typeId: number; + type: 'concert' | 'festival'; + title: string; + posterUrl: string; + songs: RecommendSong[]; +} + +export interface RecommendPerformancesResponse { + performances: RecommendPerformances[]; +} From 11744bc634c9e91e821a65933fec11a815891e08 Mon Sep 17 00:00:00 2001 From: bongtta Date: Thu, 27 Nov 2025 01:06:44 +0900 Subject: [PATCH 03/15] =?UTF-8?q?feat:=20=EC=BF=BC=EB=A6=AC=20=ED=95=A8?= =?UTF-8?q?=EC=88=98,=20=EC=98=B5=EC=85=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/shared/apis/home/home-queries.ts | 61 +++++-------------- 1 file changed, 15 insertions(+), 46 deletions(-) diff --git a/apps/client/src/shared/apis/home/home-queries.ts b/apps/client/src/shared/apis/home/home-queries.ts index 741d6f9c..c02107ed 100644 --- a/apps/client/src/shared/apis/home/home-queries.ts +++ b/apps/client/src/shared/apis/home/home-queries.ts @@ -6,8 +6,7 @@ import { END_POINT } from '@shared/constants/api'; import { HOME_QUERY_KEY } from '@shared/constants/query-key'; import { CarouselPerformancesResponse, - SuggestMusicPerformanceResponse, - SuggestMusicResponse, + RecommendPerformancesResponse, SuggestPerformanceResponse, TicketingPerformancesResponse, } from '@shared/types/home-response'; @@ -31,15 +30,13 @@ export const HOME_QUERY_OPTIONS = { queryKey: HOME_QUERY_KEY.SUGGEST_PERFORMANCE(), queryFn: getSuggestPerformance, }), - SUGGEST_MUSIC_PERFORMANCE: () => + RECOMMEND_PERFORMANCES: (performanceSize: number, songSize: number) => queryOptions({ - queryKey: HOME_QUERY_KEY.SUGGEST_MUSIC_PERFORMANCE(), - queryFn: getSuggestMusicPerformance, - }), - SUGGEST_MUSIC: (performanceId: number, musicIds?: string[]) => - queryOptions({ - queryKey: HOME_QUERY_KEY.SUGGEST_MUSIC(performanceId), - queryFn: () => getSuggestMusic(performanceId, musicIds), + queryKey: HOME_QUERY_KEY.RECOMMEND_PERFORMANCES( + performanceSize, + songSize, + ), + queryFn: () => getRecommendPerformances(performanceSize, songSize), }), }; @@ -67,41 +64,13 @@ export const getSuggestPerformance = return response.data; }; -export const getSuggestMusicPerformance = - async (): Promise => { - try { - const response = await get>( - END_POINT.GET_SUGGEST_MUSIC_PERFORMANCE, - ); - - if (!response.data) { - return null; - } - - return response.data; - } catch (error) { - console.error(error); - return null; - } - }; - -export const getSuggestMusic = async ( - performanceId: number, - musicIds?: string[], -): Promise => { - try { - const query = new URLSearchParams(); - - query.append('performanceId', String(performanceId)); - musicIds?.forEach((id) => query.append('musicId', id)); - - const url = `performances/recommend/musics?${query.toString()}`; - - const response = await get>(url); +export const getRecommendPerformances = async ( + performanceSize: number, + songSize: number, +): Promise => { + const response = await get>( + END_POINT.GET_SUGGEST_MUSIC_PERFORMANCE(performanceSize, songSize), + ); - return response.data || { musics: [] }; - } catch (error) { - console.error(error); - return { musics: [] }; - } + return response.data ?? { performances: [] }; }; From 619297eed51d4bd00f105357f146f1bcc5046016 Mon Sep 17 00:00:00 2001 From: bongtta Date: Thu, 27 Nov 2025 01:07:22 +0900 Subject: [PATCH 04/15] =?UTF-8?q?feat:=20=EC=BF=BC=EB=A6=AC=20=ED=82=A4=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/client/src/shared/constants/query-key.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/client/src/shared/constants/query-key.ts b/apps/client/src/shared/constants/query-key.ts index cccc12bb..cfeddc69 100644 --- a/apps/client/src/shared/constants/query-key.ts +++ b/apps/client/src/shared/constants/query-key.ts @@ -31,10 +31,11 @@ export const HOME_QUERY_KEY = { LATEST_PERFORMANCES: () => [...HOME_QUERY_KEY.ALL, 'latest-performances'], TICKETING: () => [...HOME_QUERY_KEY.ALL, 'ticketing'], SUGGEST_PERFORMANCE: () => [...HOME_QUERY_KEY.ALL, 'suggest-performance'], - SUGGEST_MUSIC_PERFORMANCE: () => [...HOME_QUERY_KEY.ALL, 'suggest-music'], - SUGGEST_MUSIC: (performanceId: number) => [ + RECOMMEND_PERFORMANCES: (performanceSize: number, songSize: number) => [ ...HOME_QUERY_KEY.ALL, - performanceId, + 'recommend-performances', + performanceSize, + songSize, ], } as const; From 5067730f6686f9d2a04d32a29861007e899960a4 Mon Sep 17 00:00:00 2001 From: bongtta Date: Thu, 27 Nov 2025 01:34:48 +0900 Subject: [PATCH 05/15] =?UTF-8?q?feat:=20=EA=B3=B5=EC=97=B0=20=EB=AF=B8?= =?UTF-8?q?=EB=A6=AC=EB=93=A3=EA=B8=B0=20api=20=EC=97=B0=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/components/suggest-music-section.tsx | 66 +++++++++++++++---- .../src/pages/home/hooks/use-home-queries.ts | 9 ++- apps/client/src/pages/home/page/home-page.tsx | 9 ++- .../components/music-list/music-info.tsx | 16 +++-- 4 files changed, 75 insertions(+), 25 deletions(-) diff --git a/apps/client/src/pages/home/components/suggest-music-section.tsx b/apps/client/src/pages/home/components/suggest-music-section.tsx index a32c19c4..6c333c30 100644 --- a/apps/client/src/pages/home/components/suggest-music-section.tsx +++ b/apps/client/src/pages/home/components/suggest-music-section.tsx @@ -1,3 +1,4 @@ +import { useMemo, useState } from 'react'; import { useQuery } from '@tanstack/react-query'; import { Box } from '@confeti/design-system'; @@ -6,25 +7,55 @@ import { HOME_QUERY_OPTIONS } from '@shared/apis/home/home-queries'; import { MusicList } from '@shared/components'; import MusicInfo from '@shared/components/music-list/music-info'; import { useMusicPlayer } from '@shared/hooks/use-music-player'; -import { SuggestMusicPerformanceResponse } from '@shared/types/home-response'; +import { + RecommendPerformances, + SuggestMusicPerformanceResponse, +} from '@shared/types/home-response'; + +interface SuggestMusicSectionProps { + performances: RecommendPerformances[]; + // onClickDetail: NavigateToDetail; +} const SuggestMusicSection = ({ - data, -}: { - data: SuggestMusicPerformanceResponse; -}) => { - const musicIdList: string[] | undefined = undefined; + performances, + // onClickDetail, +}: SuggestMusicSectionProps) => { + const [currentIndex, setCurrentIndex] = useState(0); + + const currentPerformance = performances[currentIndex]; + + const musicData = useMemo( + () => + currentPerformance?.songs.map((song) => ({ + musicId: song.songId, + trackName: song.songId, + artistName: song.artistName, + artworkUrl: song.artworkUrl, + previewUrl: song.previewUrl, + })) ?? [], + [currentPerformance], + ); - const { data: suggestMusic, isPending } = useQuery({ - ...HOME_QUERY_OPTIONS.SUGGEST_MUSIC(data.performanceId, musicIdList), - }); + const { musicList, onClickPlayToggle, audioRef, audioEvents, stopAudio } = + useMusicPlayer(musicData); - if (!isPending && !suggestMusic?.musics) { + if (!currentPerformance || performances.length === 0) { return null; } - const { musicList, onClickPlayToggle, audioRef, audioEvents } = - useMusicPlayer(suggestMusic?.musics ?? []); + // const musicIdList: string[] | undefined = undefined; + + // const { data: suggestMusic, isPending } = useQuery({ + // ...HOME_QUERY_OPTIONS.SUGGEST_MUSIC(data.performanceId, musicIdList), + // }); + + // if (!isPending && !suggestMusic?.musics) { + // return null; + // } + + // const { musicList, onClickPlayToggle, audioRef, audioEvents } = + // useMusicPlayer(suggestMusic?.musics ?? []); return (
- +