Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
filter by creation date
Browse files
src/lib/components/sidebar/Sidebar.svelte
CHANGED
@@ -9,6 +9,7 @@
|
|
9 |
|
10 |
import Menu from "./Menu.svelte";
|
11 |
import { browser } from '$app/environment';
|
|
|
12 |
|
13 |
let isOpen = false;
|
14 |
let user = get(userStore);
|
@@ -28,7 +29,15 @@
|
|
28 |
|
29 |
if (browser) {
|
30 |
page.subscribe((value) => {
|
31 |
-
if (isOpen)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
});
|
33 |
}
|
34 |
</script>
|
|
|
9 |
|
10 |
import Menu from "./Menu.svelte";
|
11 |
import { browser } from '$app/environment';
|
12 |
+
import { galleryStore } from '$lib/stores/use-gallery';
|
13 |
|
14 |
let isOpen = false;
|
15 |
let user = get(userStore);
|
|
|
29 |
|
30 |
if (browser) {
|
31 |
page.subscribe((value) => {
|
32 |
+
if (isOpen) {
|
33 |
+
handleClick();
|
34 |
+
galleryStore.update((value) => {
|
35 |
+
return {
|
36 |
+
...value,
|
37 |
+
open: false,
|
38 |
+
};
|
39 |
+
});
|
40 |
+
}
|
41 |
});
|
42 |
}
|
43 |
</script>
|
src/lib/utils/index.ts
CHANGED
@@ -28,6 +28,12 @@ export const MODELS_FILTER_OPTIONS = [
|
|
28 |
icon: "ph:fire-bold",
|
29 |
iconColor: "text-orange-500"
|
30 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
];
|
32 |
|
33 |
export const SIDEBAR_MENUS = [ {
|
|
|
28 |
icon: "ph:fire-bold",
|
29 |
iconColor: "text-orange-500"
|
30 |
},
|
31 |
+
{
|
32 |
+
label: "Newest",
|
33 |
+
value: "newest",
|
34 |
+
icon: "ph:clock-bold",
|
35 |
+
iconColor: "text-blue-500"
|
36 |
+
}
|
37 |
];
|
38 |
|
39 |
export const SIDEBAR_MENUS = [ {
|
src/routes/api/models/+server.ts
CHANGED
@@ -12,7 +12,7 @@ export async function GET(request : RequestEvent) {
|
|
12 |
if (token) {
|
13 |
const user = await tokenIsAvailable(token)
|
14 |
if (user) {
|
15 |
-
IS_ADMIN = process
|
16 |
}
|
17 |
}
|
18 |
|
@@ -29,7 +29,7 @@ export async function GET(request : RequestEvent) {
|
|
29 |
]
|
30 |
},
|
31 |
orderBy: {
|
32 |
-
...(filter === 'hotest' ? { downloads: 'desc' } : { likes: 'desc' })
|
33 |
},
|
34 |
skip: limit * page,
|
35 |
take: limit,
|
|
|
12 |
if (token) {
|
13 |
const user = await tokenIsAvailable(token)
|
14 |
if (user) {
|
15 |
+
IS_ADMIN = process?.env?.SECRET_HF_ADMIN ? process?.env?.SECRET_HF_ADMIN.includes(user.sub) : false
|
16 |
}
|
17 |
}
|
18 |
|
|
|
29 |
]
|
30 |
},
|
31 |
orderBy: {
|
32 |
+
...(filter === 'hotest' ? { downloads: 'desc' } : filter === 'likes' ? { likes: 'desc' } : { createdAt: 'desc' })
|
33 |
},
|
34 |
skip: limit * page,
|
35 |
take: limit,
|