-
Notifications
You must be signed in to change notification settings - Fork 2
fix: (QA/2) 매칭 결과 화면에서 뒤로가기 후 탭 유지 #255
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 all commits
dd21379
5cc8126
440f6b9
1b7a5f9
40266aa
7b78ef5
fc7490b
2561f82
e71fbb4
2e3302d
e573ab3
1ebef6c
a7272aa
c8ffb44
d7ed459
5d8058e
b1d2ed5
726ce63
2f84562
8e4dc05
ebb0c96
d72e2e2
c0ae80b
d9ffad8
88b629d
a33d744
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 |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import Splash from '@pages/login/components/splash'; | ||
| import Login from '@pages/login/login'; | ||
| import { useEffect, useState } from 'react'; | ||
|
|
||
| const LoginWithSplash = () => { | ||
| const [showSplash, setShowSplash] = useState(true); | ||
|
|
||
| useEffect(() => { | ||
| const timer = setTimeout(() => setShowSplash(false), 1200); | ||
| return () => clearTimeout(timer); | ||
| }, []); | ||
|
|
||
| if (showSplash) return <Splash />; | ||
|
|
||
| return <Login />; | ||
| }; | ||
|
|
||
| export default LoginWithSplash; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import type { | ||
| ChipColor, | ||
| GroupCardProps, | ||
| SingleCardProps, | ||
| } from '@components/card/match-card/types/card'; | ||
| import type { getGroupMatchMate, singleMatchMate } from '@/shared/types/match-types'; | ||
|
|
||
| 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), | ||
|
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. 💡 Verification agent 🧩 Analysis chain타입 캐스팅 검증 필요
다음 스크립트로 🏁 Script executed: #!/bin/bash
# ChipColor 타입 정의와 team, style 필드의 타입 호환성 확인
ast-grep --pattern 'type ChipColor = $$$'
ast-grep --pattern 'interface $_ {
$$$
team: $_;
$$$
style: $_;
$$$
}'Length of output: 2459 ChipColor 런타임 검증 로직 추가 필요
제안 예시: // ChipColor 타입 값인지 확인하는 유틸 함수
const isChipColor = (v: string): v is ChipColor =>
Object.values(chipVariants).some(variant => variant.bgColor === v);
// mapMatchData 내부
chips: [mate.team, mate.style]
.filter(isChipColor) // 유효한 값만
.map(v => v as ChipColor), // 안전하게 캐스팅위와 같이 검증 후 캐스팅하거나, 기본값을 지정하는 방식으로 런타임 안정성을 확보해주세요. 🤖 Prompt for AI Agents |
||
| })); | ||
| }; | ||
|
|
||
| export const mapGroupMatchData = (mates: getGroupMatchMate[] = []): GroupCardProps[] => { | ||
| return mates.map((mate) => ({ | ||
| ...mate, | ||
| type: 'group', | ||
| })); | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import type { TabType } from '@components/tab/tab/tab-content'; | ||
| import { ROUTES } from '@routes/routes-config'; | ||
| import { useState } from 'react'; | ||
| import { useNavigate, useSearchParams } from 'react-router-dom'; | ||
|
|
||
| export const useMatchTabState = () => { | ||
| const navigate = useNavigate(); | ||
| const [searchParams] = useSearchParams(); | ||
|
|
||
| const isTabType = (value: string | null): value is TabType => { | ||
| return value === '1:1' || value === '그룹'; | ||
| }; | ||
|
|
||
| const tabParam = searchParams.get('tab'); | ||
| const filterParam = searchParams.get('filter'); | ||
| const initialTab: TabType = isTabType(tabParam) ? tabParam : '1:1'; | ||
| const initialFilter = filterParam || '전체'; | ||
|
|
||
| const [tabState, setTabState] = useState({ type: initialTab, filter: initialFilter }); | ||
|
|
||
| const updateTabQuery = (type: TabType, filter: string) => { | ||
| const query = new URLSearchParams(); | ||
| query.set('tab', type); | ||
| query.set('filter', filter); | ||
| navigate(`${ROUTES.MATCH}?${query.toString()}`, { replace: true }); | ||
| }; | ||
|
|
||
| const handleTabChange = (type: TabType) => { | ||
| setTabState({ type, filter: '전체' }); | ||
| updateTabQuery(type, '전체'); | ||
| }; | ||
|
|
||
| const handleFilterChange = (filter: string) => { | ||
| setTabState((prev) => { | ||
| const next = { ...prev, filter }; | ||
| updateTabQuery(next.type, filter); | ||
| return next; | ||
| }); | ||
| }; | ||
|
|
||
| return { tabState, handleTabChange, handleFilterChange }; | ||
| }; |
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.
🛠️ Refactor suggestion
인위적인 로딩 지연 시간 재검토 필요
1.5초의 고정된 로딩 지연이 사용자 경험에 부정적인 영향을 미칠 수 있습니다. 실제 데이터 로딩이나 API 호출 없이 인위적인 지연을 추가하는 것은 권장되지 않습니다.
다음과 같은 대안을 고려해보세요:
📝 Committable suggestion
🤖 Prompt for AI Agents