Public Access
feat(library): backlog status, rating, notes and priority in the UI
Detail page gets an edit card. The library gets status badges, status filter chips and a debounced name search, both kept in the URL.
This commit is contained in:
1 parent
7b676f0a1e
commit
f94e0aff15
9 files changed
+394
-13
No files matched your search
@@ -0,0 +1,21 @@
|
||||
export const GAME_STATUSES = ['BACKLOG', 'PLAYING', 'FINISHED', 'COMPLETED', 'DROPPED'];
|
||||
export const GAME_PRIORITIES = ['HIGH', 'MEDIUM', 'LOW'];
|
||||
|
||||
// Radix Select has no empty value, so "no priority" needs its own value in the form.
|
||||
export const NO_PRIORITY = 'NONE';
|
||||
|
||||
export const parseStatus = (value) => (GAME_STATUSES.includes(value) ? value : null);
|
||||
|
||||
export const toBacklogRequest = ({status, rating, notes, priority}) => ({
|
||||
status,
|
||||
rating: rating || null,
|
||||
notes: notes?.trim() ? notes : null,
|
||||
priority: priority === NO_PRIORITY ? null : priority,
|
||||
});
|
||||
|
||||
export const libraryQuery = ({page, size, sort, status, q}) => {
|
||||
const params = new URLSearchParams({page: String(page), size: String(size), sort});
|
||||
if (status) params.set('status', status);
|
||||
if (q?.trim()) params.set('q', q.trim());
|
||||
return params.toString();
|
||||
};
|
||||
Reference in new issue
Block a user