Move logout to the own profile page and the mobile menu
This commit is contained in:
parent
2396407de6
commit
70cb4e8c22
3 changed files with 26 additions and 21 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { auth, openLogin, logout } from "$lib/auth.svelte";
|
import { auth, openLogin } from "$lib/auth.svelte";
|
||||||
import { groupStore } from "$lib/group.svelte";
|
import { groupStore } from "$lib/group.svelte";
|
||||||
import { groupsStore } from "$lib/groups.svelte";
|
import { groupsStore } from "$lib/groups.svelte";
|
||||||
import { resourcesStore } from "$lib/resources.svelte";
|
import { resourcesStore } from "$lib/resources.svelte";
|
||||||
|
|
@ -198,17 +198,7 @@
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
{#if auth.user}
|
{#if auth.user}
|
||||||
<div class="mt-3 flex justify-end">
|
<div class="mt-3 flex items-center gap-1">
|
||||||
<button
|
|
||||||
onclick={() => {
|
|
||||||
if (confirm("Log out?")) logout();
|
|
||||||
}}
|
|
||||||
class="rounded px-2 py-0.5 text-xs text-neutral-400 hover:bg-neutral-200 hover:text-neutral-700 dark:text-neutral-500 dark:hover:bg-neutral-700 dark:hover:text-neutral-300"
|
|
||||||
>
|
|
||||||
Log out
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
<div class="flex items-center gap-1">
|
|
||||||
<a
|
<a
|
||||||
href="/profile/{auth.user.npub}"
|
href="/profile/{auth.user.npub}"
|
||||||
class="flex min-w-0 flex-1 items-center gap-2 rounded px-2 py-1.5 text-left text-sm text-neutral-700 hover:bg-neutral-200 dark:text-neutral-300 dark:hover:bg-neutral-700"
|
class="flex min-w-0 flex-1 items-center gap-2 rounded px-2 py-1.5 text-left text-sm text-neutral-700 hover:bg-neutral-200 dark:text-neutral-300 dark:hover:bg-neutral-700"
|
||||||
|
|
|
||||||
|
|
@ -205,6 +205,16 @@
|
||||||
>
|
>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
{#if auth.user}
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onclick={onLogout}
|
||||||
|
class="hover:text-accent mt-4 py-1.5 text-left text-lg text-neutral-700 dark:text-neutral-300"
|
||||||
|
>
|
||||||
|
Log out
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<div
|
<div
|
||||||
class="mt-4 flex flex-col gap-2 border-t border-neutral-100 pt-4 dark:border-neutral-800"
|
class="mt-4 flex flex-col gap-2 border-t border-neutral-100 pt-4 dark:border-neutral-800"
|
||||||
>
|
>
|
||||||
|
|
@ -230,13 +240,6 @@
|
||||||
>{auth.user.shortName}</span
|
>{auth.user.shortName}</span
|
||||||
>
|
>
|
||||||
</a>
|
</a>
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
onclick={onLogout}
|
|
||||||
class="shrink-0 rounded px-2 py-2 text-sm text-neutral-400 hover:bg-neutral-100 hover:text-neutral-700 dark:text-neutral-500 dark:hover:bg-neutral-800 dark:hover:text-neutral-300"
|
|
||||||
>
|
|
||||||
Log out
|
|
||||||
</button>
|
|
||||||
<ThemeToggle size="md" />
|
<ThemeToggle size="md" />
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
} from "$lib/forum/userPosts";
|
} from "$lib/forum/userPosts";
|
||||||
import Meta from "$lib/components/Meta.svelte";
|
import Meta from "$lib/components/Meta.svelte";
|
||||||
import Notifications from "$lib/components/Notifications.svelte";
|
import Notifications from "$lib/components/Notifications.svelte";
|
||||||
import { auth } from "$lib/auth.svelte";
|
import { auth, logout } from "$lib/auth.svelte";
|
||||||
import { summarize } from "$lib/seo";
|
import { summarize } from "$lib/seo";
|
||||||
|
|
||||||
const pubkey = $derived<string | null>(page.data.pubkey ?? null);
|
const pubkey = $derived<string | null>(page.data.pubkey ?? null);
|
||||||
|
|
@ -169,7 +169,19 @@
|
||||||
Profile not found.
|
Profile not found.
|
||||||
</p>
|
</p>
|
||||||
{:else}
|
{:else}
|
||||||
<h1 class="text-accent py-2 text-[1.65rem]">{name}</h1>
|
<div class="flex items-start justify-between gap-4">
|
||||||
|
<h1 class="text-accent min-w-0 py-2 text-[1.65rem]">{name}</h1>
|
||||||
|
{#if isOwn}
|
||||||
|
<button
|
||||||
|
onclick={() => {
|
||||||
|
if (confirm("Log out?")) logout();
|
||||||
|
}}
|
||||||
|
class="mt-3 shrink-0 rounded px-2 py-1 text-neutral-500 hover:bg-neutral-100 hover:text-neutral-700 dark:text-neutral-400 dark:hover:bg-neutral-800 dark:hover:text-neutral-200"
|
||||||
|
>
|
||||||
|
Log out
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-2 flex items-start gap-6">
|
<div class="mt-2 flex items-start gap-6">
|
||||||
<div class="min-w-0 flex-1">
|
<div class="min-w-0 flex-1">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue