feat(search): add year/group headers in document list when sorted by date, sender, or receiver #236
@@ -19,7 +19,12 @@ export async function load({ url, fetch }) {
|
|||||||
const sort: ValidSort = (VALID_SORTS as readonly string[]).includes(rawSort)
|
const sort: ValidSort = (VALID_SORTS as readonly string[]).includes(rawSort)
|
||||||
? (rawSort as ValidSort)
|
? (rawSort as ValidSort)
|
||||||
: 'DATE';
|
: 'DATE';
|
||||||
const dir = url.searchParams.get('dir') || 'desc';
|
const VALID_DIRS = ['asc', 'desc'] as const;
|
||||||
|
type ValidDir = (typeof VALID_DIRS)[number];
|
||||||
|
const rawDir = url.searchParams.get('dir') ?? 'desc';
|
||||||
|
const dir: ValidDir = (VALID_DIRS as readonly string[]).includes(rawDir)
|
||||||
|
? (rawDir as ValidDir)
|
||||||
|
: 'desc';
|
||||||
const tagQ = url.searchParams.get('tagQ') || '';
|
const tagQ = url.searchParams.get('tagQ') || '';
|
||||||
|
|
||||||
const isDashboard = !q && !from && !to && !senderId && !receiverId && !tags.length && !tagQ;
|
const isDashboard = !q && !from && !to && !senderId && !receiverId && !tags.length && !tagQ;
|
||||||
|
|||||||
Reference in New Issue
Block a user