Skip to content

Commit 92ecedb

Browse files
committed
fix #2
1 parent e1fd3db commit 92ecedb

File tree

8 files changed

+79
-70
lines changed

8 files changed

+79
-70
lines changed

app/routes/rank/24hours.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ const TwentyFourHoursRank = () => {
6262
/>
6363
);
6464

65+
const getButtons = () => {
66+
if (ranks.ranking.length <= 50) {
67+
return [button1to50];
68+
} else {
69+
return [button1to50, button51to100];
70+
}
71+
};
72+
6573
return (
6674
<>
67-
<SmallHeader ref={headerRef} title='24시간 차트' buttons={(() => {
68-
if (ranks.ranking.length <= 50) {
69-
return [button1to50];
70-
} else {
71-
return [button1to50, button51to100];
72-
}
73-
})()} />
75+
<SmallHeader ref={headerRef} title='24시간 차트' buttons={getButtons()} />
7476
<motion.div
7577
initial={{ opacity: 0, y: 10 }}
7678
animate={{ opacity: 1, y: 0 }}
@@ -80,8 +82,7 @@ const TwentyFourHoursRank = () => {
8082
<RankHeader title='24시간 차트' updateDate={dayjs(ranks.timestamp * 1000)} />
8183

8284
<div ref={buttonsRef} className='mt-5 flex gap-3'>
83-
{button1to50}
84-
{button51to100}
85+
{getButtons()}
8586
</div>
8687

8788
<ul className='mt-5 space-y-3'>

app/routes/rank/all-time.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ const AllTimeRank = () => {
6262
/>
6363
);
6464

65+
const getButtons = () => {
66+
if (ranks.ranking.length <= 50) {
67+
return [button1to50];
68+
} else {
69+
return [button1to50, button51to100];
70+
}
71+
};
72+
6573
return (
6674
<>
67-
<SmallHeader ref={headerRef} title='누적 차트' buttons={(() => {
68-
if (ranks.ranking.length <= 50) {
69-
return [button1to50];
70-
} else {
71-
return [button1to50, button51to100];
72-
}
73-
})()} />
75+
<SmallHeader ref={headerRef} title='누적 차트' buttons={getButtons()} />
7476
<motion.div
7577
initial={{ opacity: 0, y: 10 }}
7678
animate={{ opacity: 1, y: 0 }}
@@ -80,8 +82,7 @@ const AllTimeRank = () => {
8082
<RankHeader title='누적 차트' updateDate={dayjs(ranks.timestamp * 1000)} />
8183

8284
<div ref={buttonsRef} className='mt-5 flex gap-3'>
83-
{button1to50}
84-
{button51to100}
85+
{getButtons()}
8586
</div>
8687

8788
<ul className='mt-5 space-y-3'>

app/routes/rank/daily.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ const DailyRank = () => {
6262
/>
6363
);
6464

65+
const getButtons = () => {
66+
if (ranks.ranking.length <= 50) {
67+
return [button1to50];
68+
} else {
69+
return [button1to50, button51to100];
70+
}
71+
};
72+
6573
return (
6674
<>
67-
<SmallHeader ref={headerRef} title='일간 차트' buttons={(() => {
68-
if (ranks.ranking.length <= 50) {
69-
return [button1to50];
70-
} else {
71-
return [button1to50, button51to100];
72-
}
73-
})()} />
75+
<SmallHeader ref={headerRef} title='일간 차트' buttons={getButtons()} />
7476
<motion.div
7577
initial={{ opacity: 0, y: 10 }}
7678
animate={{ opacity: 1, y: 0 }}
@@ -80,8 +82,7 @@ const DailyRank = () => {
8082
<RankHeader title='일간 차트' updateDate={dayjs(ranks.timestamp * 1000)} />
8183

8284
<div ref={buttonsRef} className='mt-5 flex gap-3'>
83-
{button1to50}
84-
{button51to100}
85+
{getButtons()}
8586
</div>
8687

8788
<ul className='mt-5 space-y-3'>

app/routes/rank/hourly.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ const HourlyRank = () => {
6262
/>
6363
);
6464

65+
const getButtons = () => {
66+
if (ranks.ranking.length <= 50) {
67+
return [button1to50];
68+
} else {
69+
return [button1to50, button51to100];
70+
}
71+
};
72+
6573
return (
6674
<>
67-
<SmallHeader ref={headerRef} title='매시간 차트' buttons={(() => {
68-
if (ranks.ranking.length <= 50) {
69-
return [button1to50];
70-
} else {
71-
return [button1to50, button51to100];
72-
}
73-
})()} />
75+
<SmallHeader ref={headerRef} title='매시간 차트' buttons={getButtons()} />
7476
<motion.div
7577
initial={{ opacity: 0, y: 10 }}
7678
animate={{ opacity: 1, y: 0 }}

app/routes/rank/monthly.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ const MonthlyRank = () => {
6262
/>
6363
);
6464

65+
const getButtons = () => {
66+
if (ranks.ranking.length <= 50) {
67+
return [button1to50];
68+
} else {
69+
return [button1to50, button51to100];
70+
}
71+
};
72+
6573
return (
6674
<>
67-
<SmallHeader ref={headerRef} title='월간 차트' buttons={(() => {
68-
if (ranks.ranking.length <= 50) {
69-
return [button1to50];
70-
} else {
71-
return [button1to50, button51to100];
72-
}
73-
})()} />
75+
<SmallHeader ref={headerRef} title='월간 차트' buttons={getButtons()} />
7476
<motion.div
7577
initial={{ opacity: 0, y: 10 }}
7678
animate={{ opacity: 1, y: 0 }}
@@ -80,8 +82,7 @@ const MonthlyRank = () => {
8082
<RankHeader title='월간 차트' updateDate={dayjs(ranks.timestamp * 1000)} />
8183

8284
<div ref={buttonsRef} className='mt-5 flex gap-3'>
83-
{button1to50}
84-
{button51to100}
85+
{getButtons()}
8586
</div>
8687

8788
<ul className='mt-5 space-y-3'>

app/routes/rank/new.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,17 @@ const NewestRank = () => {
5656
/>
5757
);
5858

59+
const getButtons = () => {
60+
if (ranks.ranking.length <= 50) {
61+
return [button1to50];
62+
} else {
63+
return [button1to50, button51to100];
64+
}
65+
};
66+
5967
return (
6068
<>
61-
<SmallHeader ref={headerRef} title='신곡 차트' buttons={(() => {
62-
if (ranks.ranking.length <= 50) {
63-
return [button1to50];
64-
} else {
65-
return [button1to50, button51to100];
66-
}
67-
})()} />
69+
<SmallHeader ref={headerRef} title='신곡 차트' buttons={getButtons()} />
6870
<motion.div
6971
initial={{ opacity: 0, y: 10 }}
7072
animate={{ opacity: 1, y: 0 }}
@@ -74,8 +76,7 @@ const NewestRank = () => {
7476
<RankHeader title='신곡 차트' updateDate={dayjs(ranks.timestamp * 1000)} />
7577

7678
<div ref={buttonsRef} className='mt-5 flex gap-3'>
77-
{button1to50}
78-
{button51to100}
79+
{getButtons()}
7980
</div>
8081

8182
<ul className='mt-5 space-y-3'>

app/routes/rank/weekly.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ const WeeklyRank = () => {
6262
/>
6363
);
6464

65+
const getButtons = () => {
66+
if (ranks.ranking.length <= 50) {
67+
return [button1to50];
68+
} else {
69+
return [button1to50, button51to100];
70+
}
71+
};
72+
6573
return (
6674
<>
67-
<SmallHeader ref={headerRef} title='주간 차트' buttons={(() => {
68-
if (ranks.ranking.length <= 50) {
69-
return [button1to50];
70-
} else {
71-
return [button1to50, button51to100];
72-
}
73-
})()} />
75+
<SmallHeader ref={headerRef} title='주간 차트' buttons={getButtons()} />
7476
<motion.div
7577
initial={{ opacity: 0, y: 10 }}
7678
animate={{ opacity: 1, y: 0 }}
@@ -80,8 +82,7 @@ const WeeklyRank = () => {
8082
<RankHeader title='주간 차트' updateDate={dayjs(ranks.timestamp * 1000)} />
8183

8284
<div ref={buttonsRef} className='mt-5 flex gap-3'>
83-
{button1to50}
84-
{button51to100}
85+
{getButtons()}
8586
</div>
8687

8788
<span className='h-px w-full bg-neutral-600' aria-hidden='true' />

app/routes/rank/yearly.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,17 @@ const YearlyRank = () => {
6262
/>
6363
);
6464

65+
const getButtons = () => {
66+
if (ranks.ranking.length <= 50) {
67+
return [button1to50];
68+
} else {
69+
return [button1to50, button51to100];
70+
}
71+
};
72+
6573
return (
6674
<>
67-
<SmallHeader ref={headerRef} title='연간 차트' buttons={(() => {
68-
if (ranks.ranking.length <= 50) {
69-
return [button1to50];
70-
} else {
71-
return [button1to50, button51to100];
72-
}
73-
})()} />
75+
<SmallHeader ref={headerRef} title='연간 차트' buttons={getButtons()} />
7476
<motion.div
7577
initial={{ opacity: 0, y: 10 }}
7678
animate={{ opacity: 1, y: 0 }}
@@ -80,8 +82,7 @@ const YearlyRank = () => {
8082
<RankHeader title='연간 차트' updateDate={dayjs(ranks.timestamp * 1000)} isYearly={true} />
8183

8284
<div ref={buttonsRef} className='mt-5 flex gap-3'>
83-
{button1to50}
84-
{button51to100}
85+
{getButtons()}
8586
</div>
8687

8788
<span className='h-px w-full bg-neutral-600' aria-hidden='true' />

0 commit comments

Comments
 (0)