diff --git a/src/app/(with-header)/chuni/music/[musicId]/music-playlog.tsx b/src/app/(with-header)/chuni/music/[musicId]/music-playlog.tsx index aa98588..1cdae60 100644 --- a/src/app/(with-header)/chuni/music/[musicId]/music-playlog.tsx +++ b/src/app/(with-header)/chuni/music/[musicId]/music-playlog.tsx @@ -19,7 +19,8 @@ type ChuniMusicPlaylogProps = { export const ChuniMusicPlaylog = ({ music, playlog }: ChuniMusicPlaylogProps) => { type Music = (typeof music)[number]; type Playlog = (typeof playlog)['data'][number]; - const defaultExpanded: Record> = {} + + const [selected, setSelected] = useState(new Set()); const difficulties: (Music & { playlog: Playlog[] })[] = []; music.forEach(m => { @@ -27,65 +28,69 @@ export const ChuniMusicPlaylog = ({ music, playlog }: ChuniMusicPlaylogProps) => }); playlog.data.forEach(play => { - defaultExpanded[play.chartId!] = new Set(); difficulties[play.chartId!].playlog.push(play); }); - const [expanded, setExpanded] = useState(defaultExpanded); - const badgeClass = 'h-6 sm:h-8'; - return (
- {difficulties.map((data, i) => { - const rank = CHUNI_SCORE_RANKS[data.scoreRank!]; - const badges = [ - !!data.scoreRank && - {rank.endsWith('+') ? <> - {rank.slice(0, -1)} -
+
- : rank} -
, - data.isSuccess ? : null, - - ].filter(x => x); + return (
+ + {difficulties.map((data, i) => { + const rank = CHUNI_SCORE_RANKS[data.scoreRank!]; + const badges = [ + !!data.scoreRank && + {rank.endsWith('+') ? <> + {rank.slice(0, -1)} +
+
+ : rank} +
, + data.isSuccess ? : null, + (data.isFullCombo || data.isAllJustice) && + ].filter(x => x); - const toggleExpanded = () => expanded[i] && setExpanded(e => - ({ ...e, - [i]: e[i].size ? new Set() : new Set(['1']) - })); - return (
-
-
-
- + //
+ return ( { + const key = i.toString(); + setSelected(s => s.has(key) ? new Set([...s].filter(k => k !== key)) : new Set([...s, key])) + }}> +
+
+
+ +
+
{CHUNI_DIFFICULTIES[i]}
-
{CHUNI_DIFFICULTIES[i]}
+ {!data.playlog.length &&
No Play History
} + {data.rating ? : null} + {data.scoreMax ?
+ High Score: {data.scoreMax.toLocaleString()} +
: null} + {data.maxComboCount ?
+ Max Combo: {data.maxComboCount.toLocaleString()} +
: null}
- {!data.playlog.length &&
No Play History
} - {data.rating ? : null} - {data.scoreMax ?
- High Score: {data.scoreMax.toLocaleString()} + {badges.length ?
+ {badges}
: null} - {data.maxComboCount ?
- Max Combo: {data.maxComboCount.toLocaleString()} -
: null} -
- {badges.length ?
- {badges} -
: null} - {data.playlog.length ? setExpanded(e => ({ ...e, [i]: k as any }))}> - -
- {data.playlog.map(p => )} -
-
-
: null - } -
) - })} +
}> +
+ Chart designer: {data.chartDesigner} + {!!data.tapJudgeCount && Tap: {data.tapJudgeCount}} + {!!data.flickJudgeCount && Flick: {data.flickJudgeCount}} + {!!data.holdJudgeCount && Hold: {data.holdJudgeCount}} + {!!data.slideJudgeCount && Slide: {data.slideJudgeCount}} + {!!data.airJudgeCount && Air: {data.airJudgeCount}} +
+
+ {data.playlog.map(p => )} +
+ ); + })} +
); };