Spaces:
Running
Running
Sort by Trending to default (#1082)
Browse files* Sort by Trending to default
Switched the default sorting from 'popular' to 'trending'.
* Set TRENDING as the default sort key in load function
---------
Co-authored-by: Nathan Sarrazin <[email protected]>
src/routes/assistants/+page.server.ts
CHANGED
@@ -18,7 +18,7 @@ export const load = async ({ url, locals }) => {
|
|
18 |
const pageIndex = parseInt(url.searchParams.get("p") ?? "0");
|
19 |
const username = url.searchParams.get("user");
|
20 |
const query = url.searchParams.get("q")?.trim() ?? null;
|
21 |
-
const sort = url.searchParams.get("sort")?.trim() ?? SortKey.
|
22 |
const createdByCurrentUser = locals.user?.username && locals.user.username === username;
|
23 |
|
24 |
let user: Pick<User, "_id"> | null = null;
|
|
|
18 |
const pageIndex = parseInt(url.searchParams.get("p") ?? "0");
|
19 |
const username = url.searchParams.get("user");
|
20 |
const query = url.searchParams.get("q")?.trim() ?? null;
|
21 |
+
const sort = url.searchParams.get("sort")?.trim() ?? SortKey.TRENDING;
|
22 |
const createdByCurrentUser = locals.user?.username && locals.user.username === username;
|
23 |
|
24 |
let user: Pick<User, "_id"> | null = null;
|
src/routes/assistants/+page.svelte
CHANGED
@@ -213,8 +213,8 @@
|
|
213 |
on:change={sortAssistants}
|
214 |
class="rounded-lg border border-gray-300 bg-gray-50 px-2 py-1 text-sm text-gray-900 focus:border-blue-700 focus:ring-blue-700 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"
|
215 |
>
|
216 |
-
<option value={SortKey.POPULAR}>{SortKey.POPULAR}</option>
|
217 |
<option value={SortKey.TRENDING}>{SortKey.TRENDING}</option>
|
|
|
218 |
</select>
|
219 |
</div>
|
220 |
|
|
|
213 |
on:change={sortAssistants}
|
214 |
class="rounded-lg border border-gray-300 bg-gray-50 px-2 py-1 text-sm text-gray-900 focus:border-blue-700 focus:ring-blue-700 dark:border-gray-600 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400"
|
215 |
>
|
|
|
216 |
<option value={SortKey.TRENDING}>{SortKey.TRENDING}</option>
|
217 |
+
<option value={SortKey.POPULAR}>{SortKey.POPULAR}</option>
|
218 |
</select>
|
219 |
</div>
|
220 |
|