Fixes prettier
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
}));
|
||||
|
||||
|
||||
@@ -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>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user