Public Access
refactor(limits): server limits in one file, own texts for unknown errors
This commit is contained in:
1 parent
f605917874
commit
24a98062ee
18 files changed
+84
-49
No files matched your search
@@ -11,10 +11,9 @@ import {Label} from '@/components/ui/label';
|
||||
import useSessionExpired from '../hooks/useSessionExpired.js';
|
||||
import {CORRECTABLE_MOODS, IGDB_GENRES, resetCorrection, saveCorrection} from '../utils/corrections.js';
|
||||
import {genreKey} from '../utils/stats.js';
|
||||
import {MAX_CORRECTION_GENRES, MAX_CORRECTION_LENGTH} from '../utils/limits.js';
|
||||
|
||||
const ENDLESS_CHOICES = [[null, 'UNKNOWN'], [true, 'YES'], [false, 'NO']];
|
||||
// Core refuses more.
|
||||
const MAX_GENRES = 10;
|
||||
|
||||
const initialValues = (game) => ({
|
||||
name: game.name ?? '',
|
||||
@@ -129,12 +128,12 @@ export default function GameCorrectionDialog({game, open, onOpenChange, onChange
|
||||
<DialogDescription>{t('CORRECTION.TEXT')}</DialogDescription>
|
||||
</DialogHeader>
|
||||
<div className="space-y-4">
|
||||
{row('name', <Input id="correction-name" value={values.name} maxLength={512}
|
||||
{row('name', <Input id="correction-name" value={values.name} maxLength={MAX_CORRECTION_LENGTH}
|
||||
onChange={(e) => set('name', e.target.value)}/>)}
|
||||
{row('image', <Input id="correction-image" value={values.image} maxLength={512}
|
||||
{row('image', <Input id="correction-image" value={values.image} maxLength={MAX_CORRECTION_LENGTH}
|
||||
placeholder={t('CORRECTION.IMAGE_HINT')}
|
||||
onChange={(e) => set('image', e.target.value)}/>)}
|
||||
{row('speedrun', <Input id="correction-speedrun" value={values.speedrun} maxLength={512}
|
||||
{row('speedrun', <Input id="correction-speedrun" value={values.speedrun} maxLength={MAX_CORRECTION_LENGTH}
|
||||
placeholder={t('CORRECTION.SPEEDRUN_HINT')}
|
||||
onChange={(e) => set('speedrun', e.target.value)}/>)}
|
||||
{row('moods', choices('moods', CORRECTABLE_MOODS, (mood) => t(`PLAY_NEXT.MOOD.${mood}`)))}
|
||||
@@ -150,7 +149,7 @@ export default function GameCorrectionDialog({game, open, onOpenChange, onChange
|
||||
</div>
|
||||
))}
|
||||
{row('genres', choices('genres', genreOptions,
|
||||
(genre) => t(`STATS.GENRE.${genreKey(genre)}`, {defaultValue: genre}), MAX_GENRES))}
|
||||
(genre) => t(`STATS.GENRE.${genreKey(genre)}`, {defaultValue: genre}), MAX_CORRECTION_GENRES))}
|
||||
</div>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
Reference in new issue
Block a user