Skip to content

Commit 5edff7c

Browse files
committed
chore: migrate recent-list to leaderboard
1 parent 9bb4349 commit 5edff7c

File tree

11 files changed

+71
-16
lines changed

11 files changed

+71
-16
lines changed

app/[lang]/(common)/Header/index.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ function DesktopNavMenus(
4646
const router = useRouter();
4747
const supabase = getSupabaseBrowserClient();
4848

49+
const normalizePath = (path: string): string => path.replace(/\/+$/, '');
50+
const isActivePath = (path: string): boolean => {
51+
const target = normalizePath(`/${lang}${path}`);
52+
const current = normalizePath(pathname ?? '');
53+
return current === target || current.startsWith(`${target}/`);
54+
};
55+
4956
return (
5057
<div
5158
className={clsx('flex-1 justify-between items-center', 'max-md:hidden')}
@@ -64,7 +71,7 @@ function DesktopNavMenus(
6471
href={`${link.path}`}
6572
className={clsx(
6673
'text-body4 truncate',
67-
pathname?.includes(link.path) ? 'opacity-100' : 'opacity-30',
74+
isActivePath(link.path) ? 'opacity-100' : 'opacity-30',
6875
)}
6976
>
7077
<li
@@ -130,6 +137,13 @@ function MobileNavMenus(
130137

131138
const [isNavCollapsed, setIsNavCollapsed] = useState(true);
132139

140+
const normalizePath = (path: string): string => path.replace(/\/+$/, '');
141+
const isActivePath = (path: string): boolean => {
142+
const target = normalizePath(`/${lang}${path}`);
143+
const current = normalizePath(pathname ?? '');
144+
return current === target || current.startsWith(`${target}/`);
145+
};
146+
133147
return (
134148
<div className={clsx('md:hidden flex-1', 'flex flex-row-reverse')}>
135149
<div className="cursor-pointer">
@@ -169,7 +183,7 @@ function MobileNavMenus(
169183
'text-body4 truncate flex-1 h-10 px-8',
170184
'flex items-center',
171185
'hover:opacity-100',
172-
pathname?.includes(link.path) ? 'opacity-100' : 'opacity-30',
186+
isActivePath(link.path) ? 'opacity-100' : 'opacity-30',
173187
)}
174188
>
175189
<li
@@ -248,17 +262,17 @@ export default function Header(props: Props): ReactElement {
248262
},
249263
{
250264
name: t.recentList,
251-
path: '/recent-list',
265+
path: '/leaderboard',
252266
},
253267
]
254268
: [
255269
{
256270
name: t.stats,
257-
path: `/stats/`,
271+
path: `/stats`,
258272
},
259273
{
260274
name: t.recentList,
261-
path: '/recent-list',
275+
path: '/leaderboard',
262276
},
263277
];
264278

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,45 @@ export default function TopTierUsers({title}: Props): ReactElement {
8484
className={clsx(
8585
'shrink-0 flex flex-col items-center p-2 rounded-xl w-[80px]',
8686
'bg-gradient-to-br from-amber-500/10 to-orange-500/10 dark:from-amber-500/20 dark:to-orange-500/20',
87-
'border border-amber-500/20 dark:border-amber-500/30',
88-
'hover:scale-105 transition-transform duration-200',
87+
'border border-border-light dark:border-border-dark',
88+
'transition-transform duration-200',
89+
'group',
90+
'focus:outline-none focus:ring-0 focus-visible:ring-0 focus:ring-transparent',
8991
)}
9092
>
9193
<Image
9294
alt={user.login}
9395
src={user.avatarUrl}
9496
width={40}
9597
height={40}
96-
className="rounded-full ring-2 ring-amber-500/50"
98+
className={clsx(
99+
'rounded-full ring-2 ring-amber-500/50',
100+
'transition-transform duration-200 group-hover:scale-110',
101+
)}
97102
/>
98103
<Image
99104
alt={user.tierName}
100105
src={getTierSvg(user.tierName as Tier)}
101106
width={14}
102107
height={14}
103-
className="-mt-2 relative z-10"
108+
className="-mt-2 relative z-10 transition-transform duration-200 group-hover:scale-110"
104109
/>
105-
<span className="mt-1 text-[10px] font-medium text-basic truncate max-w-[70px]">
110+
<span
111+
className={clsx(
112+
'mt-1 text-[10px] font-medium text-basic truncate max-w-[70px]',
113+
'transition-transform duration-200 group-hover:scale-105',
114+
)}
115+
>
106116
{user.login}
107117
</span>
108-
<span className="text-[9px] text-placeholder">{user.score}</span>
118+
<span
119+
className={clsx(
120+
'text-[9px] text-placeholder',
121+
'transition-transform duration-200 group-hover:scale-105',
122+
)}
123+
>
124+
{user.score}
125+
</span>
109126
</a>
110127
))}
111128
</div>

app/[lang]/stats/[login]/Scouter/StatsDetails/SectionDooboo.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ function SectionHeader({t, stats, endDate}: SectionProps): ReactElement {
2929

3030
// Reset loading when endDate changes (data loaded)
3131
useEffect(() => {
32+
// Safe reset after data refresh
33+
// eslint-disable-next-line react-hooks/set-state-in-effect
3234
setIsLoading(false);
3335
}, [endDate, stats]);
3436

app/[lang]/stats/[login]/Scouter/StatsDetails/StatsChart.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ export default function StatsChart({
4040
return () => cancelAnimationFrame(rafId);
4141
}, []);
4242

43-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4443
const handleLegendMouseEnter = useCallback((data: any) => {
4544
if (data?.dataKey) {
4645
setHoveredLine(String(data.dataKey));
@@ -51,7 +50,6 @@ export default function StatsChart({
5150
setHoveredLine(null);
5251
}, []);
5352

54-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5553
const handleLegendClick = useCallback((data: any) => {
5654
if (data?.dataKey) {
5755
const key = data.dataKey as LineKey;

app/[lang]/stats/[login]/SearchTextInput.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ export default function SearchTextInput({
3434

3535
// Reset loading state when navigation completes (props change)
3636
useEffect(() => {
37+
// Safe reset after navigation completes
38+
// eslint-disable-next-line react-hooks/set-state-in-effect
3739
setIsLoading(false);
3840
}, [initialValue]);
3941

locales/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"nav": {
3-
"recentList": "Recent List",
3+
"recentList": "Leaderboard",
44
"stats": "Stats",
55
"certifiedUsers": "Certified Users",
66
"signIn": "Sign in",
@@ -126,4 +126,4 @@
126126
"goHome": "Go Home",
127127
"tryAgain": "Try Again"
128128
}
129-
}
129+
}

locales/ko.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"nav": {
3-
"recentList": "최근 목록",
3+
"recentList": "리더보드",
44
"stats": "스탯",
55
"certifiedUsers": "인증 목록",
66
"signIn": "로그인",

0 commit comments

Comments
 (0)