Public Access
feat(points): show early finish and expected points on questions
Core pays 10 early points for an unproven Steam finish. The rest comes with proof. Show this in the toast and the game line. Questions cards show the full value from GET /api/rewards/expected.
This commit is contained in:
1 parent
814decc781
commit
c126592887
13 files changed
+166
-28
No files matched your search
@@ -5,6 +5,10 @@ import {formatDate} from '../utils/format.js';
|
||||
import {STATUS_NOT_REACHED} from '../utils/rewards.js';
|
||||
|
||||
const WAITING = {NO_PROOF: 'POINTS.GAME.WAITING', NO_PLAY_AFTER_START: 'POINTS.GAME.WAITING_START'};
|
||||
// The rest of an early finish waits for Steam play, with or without playtime on record.
|
||||
const WAITING_TOPUP = ['NO_PROOF', 'NO_PLAYTIME'];
|
||||
|
||||
const waitingKey = (kind, reason) => (kind === 'FINISHED_TOPUP' ? WAITING_TOPUP.includes(reason) && 'POINTS.GAME.WAITING_TOPUP' : WAITING[reason]);
|
||||
|
||||
/**
|
||||
* What the game earned: one line per paid row and one per kind that is missing, with the reason from Core. Loading it
|
||||
@@ -36,7 +40,7 @@ export default function GamePointsLine({game}) {
|
||||
date: formatDate(row.paidAt, i18n.language, {dateStyle: 'medium'}),
|
||||
}) + (row.appid === game.appid ? '' : ` ${t('POINTS.GAME.OTHER_EDITION')}`)),
|
||||
...Object.entries(points.missing).filter(([, reason]) => !STATUS_NOT_REACHED.includes(reason)).map(([kind, reason]) => (
|
||||
WAITING[reason] ? t(WAITING[reason])
|
||||
waitingKey(kind, reason) ? t(waitingKey(kind, reason))
|
||||
: t('POINTS.GAME.NONE', {kind: kindText(kind), reason: t(`POINTS.REASONS.${reason}`)}))),
|
||||
];
|
||||
return lines.map((line, i) => <p key={i} className="text-sm text-muted-foreground">{line}</p>);
|
||||
|
||||
Reference in new issue
Block a user