Skip to content

Commit 4f0a976

Browse files
committed
the button to the home route is now using the function, PACKAGE
1 parent 5db6810 commit 4f0a976

File tree

6 files changed

+45
-16
lines changed

6 files changed

+45
-16
lines changed

renderer/src/routes/face-explore/index.svelte

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { midpointEmbedding, sampleClusterMedoids } from './explore-utils';
1010
1111
import { facesSetUp, getFaceThumbnail } from '$lib/utils/faces';
1212
import StreamResultCard from '$lib/components/StreamResultCard.svelte';
13-
import { url } from '@roxi/routify';
13+
import { goto, url } from '@roxi/routify';
1414
1515
const VIDEO_ICON = '/assets/icons/videoplay512.png';
1616
let mediaDir: string = $state(getContext('mediaDir'));
@@ -430,7 +430,11 @@ function buildOptions(): Options {
430430
}
431431
432432
433+
const go = $goto; // top-level access is allowed
433434
435+
function home() {
436+
go('/'); // navigate when the button is clicked
437+
}
434438
</script>
435439

436440

@@ -444,7 +448,7 @@ function buildOptions(): Options {
444448
<div class="d-block d-lg-none h-100">
445449
<Row class="h-100 align-items-center ">
446450
<Col xs="auto" class="d-flex justify-content-start">
447-
<Button color="primary" size="sm" href={$url("/")}>
451+
<Button color="primary" size="sm" on:click={home}>
448452
<Icon name="house-fill" class="fs-6"/>
449453
</Button>
450454
</Col>
@@ -467,7 +471,7 @@ function buildOptions(): Options {
467471
<div class="d-none d-lg-block h-100">
468472
<Row class="h-100 align-items-center gx-3">
469473
<Col xs="auto" class="d-flex justify-content-start">
470-
<Button color="primary" size="md" href={$url("/")}>
474+
<Button color="primary" size="md" on:click={home}>
471475
<Icon name="house-fill" class="fs-3"/>
472476
</Button>
473477
</Col>

renderer/src/routes/import-export/index.svelte

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import SpinnerSimple from "$lib/components/SpinnerSimple.svelte";
44
import { clearSessionMediaCache } from "$lib/utils/temp-mediafiles";
55
import { Button, Col, Container, Icon, Input, Row, TabContent, TabPane, Toast } from "@sveltestrap/sveltestrap";
66
7-
import { url } from '@roxi/routify';
7+
import { url, goto } from '@roxi/routify';
88
99
let status: string|number = 'alpha';
1010
let isOpen = $state(false);
@@ -47,7 +47,11 @@ async function importTaga() {
4747
assignFreshImport(true);
4848
}
4949
50+
const go = $goto; // top-level access is allowed
5051
52+
function home() {
53+
go('/'); // navigate when the button is clicked
54+
}
5155
</script>
5256

5357

@@ -61,7 +65,7 @@ async function importTaga() {
6165
<SpinnerSimple busy={processingSpinner} message="Processing..." color="rgba(0,255,128,.9)" block={true}/>
6266

6367

64-
<Button color="primary" size="lg" href={$url("/")} class="ms-3 mt-3 mb-4">
68+
<Button color="primary" size="lg" on:click={home} class="ms-3 mt-3 mb-4">
6569
<Icon name="house-fill" class="fs-3"/>
6670
</Button>
6771

renderer/src/routes/streaming/index.svelte

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import StreamResultCard from '$lib/components/StreamResultCard.svelte';
66
import { facesSetUp, detectFacesInImage, embedFace } from '$lib/utils/faces';
77
import { boxDistance } from '$lib/utils/ml-utils';
88
import type { DisplayServer} from '$lib/utils/localStorageManager';
9-
import { url } from '@roxi/routify';
9+
import { goto, url } from '@roxi/routify';
1010
1111
const optionLabels = ["none", "camera", "screen"];
1212
@@ -499,6 +499,11 @@ async function maybeEmbed(faceId: number) {
499499
}
500500
501501
502+
const go = $goto; // top-level access is allowed
503+
504+
function home() {
505+
go('/'); // navigate when the button is clicked
506+
}
502507
</script>
503508

504509

@@ -527,7 +532,7 @@ async function maybeEmbed(faceId: number) {
527532
<div class="d-block d-lg-none h-100">
528533
<Row class="h-100 align-items-center ">
529534
<Col xs="auto" class="d-flex justify-content-start">
530-
<Button color="primary" size="sm" href={$url("/")}>
535+
<Button color="primary" size="sm" on:click={home}>
531536
<Icon name="house-fill" class="fs-6"/>
532537
</Button>
533538
</Col>
@@ -556,7 +561,7 @@ async function maybeEmbed(faceId: number) {
556561
<div class="d-none d-lg-block h-100">
557562
<Row class="h-100 align-items-center gx-3">
558563
<Col xs="auto" class="d-flex justify-content-start">
559-
<Button color="primary" size="md" href={$url("/")}>
564+
<Button color="primary" size="md" on:click={home}>
560565
<Icon name="house-fill" class="fs-3"/>
561566
</Button>
562567
</Col>

renderer/src/routes/tagging/[slug].svelte

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import { Container, Row, Col, Button, Input, Icon, Image, Modal, ModalBody, ModalHeader, ModalFooter, Accordion, AccordionItem, Figure, Tooltip, Toast } from '@sveltestrap/sveltestrap';
3-
import { params } from '@roxi/routify';
3+
import { goto, params } from '@roxi/routify';
44
55
import MediaView from '$lib/MediaView.svelte';
66
import { getContext, onMount } from 'svelte';
@@ -344,6 +344,11 @@ async function saveFile() {
344344
saveToastOpen = true;
345345
}
346346
347+
const go = $goto; // top-level access is allowed
348+
349+
function home() {
350+
go('/'); // navigate when the button is clicked
351+
}
347352
</script>
348353

349354
<TaggingSlugContextMenu {saveFile}/>
@@ -383,7 +388,7 @@ async function saveFile() {
383388
<!-- Top row: Back and Delete -->
384389
<Row class="mb-1 align-items-center">
385390
<Col xs="6" class="d-flex justify-content-start">
386-
<Button color="primary" size="sm" href={$url("/")}><Icon name="house-fill" class="fs-6"/></Button>
391+
<Button color="primary" size="sm" on:click={home}><Icon name="house-fill" class="fs-6"/></Button>
387392

388393
<Input disabled={isProcessing} type="select" class="w-auto ms-1 me-2" bind:value={mode}>
389394
{#each ["edit", "gallery"] as option}
@@ -410,7 +415,7 @@ async function saveFile() {
410415
<div class="d-none d-sm-block">
411416
<Row class="mb-2 align-items-center">
412417
<Col xs="4" class="d-flex justify-content-start">
413-
<Button color="primary" size="md" href={$url("/")}><Icon name="house-fill" class="fs-3"/></Button>
418+
<Button color="primary" size="md" on:click={home}><Icon name="house-fill" class="fs-3"/></Button>
414419

415420
<Input disabled={isProcessing} type="select" class="w-auto ms-2 me-2" bind:value={mode}>
416421
{#each ["edit", "gallery"] as option}

renderer/src/routes/tagging/index.svelte

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getContext, onMount } from 'svelte';
99
import { type MediaFile } from '$lib/types/general-types';
1010
import { fillSampleMediaFiles, getNewMediaFiles } from '$lib/utils/temp-mediafiles';
1111
import { assignFreshImport, freshImport } from '$lib/state/states.svelte';
12-
import { url } from '@roxi/routify';
12+
import { goto, url } from '@roxi/routify';
1313
1414
1515
let mediaDir: string = $state(getContext('mediaDir'));
@@ -58,14 +58,19 @@ function truncateDescription(description: string): string {
5858
return description.slice(0, 40);
5959
}
6060
61+
const go = $goto; // top-level access is allowed
62+
63+
function home() {
64+
go('/'); // navigate when the button is clicked
65+
}
6166
</script>
6267

6368
<Container>
6469
<!-- Small screens: vertical layout -->
6570
<div class="pt-3">
6671
<div class="d-block d-md-none mb-4">
6772
<div class="d-flex flex-row justify-content-evenly">
68-
<Button color="primary" class="w-25" href={$url("/")}><Icon name="house-fill" class="fs-4"/></Button>
73+
<Button color="primary" class="w-25" on:click={home}><Icon name="house-fill" class="fs-4"/></Button>
6974
<Button disabled={isProcessing} id="btn-dice-sm" color="primary" class="w-25" on:click={setCards}><Icon name="dice-5-fill"/></Button>
7075
<Tooltip target="btn-dice-sm" placement="bottom">See New</Tooltip>
7176
</div>
@@ -75,7 +80,7 @@ function truncateDescription(description: string): string {
7580
<div class="d-none d-md-block mb-4">
7681
<Row class="align-items-center">
7782
<Col md="2" class="text-start">
78-
<Button color="primary" size="lg" href={$url("/")}><Icon name="house-fill" class="fs-4"/></Button>
83+
<Button color="primary" size="lg" on:click={home}><Icon name="house-fill" class="fs-4"/></Button>
7984
</Col>
8085
<Col md="2" class="text-center">
8186
<Button disabled={isProcessing} id="btn-dice-md" color="primary" size="lg" style="white-space: nowrap;" on:click={setCards}><Icon name="dice-5-fill" /></Button>

renderer/src/routes/user-settings/index.svelte

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import {Container, Row, Col, Button, Modal, ModalHeader, ModalBody, ModalFooter, Icon, Input} from '@sveltestrap/sveltestrap';
33
import { onMount } from 'svelte';
4-
import { url } from '@roxi/routify';
4+
import { goto, url } from '@roxi/routify';
55
66
let showConfirm = $state(false);
77
let baseDataPath = $state('');
@@ -24,12 +24,18 @@
2424
console.log(newBaseDir);
2525
showConfirm = false;
2626
}
27+
28+
const go = $goto; // top-level access is allowed
29+
30+
function home() {
31+
go('/'); // navigate when the button is clicked
32+
}
2733
</script>
2834

2935

3036
<Container class="my-4">
3137

32-
<Button color="primary" size="lg" href={$url("/")} class="mt-1 mb-4">
38+
<Button color="primary" size="lg" on:click={home} class="mt-1 mb-4">
3339
<Icon name="house-fill" class="fs-3"/>
3440
</Button>
3541

0 commit comments

Comments
 (0)