some initial backend scaffolding
This commit is contained in:
parent
c12d47b749
commit
48f8459b58
21 changed files with 1991 additions and 321 deletions
|
@ -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>
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ export const globalState: {
|
|||
title?: Snippet;
|
||||
searchQuery?: string;
|
||||
lastPage?: string;
|
||||
onSearchChanged?: (event: InputEvent) => void;
|
||||
} = $state({
|
||||
|
||||
})
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue