-
Notifications
You must be signed in to change notification settings - Fork 2
feat: SP1 매칭 현황 api 수정 및 카드, 토스트 수정 #332
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
Changes from 16 commits
d3571b1
12620e5
0ac70b9
a0ee986
86fdbf0
6337cd5
19ec841
8e54d89
99b1529
47c541e
11e16b6
dcaaf59
30255ba
8e39dc5
20585b9
6a4faac
599e885
f244bf0
fa20a0c
32e8f12
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,20 +3,35 @@ import type { | |
| GroupCardProps, | ||
| SingleCardProps, | ||
| } from '@components/card/match-card/types/card'; | ||
| import { chipVariantOptions } from '@components/chip/styles/chip-variants'; | ||
| import type { getGroupMatchMate, singleMatchMate } from '@/shared/types/match-types'; | ||
|
|
||
| const normalizeChipKey = (v?: string) => (v ?? '').replace(/\s/g, ''); | ||
|
|
||
| const isChipColor = (k: string): k is ChipColor => | ||
| Object.prototype.hasOwnProperty.call(chipVariantOptions.bgColor, k); | ||
|
|
||
|
||
| export const mapSingleMatchData = (mates: singleMatchMate[] = []): SingleCardProps[] => { | ||
| return mates.map((mate) => ({ | ||
| ...mate, | ||
| type: 'single', | ||
| imgUrl: [mate.imgUrl], | ||
| chips: [mate.team, mate.style].map((v) => v as ChipColor), | ||
| })); | ||
| return mates.map((mate) => { | ||
| const teamKey = mate.team; | ||
| const styleKey = normalizeChipKey(mate.style); | ||
|
|
||
| const chips = [teamKey, styleKey].filter(isChipColor); | ||
|
|
||
| return { | ||
| ...mate, | ||
| type: 'single', | ||
| imgUrl: [mate.imgUrl], | ||
| isCreated: Boolean(mate.isCreated), | ||
| chips, | ||
| }; | ||
| }); | ||
| }; | ||
|
|
||
| export const mapGroupMatchData = (mates: getGroupMatchMate[] = []): GroupCardProps[] => { | ||
| return mates.map((mate) => ({ | ||
| ...mate, | ||
| type: 'group', | ||
| isCreated: Boolean(mate.isCreated), | ||
| })); | ||
| }; | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| import type { GroupCardProps, SingleCardProps } from '@components/card/match-card/types/card'; | ||
| import { MATCH_PENDING_TOAST_MESSAGES } from '@constants/error-toast'; | ||
|
|
||
| export const statusToCategory = (status?: string): '대기 중' | '완료' | '실패' | '' => { | ||
| if (!status) return ''; | ||
| if (status.includes('매칭 완료')) return '완료'; | ||
|
|
@@ -14,3 +17,19 @@ export const getCardColor = (status?: string): 'active' | 'inactive' => { | |
| }; | ||
|
|
||
| export const fillTabItems = ['전체', '대기 중', '완료', '실패']; | ||
|
|
||
| type MatchableCardProps = SingleCardProps | GroupCardProps; | ||
|
|
||
| export const getPendingToast = ( | ||
| status?: string, | ||
| type?: MatchableCardProps['type'], | ||
| ): string | '' => { | ||
| if (!status) return ''; | ||
| if (status === '요청 대기 중') return MATCH_PENDING_TOAST_MESSAGES.REQUEST_WAITING; | ||
| if (status === '승인 대기 중') { | ||
| return type === 'group' | ||
| ? MATCH_PENDING_TOAST_MESSAGES.APPROVAL_WAITING.group | ||
| : MATCH_PENDING_TOAST_MESSAGES.APPROVAL_WAITING.single; | ||
| } | ||
| return ''; | ||
| }; | ||
|
Comment on lines
+22
to
+38
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 요청 상태에 따라 토스트 메시지를 다르게 보여주는 목적입니다! |
||
Uh oh!
There was an error while loading. Please reload this page.