From d69d3a2a87ba2634dcab51020a124955bf89f206 Mon Sep 17 00:00:00 2001 From: sk1982 Date: Mon, 18 Mar 2024 21:54:53 -0400 Subject: [PATCH] chuni: add max combo --- src/actions/chuni/music.ts | 1 + src/components/chuni/music-playlog.tsx | 3 ++ src/components/chuni/playlog-card.tsx | 50 +++++++++++++++----------- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/actions/chuni/music.ts b/src/actions/chuni/music.ts index 6662cc0..337dd9c 100644 --- a/src/actions/chuni/music.ts +++ b/src/actions/chuni/music.ts @@ -23,6 +23,7 @@ export const getMusic = async (musicId?: number) => { ) .select(({ fn }) => [...CHUNI_MUSIC_PROPERTIES, 'score.isFullCombo', 'score.isAllJustice', 'score.isSuccess', 'score.scoreRank', 'score.scoreMax', + 'score.maxComboCount', fn('NOT ISNULL', ['favorite.favId']).as('favorite'), chuniRating()]) .where(({ selectFrom, eb, and, or }) => and([ diff --git a/src/components/chuni/music-playlog.tsx b/src/components/chuni/music-playlog.tsx index 11cb3a2..20e134e 100644 --- a/src/components/chuni/music-playlog.tsx +++ b/src/components/chuni/music-playlog.tsx @@ -68,6 +68,9 @@ export const ChuniMusicPlaylog = ({ music, playlog }: ChuniMusicPlaylogProps) => {data.scoreMax ?
High Score: {data.scoreMax.toLocaleString()}
: null} + {data.maxComboCount ?
+ Max Combo: {data.maxComboCount.toLocaleString()} +
: null} {badges.length ?
{badges} diff --git a/src/components/chuni/playlog-card.tsx b/src/components/chuni/playlog-card.tsx index eae540b..f2bb9e5 100644 --- a/src/components/chuni/playlog-card.tsx +++ b/src/components/chuni/playlog-card.tsx @@ -1,12 +1,14 @@ +'use client'; + import { getPlaylog } from '@/actions/chuni/playlog'; import { getJacketUrl } from '@/helpers/assets'; import Link from 'next/link'; import { ChuniRating } from '@/components/chuni/rating'; -import { ChuniScoreBadge, ChuniLampSuccessBadge, getVariantFromRank, ChuniLampComboBadge } from '@/components/chuni/score-badge'; +import { ChuniLampComboBadge, ChuniLampSuccessBadge, ChuniScoreBadge, getVariantFromRank } from '@/components/chuni/score-badge'; import { ChuniLevelBadge } from '@/components/chuni/level-badge'; import { ChuniDifficultyContainer } from '@/components/chuni/difficulty-container'; import { formatJst } from '@/helpers/format-jst'; -import { Ticker } from '@/components/ticker'; +import { Ticker, TickerHoverProvider } from '@/components/ticker'; export type ChuniPlaylogCardProps = { playlog: Awaited>['data'][number], @@ -23,48 +25,56 @@ const getChangeColor = (val: number) => { if (val === 0) return 'text-gray-500'; if (val < 0) return 'text-red-500'; return 'text-blue-500'; -} +}; export const ChuniPlaylogCard = ({ playlog, className }: ChuniPlaylogCardProps) => { - return (
+ return ({setHover =>
setHover(true)} onMouseLeave={() => setHover(false)} + className={`rounded-md bg-content1 relative flex flex-col p-2 pt-1 border border-black/25 ${className ?? ''}`}>
- - {playlog.title + + {playlog.title
-
{ formatJst(playlog.userPlayDate!) }
- - { playlog.title } +
{formatJst(playlog.userPlayDate!)}
+ + {playlog.title} - { playlog.artist } - { playlog.genre } + {playlog.artist} + {playlog.genre}
- Rating:  + Rating:   ( {getChangeSign(playlog.playerRatingChange)} {(playlog.playerRatingChange / 100).toFixed(2)} )
+
+ Max Combo: {playlog.maxCombo?.toLocaleString()} +
-
+
{playlog.score?.toLocaleString()} - {!!playlog.isClear && } + {!!playlog.isClear && } {!!playlog.isNewRecord && NEW RECORD}
-
Justice Critical: { playlog.judgeHeaven }
-
Justice: { playlog.judgeCritical }
-
Attack: { playlog.judgeAttack }
-
Miss: { playlog.judgeGuilty }
+
Justice Critical: {playlog.judgeHeaven}
+
Justice: {playlog.judgeCritical}
+
Attack: {playlog.judgeAttack}
+
Miss: {playlog.judgeGuilty}
-
); +
} +
); };