Admin: add games from any list or itch.io collection (Check first, batches of 200, per-game ingest tracking from scripts/state/ingest_outcomes.json), followed collections and auto-approve run by the cron in one [auto] commit, bulk remove/edit up to 100 games in one commit, New games, Activity and Settings pages. D1 migration 0002 (applied to production before this merge). Policies (ToS, Privacy, Disclaimer, EN + VI) cover approval by the maintainer's rules; LEGAL_VERSION 2026-10-13. Web: the theme button shows the theme in use, no dark-mode flash (pre-paint script, hash in three CSPs), Charts tabs stay mounted (no rebuilt charts or replayed animations), 300 ms entrances, scrollbar gutter on mouse devices. Release 4.4.0 (changelog also covers #130). [skip-discuss] Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.8 KiB
TypeScript
43 lines
1.8 KiB
TypeScript
/** The Add page's preview: each checked URL in the group that says what Add would do with it. */
|
|
import type { CheckResult } from './api'
|
|
|
|
export type CheckGroup = 'new' | 'waiting' | 'queued' | 'catalog' | 'removed' | 'rejected' | 'invalid'
|
|
|
|
export const GROUPS: { id: CheckGroup; label: string; hint: string }[] = [
|
|
{ id: 'new', label: 'New', hint: 'Added and queued for the ingest workflow.' },
|
|
{ id: 'waiting', label: 'Waiting in the queue', hint: 'Pending or failed before: approved too.' },
|
|
{ id: 'queued', label: 'Already queued', hint: 'Queued or just ingested: nothing to do.' },
|
|
{ id: 'catalog', label: 'In the catalog', hint: 'Nothing to do.' },
|
|
{ id: 'removed', label: 'Removed before', hint: 'Added only with override (it is re-checked; a still-paid game stays removed).' },
|
|
{ id: 'rejected', label: 'Rejected before', hint: 'Added only with override.' },
|
|
{ id: 'invalid', label: 'Not a game URL', hint: 'Skipped.' },
|
|
]
|
|
|
|
export function groupOf(r: CheckResult): CheckGroup {
|
|
switch (r.outcome) {
|
|
case 'queued':
|
|
return 'new'
|
|
case 'duplicate_pending':
|
|
return r.status === 'pending' || r.status === 'failed' ? 'waiting' : 'queued'
|
|
case 'duplicate_catalog':
|
|
case 'duplicate_in_request':
|
|
return 'catalog'
|
|
case 'previously_deleted':
|
|
return 'removed'
|
|
case 'rejected':
|
|
return 'rejected'
|
|
default:
|
|
return 'invalid'
|
|
}
|
|
}
|
|
|
|
/** URLs per group, in input order; a URL listed twice counts once. */
|
|
export function groupResults(results: CheckResult[]): Record<CheckGroup, string[]> {
|
|
const groups = Object.fromEntries(GROUPS.map((g) => [g.id, [] as string[]])) as Record<CheckGroup, string[]>
|
|
for (const r of results) {
|
|
if (r.outcome === 'duplicate_in_request') continue
|
|
groups[groupOf(r)].push(r.url ?? r.input)
|
|
}
|
|
return groups
|
|
}
|