Default server grouping to game
This commit is contained in:
@@ -33,7 +33,7 @@
|
||||
let game = $state('');
|
||||
let sort = $state<FleetSort>('duration');
|
||||
let view = $state<'cards' | 'table'>('cards');
|
||||
let grouping = $state<'map' | 'game' | 'none'>('none');
|
||||
let grouping = $state<'map' | 'game' | 'none'>('game');
|
||||
let viewOptionsOpen = $state(false);
|
||||
let pinned = $state<string[]>([]);
|
||||
let preferencesReady = $state(false);
|
||||
@@ -53,7 +53,7 @@
|
||||
const params = new URL(window.location.href).searchParams;
|
||||
query = params.get('q') ?? '';
|
||||
view = params.get('view') === 'table' ? 'table' : 'cards';
|
||||
grouping = ['map', 'game'].includes(params.get('group') ?? '') ? params.get('group') as typeof grouping : 'none';
|
||||
grouping = ['map', 'game', 'none'].includes(params.get('group') ?? '') ? params.get('group') as typeof grouping : 'game';
|
||||
sort = ['name', 'players', 'round', 'duration'].includes(params.get('sort') ?? '') ? params.get('sort') as FleetSort : 'duration';
|
||||
filter = filters.some(item => item.id === params.get('filter')) ? params.get('filter') as FleetFilter : 'all';
|
||||
game = ['t5', 't6'].includes(params.get('game') ?? '') ? params.get('game')! : '';
|
||||
@@ -78,7 +78,7 @@
|
||||
if (!routerReady) return;
|
||||
untrack(() => {
|
||||
const url = new URL(window.location.href);
|
||||
const defaults: Record<string, string> = { q: '', view: 'cards', group: 'none', sort: 'duration', filter: 'all', game: '' };
|
||||
const defaults: Record<string, string> = { q: '', view: 'cards', group: 'game', sort: 'duration', filter: 'all', game: '' };
|
||||
for (const [key, value] of Object.entries(values)) {
|
||||
if (value === defaults[key]) url.searchParams.delete(key); else url.searchParams.set(key, value);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user