some initial backend scaffolding

This commit is contained in:
Lara 2024-11-06 20:40:37 +02:00
parent c12d47b749
commit 48f8459b58
Signed by: laratheprotogen
GPG key ID: 5C0296EB3165F98B
21 changed files with 1991 additions and 321 deletions

View file

@ -6,18 +6,19 @@
//eslint-disable-next-line
let { children }: { children: Snippet } = $props();
const searchChanged = () => {
if ($page.url !== '/search') {
const searchChanged = (event: InputEvent) => {
if (!$page.url.includes('/search')) {
globalState.lastPage = $page.url
router.visit('/search', {
router.visit('/search/', {
preserveState: true,
})
}
if ($page.url === '/search' && globalState.searchQuery === '') {
if ($page.url.includes('/search') && event.data === '') {
router.visit(globalState.lastPage ?? '/', {
preserveState: true,
})
}
globalState.onSearchChanged?.(event)
}
</script>

View file

@ -4,6 +4,7 @@ export const globalState: {
title?: Snippet;
searchQuery?: string;
lastPage?: string;
onSearchChanged?: (event: InputEvent) => void;
} = $state({
})

View file

@ -4,9 +4,16 @@
<script lang="ts">
import { globalState } from "@/Library/PassState.svelte";
import {default as _} from 'lodash';
let { appName } = $props();
globalState.title = title;
const onSearchChanged = (event: InputEvent) => {
}
globalState.onSearchChanged = _.throttle(onSearchChanged, 500);
</script>
<svelte:head>