Files
poli0981andClaude Opus 5.5 f2a5135993 v4.4.0: admin automation, bulk remove/edit, theme icon, smooth chart tabs (#133)
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>
2026-10-13 10:08:33 +07:00

34 lines
1.1 KiB
TypeScript

/**
* What this session changed in the catalog. The published data the Catalog
* and New games pages read lags the repository until the next build, so
* edits and removals made here are layered on top of it until a reload.
*/
import { create } from 'zustand'
import type { Game } from '@/types/game'
import type { GameEdit } from './api'
interface OverridesState {
edits: Map<string, GameEdit>
removed: Set<string>
}
export const useOverrides = create<OverridesState>(() => ({ edits: new Map(), removed: new Set() }))
export function rememberEdits(edits: { url: string; edit: GameEdit }[]): void {
useOverrides.setState((s) => {
const next = new Map(s.edits)
for (const { url, edit } of edits) next.set(url, { ...next.get(url), ...edit })
return { edits: next }
})
}
export function rememberRemoved(urls: string[]): void {
useOverrides.setState((s) => ({ removed: new Set([...s.removed, ...urls]) }))
}
/** A game as the repository holds it now, as far as this session knows. */
export function withEdits(game: Game, edits: Map<string, GameEdit>): Game {
const edit = edits.get(game.url)
return edit ? { ...game, ...edit } : game
}