Les échecs de défis donnent lieu à un mouvement de points nul

This commit is contained in:
2024-12-14 13:30:26 +01:00
parent 9dfb2ba15d
commit 979362d012
6 changed files with 52 additions and 12 deletions

View File

@ -32,7 +32,7 @@ function MoneyUpdateListItem({ moneyUpdate }: { moneyUpdate: MoneyUpdate }) {
case 'START': return 'star'
case 'NEW_RUN': return 'run'
case 'BUY_TRAIN': return 'train'
case 'WIN_CHALLENGE': return 'cards'
case 'CHALLENGE': return 'cards'
}
}, [moneyUpdate.reason])
@ -50,7 +50,7 @@ function MoneyUpdateListItem({ moneyUpdate }: { moneyUpdate: MoneyUpdate }) {
const arrDateTime = new Date(train.arrivalTime)
const arrTime = arrDateTime.toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' })
return `${train.from} ${depTime} => ${train.to} ${arrTime}`
case 'WIN_CHALLENGE':
case 'CHALLENGE':
const challengeAction = challengeActions.find((challengeAction) => challengeAction.id === moneyUpdate.actionId)
if (!challengeAction) return "Défi"
const challenge = challenges.find((challenge) => challenge.id === challengeAction.challengeId)
@ -62,7 +62,7 @@ function MoneyUpdateListItem({ moneyUpdate }: { moneyUpdate: MoneyUpdate }) {
const description = useMemo(() => {
const earnDate = new Date(moneyUpdate.timestamp).toLocaleDateString(undefined, { day: '2-digit', month: '2-digit' })
const earnTime = new Date(moneyUpdate.timestamp).toLocaleTimeString(undefined, { hour: '2-digit', minute: '2-digit' })
const verb = moneyUpdate.amount > 0 ? "Gagné" : "Dépensé"
const verb = moneyUpdate.amount >= 0 ? "Gagné" : "Dépensé"
return <Text>
{verb} {moneyUpdate.amount} <FontAwesome6 name='coins' /> le {earnDate} à {earnTime}
</Text>