Skip to content

Commit

Permalink
Went through and updated to wrapped goto call
Browse files Browse the repository at this point in the history
  • Loading branch information
aaroncox committed Feb 24, 2025
1 parent 8f58f89 commit 6cfe7e9
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 27 deletions.
5 changes: 2 additions & 3 deletions src/lib/components/accountswitch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
import UserCheck from 'lucide-svelte/icons/user-check';
import UserPlus from 'lucide-svelte/icons/user-plus';
import Search from 'lucide-svelte/icons/search';
import { goto } from '$app/navigation';
import { languageTag } from '$lib/paraglide/runtime';
import { goto } from '$lib/utils';
import { cn } from '$lib/utils/style';
import Button from './button/button.svelte';
import Text from './input/text.svelte';
Expand Down Expand Up @@ -84,7 +83,7 @@
function redirect(account: NameType) {
if (!context.settings.data.preventAccountPageSwitching) {
goto(`/${languageTag()}/${network}/account/${account}`);
goto(`/${network}/account/${account}`);
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/lib/components/networkswitch.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import { createSelect, melt, type CreateSelectProps } from '@melt-ui/svelte';
import { fade } from 'svelte/transition';
import { chainMap } from '$lib/wharf/chains';
import { goto } from '$app/navigation';
import { languageTag } from '$lib/paraglide/runtime';
import { goto } from '$lib/utils';
import type { NetworkState } from '$lib/state/network.svelte';
import * as m from '$lib/paraglide/messages';
Expand Down Expand Up @@ -37,7 +36,7 @@
);
const onSelectedChange: CreateSelectProps<string>['onSelectedChange'] = ({ next }) => {
if (next !== undefined) goto(`/${languageTag()}/${next.label}`);
if (next !== undefined) goto(`/${next.label}`);
return next;
};
Expand Down
6 changes: 3 additions & 3 deletions src/lib/components/search/input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { createDialog, melt, type CreateDialogProps } from '@melt-ui/svelte';
import type TextInput from '../input/text.svelte';
import { preventDefault } from '$lib/utils';
import { goto } from '$app/navigation';
import { goto } from '$lib/utils';
import { fade, scale } from 'svelte/transition';
import * as m from '$lib/paraglide/messages';
import {
Expand Down Expand Up @@ -160,7 +160,7 @@
context.wharf.switch(result.data as SerializedSession);
// Navigate if needed
if (!context.settings.data.preventAccountPageSwitching) {
goto(`/${languageTag()}${result.url}`);
goto(result.url);
}
return;
}
Expand All @@ -172,7 +172,7 @@
// Should this result type navigate to the URL?
if (![SearchRecordType.SWITCH, SearchRecordType.UNKNOWN].includes(result.type)) {
goto(`/${languageTag()}${result.url}`);
goto(result.url);
}
}
Expand Down
9 changes: 2 additions & 7 deletions src/routes/[network]/(account)/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { getContext } from 'svelte';
import type { UnicoveContext } from '$lib/state/client.svelte.js';
import { goto } from '$app/navigation';
import { goto } from '$lib/utils';
import { languageTag } from '$lib/paraglide/runtime.js';
import { page } from '$app/stores';
import Pageheader from '$lib/components/pageheader.svelte';
Expand All @@ -14,12 +14,7 @@
// the network matching the account.
$effect(() => {
if (context.account && !context.account.network.chain.equals(data.network.chain)) {
goto(
$page.url.pathname.replace(
`/${languageTag()}/${data.network}/`,
`/${languageTag()}/${context.account.network}/`
)
);
goto($page.url.pathname.replace(`/${data.network}/`, `/${context.account.network}/`));
}
});
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { PermissionLevel } from '@wharfkit/antelope';
import { getContext } from 'svelte';
import { goto } from '$app/navigation';
import { goto } from '$lib/utils';
import type { UnicoveContext } from '$lib/state/client.svelte';
import { Card } from '$lib/components/layout/index.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import Code from '$lib/components/code.svelte';
import Button from '$lib/components/button/button.svelte';
import TextInput from '$lib/components/input/text.svelte';
import { goto } from '$app/navigation';
import { goto } from '$lib/utils';
const { data } = $props();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import { ApprovalManager } from './manager.svelte';
import type { ActionDisplayVariants } from '$lib/types';
import { goto } from '$app/navigation';
import { goto } from '$lib/utils';
let { data } = $props();
Expand Down
9 changes: 2 additions & 7 deletions src/routes/[network]/(homepage)/(wallets)/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { getContext } from 'svelte';
import type { UnicoveContext } from '$lib/state/client.svelte.js';
import { goto } from '$app/navigation';
import { goto } from '$lib/utils';
import { languageTag } from '$lib/paraglide/runtime.js';
import { page } from '$app/stores';
import Pageheader from '$lib/components/pageheader.svelte';
Expand All @@ -14,12 +14,7 @@
// the network matching the account.
$effect(() => {
if (context.account && !context.account.network.chain.equals(data.network.chain)) {
goto(
$page.url.pathname.replace(
`/${languageTag()}/${data.network}/`,
`/${languageTag()}/${context.account.network}/`
)
);
goto($page.url.pathname.replace(`/${data.network}/`, `/${context.account.network}/`));
}
});
</script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script lang="ts">
import { getContext, onMount } from 'svelte';
import { goto } from '$app/navigation';
import { goto } from '$lib/utils';
import { getSnapsProvider, checkIsFlask } from '@wharfkit/wallet-plugin-metamask';
import Button from '$lib/components/button/button.svelte';
Expand Down

0 comments on commit 6cfe7e9

Please sign in to comment.