diff --git a/materialious/src/lib/api/index.ts b/materialious/src/lib/api/index.ts index c3e40d9d..6a3e1705 100644 --- a/materialious/src/lib/api/index.ts +++ b/materialious/src/lib/api/index.ts @@ -179,13 +179,18 @@ export async function getHashtag(tag: string, page: number = 0): Promise<{ resul return await resp.json(); } +export interface SearchOptions { + sort_by?: 'relevance' | 'rating' | 'upload_date' | 'view_count'; + type?: 'video' | 'playlist' | 'channel' | 'all'; + duration?: 'short' | 'medium' | 'long'; + date?: 'hour' | 'today' | 'week' | 'month' | 'year'; + features?: string; + page?: string; +} + export async function getSearch( search: string, - options: { - sort_by?: 'relevance' | 'rating' | 'upload_date' | 'view_count'; - type?: 'video' | 'playlist' | 'channel' | 'all'; - page?: string; - }, + options: SearchOptions, fetchOptions?: RequestInit ): Promise<(Channel | Video | Playlist | HashTag)[]> { if (typeof options.sort_by === 'undefined') { @@ -193,7 +198,7 @@ export async function getSearch( } if (typeof options.type === 'undefined') { - options.type = 'video'; + options.type = 'all'; } if (typeof options.page === 'undefined') { diff --git a/materialious/src/lib/components/ItemsList.svelte b/materialious/src/lib/components/ItemsList.svelte index 5b2000f9..fa23bca5 100644 --- a/materialious/src/lib/components/ItemsList.svelte +++ b/materialious/src/lib/components/ItemsList.svelte @@ -263,7 +263,9 @@ }} > {#if item.type === 'video' || item.type === 'shortVideo' || item.type === 'stream'} - + {#key item.videoId} + + {/key} {#if $authStore && decodeURIComponent($authStore.username) === playlistAuthor && 'indexId' in item}
+ + +
+
+ {#each filters as filter} +
+
{filter.title}
+
    + {#each filter.options as filterOption} +
  • + +
  • + {/each} +
+
+ {/each} +
+
+ + +
{#if $searchCacheStore[data.searchStoreId]}