diff --git a/src/lib/components/header.svelte b/src/lib/components/header.svelte index b6856e9..4560459 100644 --- a/src/lib/components/header.svelte +++ b/src/lib/components/header.svelte @@ -6,6 +6,7 @@ import type { User } from '$lib/stores/user' import { goto } from '$app/navigation' + import { ROUTES } from '$lib/routes' let cls: string | undefined = undefined export { cls as class } @@ -16,9 +17,9 @@
The Outlet {#if user !== undefined} - goto('/profile')} /> + goto(ROUTES.PROFILE)} /> {:else} -
diff --git a/src/lib/components/wallet-connect.svelte b/src/lib/components/wallet-connect.svelte index 321d24e..a3c1958 100644 --- a/src/lib/components/wallet-connect.svelte +++ b/src/lib/components/wallet-connect.svelte @@ -1,5 +1,6 @@
@@ -23,7 +24,7 @@ variant="primary" label="Create post" icon={Edit} - on:click={() => goto('/post/new')} + on:click={() => goto(ROUTES.POST_NEW)} />
{:else if $profile.key === true} @@ -32,7 +33,7 @@ variant="primary" label="Select identity" icon={User} - on:click={() => goto('/profile')} + on:click={() => goto(ROUTES.PROFILE)} /> Select an identity to use with your account.
@@ -46,7 +47,7 @@ { - goto(`/profile/${user.address}`) + goto(ROUTES.PROFILE_ADDRESS(user.address)) }} /> {:else} diff --git a/src/routes/post/new/+page.svelte b/src/routes/post/new/+page.svelte index 163790b..89a49ca 100644 --- a/src/routes/post/new/+page.svelte +++ b/src/routes/post/new/+page.svelte @@ -8,6 +8,7 @@ import { posts } from '$lib/stores/post' import { goto } from '$app/navigation' import Collaborate from '$lib/components/icons/collaborate.svelte' + import { ROUTES } from '$lib/routes' let postText = '' @@ -19,7 +20,7 @@ text: postText, user: $profile.active, }) - goto('/') + goto(ROUTES.HOME) } @@ -32,10 +33,10 @@
- goto('/profile')} /> + goto(ROUTES.PROFILE)} />
{$profile.active?.name}
{$profile.active?.address}
-
diff --git a/src/routes/profile/+page.svelte b/src/routes/profile/+page.svelte index 3efb25c..f17359f 100644 --- a/src/routes/profile/+page.svelte +++ b/src/routes/profile/+page.svelte @@ -5,25 +5,30 @@ import CodeSigningService from '$lib/components/icons/code-signing-service.svelte' import GroupSecurity from '$lib/components/icons/group-security.svelte' import Identity from '$lib/components/identity.svelte' + import { ROUTES } from '$lib/routes' import { profile } from '$lib/stores/profile' import type { User } from '$lib/stores/user' const onSelectIdentityClick = (id: User) => { $profile.active = id - goto('/') + history.back() }

{$profile.key ? 'Choose' : 'Create'} identity

-
{#if $profile.key} {#each $profile.profiles as p} {/each} -
@@ -59,7 +60,7 @@ on:click={() => { const user = { address, name, avatar: image } $profile.profiles = [...$profile.profiles, user] - goto('/profile') + goto(ROUTES.PROFILE) }} />
diff --git a/tests/test.ts b/tests/test.ts index 96774b2..dd7f3be 100644 --- a/tests/test.ts +++ b/tests/test.ts @@ -1,6 +1,7 @@ +import { ROUTES } from '$lib/routes' import { expect, test } from '@playwright/test' test('index page has expected header', async ({ page }) => { - await page.goto('/') + await page.goto(ROUTES.HOME) expect(await page.textContent('span')).toBe('The Outlet') })