misc: add login message to post create
This commit is contained in:
1 parent
128167bfe9
commit
f90ecb703c
4 files changed
+18
-3
No files matched your search
@@ -6,7 +6,9 @@
|
|||||||
|
|
||||||
<a
|
<a
|
||||||
{href}
|
{href}
|
||||||
class="flex flex-row gap-2 {highlight ? 'text-sky-500' : ''} hover:underline"
|
class="inline-flex flex-row gap-2 {highlight
|
||||||
|
? 'text-sky-500'
|
||||||
|
: ''} hover:underline"
|
||||||
{...$$restProps}
|
{...$$restProps}
|
||||||
>
|
>
|
||||||
<slot name="icon" />
|
<slot name="icon" />
|
||||||
|
|||||||
@@ -98,10 +98,15 @@
|
|||||||
<span class="hidden md:inline">Create</span>
|
<span class="hidden md:inline">Create</span>
|
||||||
</Button>
|
</Button>
|
||||||
<li class="text-xs opacity-80 text-left mx-4 my-1 py-1">Create</li>
|
<li class="text-xs opacity-80 text-left mx-4 my-1 py-1">Create</li>
|
||||||
<MenuButton link href="/create/post">
|
<MenuButton link href="/create/post" disabled={$authData == undefined}>
|
||||||
<Icon src={PencilSquare} mini width={16} />
|
<Icon src={PencilSquare} mini width={16} />
|
||||||
Post
|
Post
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
|
{#if !$authData}
|
||||||
|
<span class="text-sm mx-4 my-1 py-1">
|
||||||
|
<Link highlight href="/login">Log in</Link> to create content.
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
</Menu>
|
</Menu>
|
||||||
</div>
|
</div>
|
||||||
<Menu let:toggleOpen alignment="bottom-right" itemsClass="!h-8">
|
<Menu let:toggleOpen alignment="bottom-right" itemsClass="!h-8">
|
||||||
|
|||||||
@@ -29,7 +29,7 @@
|
|||||||
{href}
|
{href}
|
||||||
class="flex flex-row gap-2 items-center px-4 py-2 w-full text-sm transition-colors {buttonColors[
|
class="flex flex-row gap-2 items-center px-4 py-2 w-full text-sm transition-colors {buttonColors[
|
||||||
color
|
color
|
||||||
]}"
|
]} {disabled ? 'opacity-50 pointer-events-none' : ''}"
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import PostForm from '$lib/components/lemmy/post/PostForm.svelte'
|
import PostForm from '$lib/components/lemmy/post/PostForm.svelte'
|
||||||
import Card from '$lib/components/ui/Card.svelte'
|
import Card from '$lib/components/ui/Card.svelte'
|
||||||
|
import { authData } from '$lib/lemmy.js'
|
||||||
|
import { onMount } from 'svelte'
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
if (!$authData) {
|
||||||
|
goto('/login')
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:head>
|
<svelte:head>
|
||||||
|
|||||||
Reference in new issue
Block a user