-
Notifications
You must be signed in to change notification settings - Fork 0
[feat] 최근 본 동아리 조회 기능 구현 #319
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
Merged
The head ref may contain hidden characters: "318-feat-\uCD5C\uADFC-\uBCF8-\uB3D9\uC544\uB9AC-\uC870\uD68C-\uAE30\uB2A5-\uAD6C\uD604"
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2453fcf
[배포] 이미지 전처리, 광고 기능, 하단바 리디자인, 인앱 알림 페이지 및 토스트 프로덕션 배포 (#230)
ff1451 8dca13a
refactor: 가이드 페이지 이미지 변경 및 구조 개선 (#260)
ff1451 44949c9
Merge branch 'develop'
ff1451 d704e9f
Merge remote-tracking branch 'origin/develop'
ff1451 ff195df
Merge branch 'develop'
ff1451 39f6f3d
Merge branch 'develop'
ff1451 03c61c1
Merge remote-tracking branch 'origin/develop'
ff1451 4845837
Merge branch 'develop'
ff1451 9fb5634
hotfix: 행사 배너 제거
ff1451 d352fef
Merge remote-tracking branch 'origin/develop'
ff1451 17597cb
Merge branch 'develop'
ff1451 89613e7
Merge remote-tracking branch 'origin/develop'
ff1451 b6493c1
feat: 최근 본 동아리 공통 모듈 추가
ff1451 2f13e93
feat: 최근 본 동아리 화면 연결
ff1451 ad927c1
fix: 브레드크럼 마지막 항목 판별 수정
ff1451 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 hidden or 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 hidden or 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,16 @@ | ||
| export const CLUB_CATEGORY = { | ||
| ACADEMIC: 'ACADEMIC', | ||
| SPORTS: 'SPORTS', | ||
| HOBBY: 'HOBBY', | ||
| RELIGION: 'RELIGION', | ||
| PERFORMANCE: 'PERFORMANCE', | ||
| JUNIOR: 'JUNIOR', | ||
| } as const; | ||
|
|
||
| export type ClubCategory = (typeof CLUB_CATEGORY)[keyof typeof CLUB_CATEGORY]; | ||
|
|
||
| export const CLUB_CATEGORY_VALUES = Object.values(CLUB_CATEGORY); | ||
|
|
||
| export function isClubCategory(value: string | null | undefined): value is ClubCategory { | ||
| return typeof value === 'string' && CLUB_CATEGORY_VALUES.includes(value as ClubCategory); | ||
| } |
This file contains hidden or 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,19 @@ | ||
| import type { ClubCategory } from '@/apis/common/club'; | ||
|
|
||
| export interface RecentClubRequestParams { | ||
| clubIds: number[]; | ||
| } | ||
|
|
||
| export interface RecentClub { | ||
| id: number; | ||
| name: string; | ||
| imageUrl: string; | ||
| category: ClubCategory; | ||
| categoryName: string; | ||
| topic: string; | ||
| description: string; | ||
| } | ||
|
|
||
| export interface RecentClubResponse { | ||
| clubs: RecentClub[]; | ||
| } |
This file contains hidden or 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,9 @@ | ||
| import { apiClient } from '../client'; | ||
| import type { RecentClubRequestParams, RecentClubResponse } from './entity'; | ||
|
|
||
| export const getRecentClubs = async (clubIds: number[]) => { | ||
| const response = await apiClient.get<RecentClubResponse, RecentClubRequestParams>('konect/clubs/recent', { | ||
| params: { clubIds }, | ||
| }); | ||
| return response; | ||
| }; |
This file contains hidden or 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,16 @@ | ||
| import { queryOptions } from '@tanstack/react-query'; | ||
|
|
||
| import { getRecentClubs } from '.'; | ||
|
|
||
| export const recentClubQueryKeys = { | ||
| all: ['recentClub'] as const, | ||
| list: (clubIds: number[]) => [...recentClubQueryKeys.all, clubIds] as const, | ||
| }; | ||
|
|
||
| export const recentClubQueries = { | ||
| list: (clubIds: number[]) => | ||
| queryOptions({ | ||
| queryKey: recentClubQueryKeys.list(clubIds), | ||
| queryFn: () => getRecentClubs(clubIds), | ||
| }), | ||
| }; |
This file contains hidden or 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 hidden or 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,49 @@ | ||
| import { Fragment } from 'react'; | ||
| import { cn } from '@konect/utils/cn'; | ||
| import { Link } from 'react-router-dom'; | ||
|
|
||
| interface BreadcrumbItem { | ||
| label: string; | ||
| to?: string; | ||
| } | ||
|
|
||
| interface BreadcrumbProps { | ||
| items: BreadcrumbItem[]; | ||
| } | ||
|
|
||
| function Breadcrumb({ items }: BreadcrumbProps) { | ||
| return ( | ||
| <nav | ||
| className="text-text-400 flex items-center gap-3 text-sm leading-8 font-semibold sm:gap-3.5 sm:text-2xl sm:leading-10" | ||
| aria-label="breadcrumb" | ||
| > | ||
| {items.map((item, index) => { | ||
| const isLast = index === items.length - 1; | ||
|
|
||
| return ( | ||
| <Fragment key={`${item.label}-${index}`}> | ||
| {item.to && !isLast ? ( | ||
| <Link className="hover:text-primary-600 transition-colors" to={item.to}> | ||
| {item.label} | ||
| </Link> | ||
| ) : ( | ||
| <span | ||
| className={cn(isLast && 'text-text-600 min-w-0 truncate font-semibold')} | ||
| aria-current={isLast ? 'page' : undefined} | ||
| > | ||
| {item.label} | ||
| </span> | ||
| )} | ||
| {!isLast && ( | ||
| <span className="text-text-300 text-lg sm:text-[20px]" aria-hidden="true"> | ||
| › | ||
| </span> | ||
| )} | ||
| </Fragment> | ||
| ); | ||
| })} | ||
| </nav> | ||
| ); | ||
| } | ||
|
|
||
| export default Breadcrumb; | ||
This file contains hidden or 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 @@ | ||
| import { cn } from '@konect/utils/cn'; | ||
| import { Link } from 'react-router-dom'; | ||
|
|
||
| import type { RecentClub } from '@/apis/recentClub/entity'; | ||
| import { CATEGORY_TEXT_COLORS } from '@/constants/club'; | ||
|
|
||
| interface RecentClubCardProps { | ||
| club: RecentClub; | ||
| } | ||
|
|
||
| function RecentClubCard({ club }: RecentClubCardProps) { | ||
| return ( | ||
| <Link | ||
| className="border-text-100 hover:border-primary-500 focus-visible:outline-primary-500 flex w-full items-center gap-7 overflow-hidden rounded-[20px] border bg-white px-5.5 py-5 transition-colors hover:shadow-[0_0_30px_0_rgba(105,191,223,0.30)] focus-visible:outline-2 focus-visible:outline-offset-2" | ||
| to={`/clubs/${club.id}`} | ||
| > | ||
| <img className="size-12.5 shrink-0 rounded-full object-cover" src={club.imageUrl} alt="" /> | ||
| <span className="min-w-0"> | ||
| <span className="block truncate leading-10 font-semibold text-black">{club.name}</span> | ||
| <span className="flex min-w-0 items-center gap-2 text-[13px] leading-10"> | ||
| <span className={cn('shrink-0 font-semibold', CATEGORY_TEXT_COLORS[club.category])}>{club.categoryName}</span> | ||
| <span className="bg-text-200 size-1 rounded-full" aria-hidden="true" /> | ||
| <span className="text-text-600 min-w-0 truncate font-medium">{club.topic || club.description}</span> | ||
| </span> | ||
| </span> | ||
| </Link> | ||
| ); | ||
| } | ||
|
|
||
| export default RecentClubCard; |
This file contains hidden or 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,57 @@ | ||
| import { cn } from '@konect/utils/cn'; | ||
| import { useSuspenseQuery } from '@tanstack/react-query'; | ||
|
|
||
| import { recentClubQueries } from '@/apis/recentClub/queries'; | ||
| import RecentClubCard from '@/components/RecentClubCard'; | ||
| import { useRecentClubIds } from '@/utils/recentClubStorage'; | ||
|
|
||
| interface RecentClubListProps { | ||
| className: string; | ||
| emptyClassName?: string; | ||
| } | ||
|
|
||
| function RecentClubList({ className, emptyClassName }: RecentClubListProps) { | ||
| const recentClubIds = useRecentClubIds(); | ||
|
|
||
| if (recentClubIds.length === 0) { | ||
| return <RecentClubListMessage className={emptyClassName} message="최근에 본 동아리가 없어요." />; | ||
| } | ||
|
|
||
| return <RecentClubListContent className={className} emptyClassName={emptyClassName} recentClubIds={recentClubIds} />; | ||
| } | ||
|
|
||
| function RecentClubListContent({ | ||
| className, | ||
| emptyClassName, | ||
| recentClubIds, | ||
| }: RecentClubListProps & { recentClubIds: number[] }) { | ||
| const { data } = useSuspenseQuery(recentClubQueries.list(recentClubIds)); | ||
| const recentClubs = data.clubs; | ||
|
|
||
| if (recentClubs.length === 0) { | ||
| return <RecentClubListMessage className={emptyClassName} message="최근에 본 동아리가 없어요." />; | ||
| } | ||
|
|
||
| return ( | ||
| <div className={className}> | ||
| {recentClubs.map((club) => ( | ||
| <RecentClubCard key={club.id} club={club} /> | ||
| ))} | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| function RecentClubListMessage({ className, message }: { className?: string; message: string }) { | ||
| return ( | ||
| <p | ||
| className={cn( | ||
| 'border-primary-200 text-text-400 bg-web-background rounded-[20px] border px-6 py-8 text-center text-[16px] leading-7', | ||
| className | ||
| )} | ||
| > | ||
| {message} | ||
| </p> | ||
| ); | ||
| } | ||
|
|
||
| export default RecentClubList; |
This file contains hidden or 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,10 +1,10 @@ | ||
| import type { ClubCategory } from '@/apis/universityClub/entity'; | ||
| import { CLUB_CATEGORY, type ClubCategory } from '@/apis/common/club'; | ||
|
|
||
| export const CATEGORY_TEXT_COLORS: Record<ClubCategory, string> = { | ||
| ACADEMIC: 'text-primary-500', | ||
| SPORTS: 'text-info-600', | ||
| HOBBY: 'text-danger-600', | ||
| RELIGION: 'text-warning-700', | ||
| PERFORMANCE: 'text-[#cd3bf6]', | ||
| JUNIOR: 'text-success-700', | ||
| [CLUB_CATEGORY.ACADEMIC]: 'text-primary-500', | ||
| [CLUB_CATEGORY.SPORTS]: 'text-info-600', | ||
| [CLUB_CATEGORY.HOBBY]: 'text-danger-600', | ||
| [CLUB_CATEGORY.RELIGION]: 'text-warning-700', | ||
| [CLUB_CATEGORY.PERFORMANCE]: 'text-[#cd3bf6]', | ||
| [CLUB_CATEGORY.JUNIOR]: 'text-success-700', | ||
| }; |
This file contains hidden or 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.
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.
Uh oh!
There was an error while loading. Please reload this page.