feat: add sidebar toggle to workspace and admin models pages (#20176)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
} from '$lib/apis/models';
|
||||
import { copyToClipboard } from '$lib/utils';
|
||||
import { page } from '$app/stores';
|
||||
import { updateUserSettings } from '$lib/apis/users';
|
||||
|
||||
import { getModels } from '$lib/apis';
|
||||
import Search from '$lib/components/icons/Search.svelte';
|
||||
@@ -218,6 +219,19 @@
|
||||
saveAs(blob, `${model.id}-${Date.now()}.json`);
|
||||
};
|
||||
|
||||
const pinModelHandler = async (modelId) => {
|
||||
let pinnedModels = $settings?.pinnedModels ?? [];
|
||||
|
||||
if (pinnedModels.includes(modelId)) {
|
||||
pinnedModels = pinnedModels.filter((id) => id !== modelId);
|
||||
} else {
|
||||
pinnedModels = [...new Set([...pinnedModels, modelId])];
|
||||
}
|
||||
|
||||
settings.set({ ...$settings, pinnedModels: pinnedModels });
|
||||
await updateUserSettings(localStorage.token, { ui: $settings });
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
await init();
|
||||
const id = $page.url.searchParams.get('id');
|
||||
@@ -427,6 +441,9 @@
|
||||
hideHandler={() => {
|
||||
hideModelHandler(model);
|
||||
}}
|
||||
pinModelHandler={() => {
|
||||
pinModelHandler(model.id);
|
||||
}}
|
||||
copyLinkHandler={() => {
|
||||
copyLinkHandler(model);
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user