frohzinn/bcbsma-storage / llama.cpp /tools /ui /src /lib /hooks /use-settings-navigation.svelte.ts
frohzinn's picture
download
raw
1.11 kB
import { page } from '$app/state';
import { beforeNavigate } from '$app/navigation';
import { settingsReferrer } from '$lib/stores/settings-referrer.svelte';
import { ROUTES } from '$lib/constants/routes';
export interface ChatSettings {
reset: () => void;
}
export function useSettingsNavigation() {
const subroute = $state({
activePanel: 'chat' as 'chat' | 'settings' | 'mcp',
chatSettingsRef: undefined as ChatSettings | undefined
});
const isSettingsRoute = $derived(!!page.route.id?.startsWith('/settings'));
beforeNavigate(({ to, from }) => {
if (to?.route?.id?.startsWith('/settings') && !from?.route?.id?.startsWith('/settings')) {
settingsReferrer.url = window.location.hash || ROUTES.START;
}
});
$effect(() => {
if (subroute.activePanel === 'settings' && subroute.chatSettingsRef) {
subroute.chatSettingsRef.reset();
}
});
// Return to chat when navigating to a new route
$effect(() => {
void page.url;
subroute.activePanel = 'chat';
});
return {
get panel() {
return subroute;
},
get isSettingsRoute() {
return isSettingsRoute;
}
};
}

Xet Storage Details

Size:
1.11 kB
·
Xet hash:
af85af62ea3c295616398bdbda3451e7562bc580bf1cf3351f1f233525c902af

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.