Fixes prettier

This commit is contained in:
Clément Le Bihan
2023-12-20 12:01:31 +01:00
parent 99da77f23e
commit 00d097f643
3 changed files with 21 additions and 16 deletions
+10 -11
View File
@@ -22,17 +22,16 @@ const SongCardInfo = (props: SongCardInfoProps) => {
width: isPhone ? 160 : 200,
};
const Scores = [
{
icon: 'time',
score: props.song.lastScore ?? '?',
},
{
icon: 'trophy',
score: props.song.bestScore ?? '?',
},
];
const Scores = [
{
icon: 'time',
score: props.song.lastScore ?? '?',
},
{
icon: 'trophy',
score: props.song.bestScore ?? '?',
},
];
return (
<View
+7 -2
View File
@@ -11,7 +11,8 @@ import { SongHistoryItemWithoutSongValidator } from './SongHistory';
export type SongInclude = 'artist' | 'album' | 'genre' | 'SongHistory' | 'likedByUsers';
export const SongValidator = yup
.object().shape({
.object()
.shape({
name: yup.string().required(),
midiPath: yup.string().required(),
musicXmlPath: yup.string().required(),
@@ -41,7 +42,11 @@ export const SongValidator = yup
.at(-1) ?? null,
lastScore:
song.SongHistory?.map(({ info, playDate }) => ({ info, playDate }))
.sort((a, b) => yup.date().cast(a.playDate)!.getTime() - yup.date().cast(b.playDate)!.getTime())
.sort(
(a, b) =>
yup.date().cast(a.playDate)!.getTime() -
yup.date().cast(b.playDate)!.getTime()
)
.at(0)?.info.score ?? null,
}));
+4 -3
View File
@@ -27,10 +27,11 @@ export const SongHistoryItemWithoutSongValidator = yup
})
.concat(ModelValidator);
export const SongHistoryItemValidator = SongHistoryItemWithoutSongValidator
.concat(yup.object({
export const SongHistoryItemValidator = SongHistoryItemWithoutSongValidator.concat(
yup.object({
song: yup.lazy(() => SongValidator.default(undefined)).optional(),
}));
})
);
export type SongHistoryItem = yup.InferType<typeof SongHistoryItemValidator>;