design: increase prominence of create post button
This commit is contained in:
14 files changed
+140
-148
No files matched your search
@@ -12,9 +12,9 @@
|
||||
import LabelStat from '../ui/LabelStat.svelte'
|
||||
import ItemList from './generic/ItemList.svelte'
|
||||
import { optimizeImageURL } from './post/helpers'
|
||||
import type { ClassValue } from 'svelte/elements'
|
||||
import type { ClassValue, HTMLAttributes } from 'svelte/elements'
|
||||
|
||||
interface Props extends HTMLDivElement {
|
||||
interface Props extends HTMLAttributes<HTMLDivElement> {
|
||||
site: SiteView
|
||||
taglines?: Tagline[] | undefined
|
||||
admins?: PersonView[] | undefined
|
||||
|
||||
@@ -35,12 +35,14 @@
|
||||
color="none"
|
||||
{...rest}
|
||||
class={[
|
||||
'shrink-0 rounded-full w-10 h-10 lg:w-max lg:h-8 lg:rounded-xl',
|
||||
'shrink-0 lg:rounded-xl w-10 h-10 ',
|
||||
adaptive ? 'lg:w-max lg:h-8' : 'lg:w-8 lg:h-8 rounded-full',
|
||||
!rest.color &&
|
||||
'hover:text-slate-900 dark:hover:text-zinc-50 transition-colors',
|
||||
isSelected
|
||||
? 'text-primary-900 dark:text-primary-100 max-lg:bg-slate-100 max-lg:dark:bg-zinc-800'
|
||||
: 'text-slate-500 dark:text-zinc-400',
|
||||
!rest.color &&
|
||||
(isSelected
|
||||
? 'text-primary-900 dark:text-primary-100 max-lg:bg-slate-100 max-lg:dark:bg-zinc-800'
|
||||
: 'text-slate-500 dark:text-zinc-400'),
|
||||
clazz,
|
||||
]}
|
||||
shadow="none"
|
||||
@@ -54,7 +56,7 @@
|
||||
{#snippet prefix()}
|
||||
<div class={(icon || customIcon) && adaptive ? 'lg:hidden' : ''}>
|
||||
{#if icon}
|
||||
<Icon src={icon} size="20" mini />
|
||||
<Icon src={icon} size="18" micro />
|
||||
{:else}
|
||||
{@render customIcon?.({ size: 16, isSelected })}
|
||||
{/if}
|
||||
|
||||
@@ -8,16 +8,12 @@
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
||||
import { site } from '$lib/lemmy.svelte.js'
|
||||
import { Badge, Menu, MenuButton, MenuDivider, Spinner } from 'mono-svelte'
|
||||
import { Badge, Menu, Spinner } from 'mono-svelte'
|
||||
import {
|
||||
Bars3,
|
||||
Bell,
|
||||
GlobeAlt,
|
||||
Icon,
|
||||
Inbox,
|
||||
MagnifyingGlass,
|
||||
Newspaper,
|
||||
PencilSquare,
|
||||
Plus,
|
||||
ServerStack,
|
||||
ShieldCheck,
|
||||
@@ -109,93 +105,14 @@
|
||||
icon={GlobeAlt}
|
||||
/>
|
||||
<NavButton href="/search" label={$t('nav.search')} icon={MagnifyingGlass} />
|
||||
{#if profile.current.jwt}
|
||||
{@const linkOnly =
|
||||
!profile.current.user ||
|
||||
!(isAdmin(profile.current.user) || amModOfAny(profile.current.user))}
|
||||
<Menu manual={linkOnly} placement="top">
|
||||
{#snippet target()}
|
||||
<NavButton
|
||||
label={$t('nav.notifications')}
|
||||
icon={Bell}
|
||||
class="relative"
|
||||
adaptive={false}
|
||||
href={linkOnly ? '/inbox' : undefined}
|
||||
>
|
||||
{#if Math.max(...Object.values($notifications)) > 0}
|
||||
<div
|
||||
class="rounded-full w-2 h-2 bg-red-500 absolute top-1 left-3 z-10"
|
||||
></div>
|
||||
{/if}
|
||||
</NavButton>
|
||||
{/snippet}
|
||||
<MenuButton href="/inbox" icon={Inbox}>
|
||||
{$t('profile.inbox')}
|
||||
{#snippet suffix()}
|
||||
{@render notifBadge($notifications.inbox)}
|
||||
{/snippet}
|
||||
</MenuButton>
|
||||
{#if amModOfAny(profile.current.user)}
|
||||
<MenuButton href="/moderation" icon={ShieldCheck}>
|
||||
{$t('routes.moderation.feed')}
|
||||
{#snippet suffix()}
|
||||
{@render notifBadge($notifications.reports)}
|
||||
{/snippet}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if profile.current.user && isAdmin(profile.current.user)}
|
||||
<MenuButton href="/admin/applications" icon={ServerStack}>
|
||||
{$t('routes.admin.applications.title')}
|
||||
{#snippet suffix()}
|
||||
{@render notifBadge($notifications.applications)}
|
||||
{/snippet}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
</Menu>
|
||||
{/if}
|
||||
<Menu
|
||||
manual={site.data?.site_view.local_site.community_creation_admin_only &&
|
||||
!(profile.current.user && isAdmin(profile.current.user))}
|
||||
placement="top"
|
||||
>
|
||||
{#snippet target()}
|
||||
<NavButton
|
||||
class="relative"
|
||||
label={$t('nav.create.label')}
|
||||
icon={Plus}
|
||||
adaptive={false}
|
||||
href={site.data?.site_view.local_site.community_creation_admin_only &&
|
||||
!(profile.current.user && isAdmin(profile.current.user))
|
||||
? '/create/post'
|
||||
: undefined}
|
||||
/>
|
||||
{/snippet}
|
||||
<MenuDivider>{$t('nav.create.label')}</MenuDivider>
|
||||
<MenuButton link href="/create/post" disabled={!profile.current?.jwt}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={PencilSquare} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('nav.create.post')}
|
||||
</MenuButton>
|
||||
<MenuButton
|
||||
link
|
||||
href="/create/community"
|
||||
disabled={!profile.current?.jwt ||
|
||||
!profile.current?.user ||
|
||||
(site.data?.site_view.local_site.community_creation_admin_only &&
|
||||
!isAdmin(profile.current.user))}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Newspaper} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('nav.create.community')}
|
||||
</MenuButton>
|
||||
{#if !profile.current?.jwt}
|
||||
<span class="text-sm mx-4 my-1 py-1">
|
||||
{$t('nav.create.logingate')}
|
||||
</span>
|
||||
{/if}
|
||||
</Menu>
|
||||
<NavButton
|
||||
class="relative"
|
||||
label={$t('nav.create.label')}
|
||||
icon={Plus}
|
||||
adaptive={false}
|
||||
color="primary"
|
||||
href="/create"
|
||||
/>
|
||||
<Menu placement="bottom">
|
||||
{#snippet target()}
|
||||
<button
|
||||
@@ -219,6 +136,11 @@
|
||||
<Icon src={Bars3} micro size="18" />
|
||||
</div>
|
||||
{/if}
|
||||
{#if Math.max(...Object.values($notifications)) > 0}
|
||||
<div
|
||||
class="w-2 h-2 absolute top-0.5 right-0.5 bg-red-500 rounded-full"
|
||||
></div>
|
||||
{/if}
|
||||
</button>
|
||||
{/snippet}
|
||||
{#snippet children(open)}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { env } from '$env/dynamic/public'
|
||||
import { notifications, profile } from '$lib/auth.svelte'
|
||||
import {
|
||||
amModOfAny,
|
||||
isAdmin,
|
||||
} from '$lib/components/lemmy/moderation/moderation'
|
||||
|
||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
@@ -30,6 +34,7 @@
|
||||
Inbox,
|
||||
Moon,
|
||||
ServerStack,
|
||||
ShieldCheck,
|
||||
Sun,
|
||||
Swatch,
|
||||
UserCircle,
|
||||
@@ -54,13 +59,18 @@
|
||||
</Modal>
|
||||
{/if}
|
||||
|
||||
{#snippet notifBadge(number: number)}
|
||||
{#if number > 0}
|
||||
<Badge
|
||||
color="red-subtle"
|
||||
class="min-w-5 h-5 p-0! px-0.5 grid place-items-center ml-auto"
|
||||
>
|
||||
{number > 99 ? '∞' : number}
|
||||
</Badge>
|
||||
{/if}
|
||||
{/snippet}
|
||||
|
||||
{#if profile.current?.jwt}
|
||||
<MenuButton href="/profile">
|
||||
{#snippet prefix()}
|
||||
<Icon src={UserCircle} micro size="16" />
|
||||
{/snippet}
|
||||
{$t('profile.profile')}
|
||||
</MenuButton>
|
||||
<MenuButton href="/inbox">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Inbox} micro size="16" />
|
||||
@@ -72,6 +82,29 @@
|
||||
</Badge>
|
||||
{/if}
|
||||
</MenuButton>
|
||||
{#if amModOfAny(profile.current.user)}
|
||||
<MenuButton href="/moderation" icon={ShieldCheck}>
|
||||
{$t('routes.moderation.feed')}
|
||||
{#snippet suffix()}
|
||||
{@render notifBadge($notifications.reports)}
|
||||
{/snippet}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if profile.current.user && isAdmin(profile.current.user)}
|
||||
<MenuButton href="/admin/applications" icon={ServerStack}>
|
||||
{$t('routes.admin.applications.title')}
|
||||
{#snippet suffix()}
|
||||
{@render notifBadge($notifications.applications)}
|
||||
{/snippet}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
<MenuDivider>{$t('profile.profile')}</MenuDivider>
|
||||
<MenuButton href="/profile">
|
||||
{#snippet prefix()}
|
||||
<Icon src={UserCircle} micro size="16" />
|
||||
{/snippet}
|
||||
{$t('profile.profile')}
|
||||
</MenuButton>
|
||||
<MenuButton href="/saved">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Bookmark} micro size="16" />
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { profile, type Profile } from '$lib/auth.svelte'
|
||||
import { profile, type ProfileInfo } from '$lib/auth.svelte'
|
||||
import { getClient } from '$lib/lemmy.svelte.js'
|
||||
import { trycatch } from '$lib/util.svelte'
|
||||
import type { Community, MyUserInfo } from 'lemmy-js-client'
|
||||
@@ -51,5 +51,5 @@ export const addAdmin = async (handle: string, added: boolean) =>
|
||||
})
|
||||
})
|
||||
|
||||
export const hasFavorite = (profile: Profile, id: number): boolean =>
|
||||
export const hasFavorite = (profile: ProfileInfo, id: number): boolean =>
|
||||
profile.favorites?.map(i => i.id).includes(id) ?? false
|
||||
@@ -8,7 +8,7 @@
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="text-slate-800 dark:text-zinc-200 text-xs font-medium m-3 my-2 mb-1 flex items-center gap-1"
|
||||
class="text-slate-800 dark:text-zinc-200 text-xs font-medium mx-3 my-1.5 flex items-center gap-1"
|
||||
>
|
||||
<div class={[!showLabel && 'sr-only']}>{@render children?.()}</div>
|
||||
<hr
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<script lang="ts">
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
|
||||
let { children } = $props()
|
||||
</script>
|
||||
|
||||
<Header pageHeader>
|
||||
{$t('nav.create.label')}
|
||||
</Header>
|
||||
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
<Tabs
|
||||
style="subpage"
|
||||
routes={[
|
||||
{
|
||||
href: '/create/post',
|
||||
name: $t('nav.create.post'),
|
||||
},
|
||||
{
|
||||
href: '/create/community',
|
||||
name: $t('nav.create.community'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<div class="h-3 sm:h-6"></div>
|
||||
|
||||
{@render children?.()}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { redirect } from '@sveltejs/kit'
|
||||
|
||||
export function load() {
|
||||
redirect(302, '/create/post')
|
||||
}
|
||||
@@ -2,4 +2,6 @@
|
||||
import CommunityForm from '$lib/components/lemmy/community/CommunityForm.svelte'
|
||||
</script>
|
||||
|
||||
<CommunityForm />
|
||||
<CommunityForm>
|
||||
{#snippet formtitle()}{/snippet}
|
||||
</CommunityForm>
|
||||
@@ -32,26 +32,20 @@
|
||||
<title>{$t('form.post.create')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="w-full max-w-5xl mx-auto h-full">
|
||||
<PostForm
|
||||
passedData={data.crosspost == true
|
||||
? post
|
||||
: {
|
||||
body: '',
|
||||
community: null,
|
||||
image: null,
|
||||
loading: false,
|
||||
nsfw: false,
|
||||
title: '',
|
||||
url: undefined,
|
||||
}}
|
||||
passedCommunity={community}
|
||||
onsubmit={e => goto(`/post/${e.post.id}`)}
|
||||
>
|
||||
{#snippet formtitle()}
|
||||
<Header class="text-3xl font-bold" pageHeader>
|
||||
{$t('routes.createPost')}
|
||||
</Header>
|
||||
{/snippet}
|
||||
</PostForm>
|
||||
</div>
|
||||
<PostForm
|
||||
passedData={data.crosspost == true
|
||||
? post
|
||||
: {
|
||||
body: '',
|
||||
community: null,
|
||||
image: null,
|
||||
loading: false,
|
||||
nsfw: false,
|
||||
title: '',
|
||||
url: undefined,
|
||||
}}
|
||||
passedCommunity={community}
|
||||
onsubmit={e => goto(`/post/${e.post.id}`)}
|
||||
>
|
||||
{#snippet formtitle()}{/snippet}
|
||||
</PostForm>
|
||||
@@ -9,19 +9,18 @@
|
||||
<title>{$t('routes.moderation.title')}</title>
|
||||
</svelte:head>
|
||||
|
||||
<Tabs
|
||||
routes={[
|
||||
{
|
||||
href: '/moderation',
|
||||
name: $t('routes.moderation.feed'),
|
||||
},
|
||||
{
|
||||
href: '/moderation/communities',
|
||||
name: $t('routes.communities.title'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<div class="w-full space-y-4 pb-8">
|
||||
<Tabs
|
||||
class="overflow-auto"
|
||||
routes={[
|
||||
{
|
||||
href: '/moderation',
|
||||
name: $t('routes.moderation.feed'),
|
||||
},
|
||||
{
|
||||
href: '/moderation/communities',
|
||||
name: $t('routes.communities.title'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
{@render children?.()}
|
||||
</div>
|
||||
@@ -19,10 +19,10 @@
|
||||
import {
|
||||
ArrowPath,
|
||||
ArrowTrendingDown,
|
||||
ChatBubbleOvalLeft,
|
||||
Clock,
|
||||
Fire,
|
||||
Icon,
|
||||
PlusCircle,
|
||||
Star,
|
||||
Trophy,
|
||||
} from 'svelte-hero-icons'
|
||||
@@ -77,7 +77,7 @@
|
||||
)}
|
||||
onclick={() => (commenting = true)}
|
||||
>
|
||||
<Icon src={PlusCircle} size="16" micro />
|
||||
<Icon src={ChatBubbleOvalLeft} size="16" micro />
|
||||
{$t('routes.post.addComment')}
|
||||
</Button>
|
||||
|
||||
|
||||
Reference in new issue
Block a user