-
Notifications
You must be signed in to change notification settings - Fork 0
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
구현 - 개봉 예정작 목록 구현 #20
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
05bfb3f
feat: 개봉 예정 영화목록 API 추가
ag502 2822d99
feat: upcomming-movie-list 모델 추가
ag502 723c6fd
feat: upcoming-movie-list api를 react-query로 랩핑
ag502 c41d597
feat: movie-list-item 모델에 platform, released-date-dot-parsed 프로퍼티 추가
ag502 470e5d0
feat: upcoming-movie-card 추가
ag502 fcc6a56
feat: upcoming-movie-list 추가
ag502 c8ddd15
feat: upcoming-movie-list 컴포넌트를 home page에 추가
ag502 76f2d4f
fix: swiper breakpoints 컴포넌트 바깥으로 분리
ag502 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
14 changes: 10 additions & 4 deletions
14
apps/web/src/entities/movie-list/api/movie-list.queries.ts
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,21 +1,27 @@ | ||
import { queryOptions } from "@tanstack/react-query"; | ||
|
||
import { MovieList } from "../model"; | ||
import { UpcomingMovieList } from "../model/upcoming-movie-list"; | ||
|
||
import MovieListApi from "./movie-list-api"; | ||
import { PopularMovieListReqParams } from "./request-types"; | ||
import { MovieListReqParams } from "./request-types"; | ||
|
||
export const movieListQueryKeys = { | ||
popularMovieList: () => ["popular-movie-list"] as const, | ||
upcomingMovieList: () => ["upcoming-movie-list"] as const, | ||
}; | ||
|
||
export const movieListQueries = { | ||
popularMovieList: ( | ||
{ page, language, region }: PopularMovieListReqParams = { page: 1, language: "ko-KR", region: 410 }, | ||
) => | ||
popularMovieList: ({ page, language, region }: MovieListReqParams = { page: 1, language: "ko-KR", region: 410 }) => | ||
queryOptions({ | ||
queryKey: [...movieListQueryKeys.popularMovieList(), { page, language, region }], | ||
queryFn: () => MovieListApi.getPopularMovieList({ page, language, region }), | ||
select: (data) => new MovieList(data), | ||
}), | ||
upcomingMovieList: ({ page, language, region }: MovieListReqParams = { page: 1, language: "ko-KR", region: "KR" }) => | ||
queryOptions({ | ||
queryKey: [...movieListQueryKeys.upcomingMovieList(), { page, language, region }], | ||
queryFn: () => MovieListApi.getUpcomingMovieList({ page, language, region }), | ||
select: (data) => new UpcomingMovieList(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 |
---|---|---|
@@ -1 +1 @@ | ||
export * from "./popular-movie-list"; | ||
export * from "./movie-list"; |
2 changes: 1 addition & 1 deletion
2
...t/api/request-types/popular-movie-list.ts → ...ovie-list/api/request-types/movie-list.ts
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
8 changes: 8 additions & 0 deletions
8
apps/web/src/entities/movie-list/api/response-types/upcoming-movie-list.ts
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,8 @@ | ||
import { MovieListDTO } from "./movie-list"; | ||
|
||
export interface UpcomingMovieListDTO extends MovieListDTO { | ||
dates: { | ||
maximum: string; | ||
minimum: string; | ||
}; | ||
} |
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
15 changes: 15 additions & 0 deletions
15
apps/web/src/entities/movie-list/model/upcoming-movie-list.ts
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,15 @@ | ||
import { UpcomingMovieListDTO } from "../api/response-types/upcoming-movie-list"; | ||
|
||
import { MovieList } from "./movie-list"; | ||
|
||
export class UpcomingMovieList extends MovieList { | ||
public rangeStartDate: string; | ||
public rangeEndData: string; | ||
|
||
constructor(private upcomingMovieList: UpcomingMovieListDTO) { | ||
super(upcomingMovieList); | ||
|
||
this.rangeStartDate = upcomingMovieList.dates.minimum; | ||
this.rangeEndData = upcomingMovieList.dates.maximum; | ||
} | ||
} |
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 +1,2 @@ | ||
export * from "./popular-movie-card/popular-movie-card"; | ||
export * from "./upcoming-movie-card/upcoming-movie-card"; |
12 changes: 12 additions & 0 deletions
12
apps/web/src/entities/movie-list/ui/upcoming-movie-card/upcoming-movie-card.css.ts
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,12 @@ | ||
import { style } from "@vanilla-extract/css"; | ||
|
||
import { themeColorContract } from "@/shared/styles"; | ||
|
||
export const descriptionWrapper = style({ | ||
display: "flex", | ||
gap: "5px", | ||
}); | ||
|
||
export const releasedDate = style({ | ||
color: themeColorContract.color.primary10, | ||
}); |
39 changes: 39 additions & 0 deletions
39
apps/web/src/entities/movie-list/ui/upcoming-movie-card/upcoming-movie-card.tsx
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 @@ | ||
import { AspectRatio } from "@repo/ui/aspect-ratio"; | ||
import Image from "next/image"; | ||
|
||
import { MovieInfoCard } from "@/shared/ui/movie-info-card"; | ||
|
||
import { MovieListItem } from "../../model"; | ||
|
||
import { descriptionWrapper, releasedDate } from "./upcoming-movie-card.css"; | ||
|
||
export function UpcomingMovieCard({ movieInfo }: { movieInfo: MovieListItem }) { | ||
const { posterPath, title, ReleasedDateDotParsed, Platform } = movieInfo; | ||
|
||
return ( | ||
<MovieInfoCard> | ||
<MovieInfoCard.Poster> | ||
<AspectRatio ratio={4 / 3}> | ||
<Image | ||
alt={`${title} poster image`} | ||
height={500} | ||
src={`${process.env.NEXT_PUBLIC_TMDB_RESOURCE_BASE_URL}/t/p/w500${posterPath}`} | ||
style={{ width: "100%", height: "100%" }} | ||
width={500} | ||
/> | ||
</AspectRatio> | ||
</MovieInfoCard.Poster> | ||
|
||
<MovieInfoCard.Title> | ||
<span>{title}</span> | ||
</MovieInfoCard.Title> | ||
|
||
<MovieInfoCard.Description> | ||
<div className={descriptionWrapper}> | ||
<span>{Platform}</span> | ||
<span className={releasedDate}>{ReleasedDateDotParsed}</span> | ||
</div> | ||
</MovieInfoCard.Description> | ||
</MovieInfoCard> | ||
); | ||
} |
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 @@ | ||
export * from "./ui"; |
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 @@ | ||
export * from "./upcoming-movie-list/upcoming-movie-list"; |
39 changes: 39 additions & 0 deletions
39
apps/web/src/features/get-upcoming-movie-list/ui/upcoming-movie-list/upcoming-movie-list.tsx
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 @@ | ||
import { useQuery } from "@tanstack/react-query"; | ||
import { useMemo } from "react"; | ||
import { Swiper, SwiperSlide } from "swiper/react"; | ||
import { SwiperOptions } from "swiper/types"; | ||
|
||
import { UpcomingMovieCard, movieListQueries } from "@/entities/movie-list"; | ||
import { screenBreakPoints } from "@/shared/styles"; | ||
|
||
export function UpcomingMovieList() { | ||
const { data: upcomingMovieList, status: upcomingMovieListStatus } = useQuery(movieListQueries.upcomingMovieList()); | ||
|
||
const swiperBreakPoints: SwiperOptions["breakpoints"] = useMemo( | ||
() => ({ | ||
[parseInt(screenBreakPoints.sm)]: { slidesPerView: 4, spaceBetween: 12 }, | ||
[parseInt(screenBreakPoints.md)]: { slidesPerView: 5, spaceBetween: 16 }, | ||
}), | ||
[], | ||
); | ||
|
||
if (upcomingMovieListStatus === "pending") { | ||
return <div>Loading...</div>; | ||
} | ||
|
||
if (upcomingMovieListStatus === "error") { | ||
return <div>Error...</div>; | ||
} | ||
|
||
return ( | ||
<Swiper breakpoints={swiperBreakPoints} slidesPerView={3} spaceBetween={8}> | ||
{upcomingMovieList.GeneralAudienceMovies?.map((movieInfo) => { | ||
return ( | ||
<SwiperSlide key={movieInfo.id}> | ||
<UpcomingMovieCard movieInfo={movieInfo} /> | ||
</SwiperSlide> | ||
); | ||
})} | ||
</Swiper> | ||
); | ||
} |
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 |
---|---|---|
|
@@ -4,4 +4,6 @@ export const languageRegions: Record<string, string> = { | |
ja: "일본", | ||
hi: "인도", | ||
fr: "프랑스", | ||
pt: "포르투갈", | ||
cn: "중국", | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
컴포넌트 밖에 있어도 되는거 같네요