design: increase prominence of create post button
This commit is contained in:
14 files changed
+111
-119
No files matched your search
Vendored
+6
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"i18n-ally.localesPaths": [
|
||||||
|
"src/lib/i18n",
|
||||||
|
"src/routes/inbox/messages"
|
||||||
|
]
|
||||||
|
}
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "photon-lemmy",
|
"name": "photon-lemmy",
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@dicebear/core": "^8.0.1",
|
"@dicebear/core": "^8.0.1",
|
||||||
|
|||||||
@@ -12,9 +12,9 @@
|
|||||||
import LabelStat from '../ui/LabelStat.svelte'
|
import LabelStat from '../ui/LabelStat.svelte'
|
||||||
import ItemList from './generic/ItemList.svelte'
|
import ItemList from './generic/ItemList.svelte'
|
||||||
import { optimizeImageURL } from './post/helpers'
|
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
|
site: SiteView
|
||||||
taglines?: Tagline[] | undefined
|
taglines?: Tagline[] | undefined
|
||||||
admins?: PersonView[] | undefined
|
admins?: PersonView[] | undefined
|
||||||
|
|||||||
@@ -35,12 +35,14 @@
|
|||||||
color="none"
|
color="none"
|
||||||
{...rest}
|
{...rest}
|
||||||
class={[
|
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 &&
|
!rest.color &&
|
||||||
'hover:text-slate-900 dark:hover:text-zinc-50 transition-colors',
|
'hover:text-slate-900 dark:hover:text-zinc-50 transition-colors',
|
||||||
isSelected
|
!rest.color &&
|
||||||
|
(isSelected
|
||||||
? 'text-primary-900 dark:text-primary-100 max-lg:bg-slate-100 max-lg:dark:bg-zinc-800'
|
? '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',
|
: 'text-slate-500 dark:text-zinc-400'),
|
||||||
clazz,
|
clazz,
|
||||||
]}
|
]}
|
||||||
shadow="none"
|
shadow="none"
|
||||||
@@ -54,7 +56,7 @@
|
|||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
<div class={(icon || customIcon) && adaptive ? 'lg:hidden' : ''}>
|
<div class={(icon || customIcon) && adaptive ? 'lg:hidden' : ''}>
|
||||||
{#if icon}
|
{#if icon}
|
||||||
<Icon src={icon} size="20" mini />
|
<Icon src={icon} size="18" micro />
|
||||||
{:else}
|
{:else}
|
||||||
{@render customIcon?.({ size: 16, isSelected })}
|
{@render customIcon?.({ size: 16, isSelected })}
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -8,16 +8,12 @@
|
|||||||
import { t } from '$lib/i18n/translations'
|
import { t } from '$lib/i18n/translations'
|
||||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
||||||
import { site } from '$lib/lemmy.svelte.js'
|
import { site } from '$lib/lemmy.svelte.js'
|
||||||
import { Badge, Menu, MenuButton, MenuDivider, Spinner } from 'mono-svelte'
|
import { Badge, Menu, Spinner } from 'mono-svelte'
|
||||||
import {
|
import {
|
||||||
Bars3,
|
Bars3,
|
||||||
Bell,
|
|
||||||
GlobeAlt,
|
GlobeAlt,
|
||||||
Icon,
|
Icon,
|
||||||
Inbox,
|
|
||||||
MagnifyingGlass,
|
MagnifyingGlass,
|
||||||
Newspaper,
|
|
||||||
PencilSquare,
|
|
||||||
Plus,
|
Plus,
|
||||||
ServerStack,
|
ServerStack,
|
||||||
ShieldCheck,
|
ShieldCheck,
|
||||||
@@ -109,93 +105,14 @@
|
|||||||
icon={GlobeAlt}
|
icon={GlobeAlt}
|
||||||
/>
|
/>
|
||||||
<NavButton href="/search" label={$t('nav.search')} icon={MagnifyingGlass} />
|
<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
|
<NavButton
|
||||||
class="relative"
|
class="relative"
|
||||||
label={$t('nav.create.label')}
|
label={$t('nav.create.label')}
|
||||||
icon={Plus}
|
icon={Plus}
|
||||||
adaptive={false}
|
adaptive={false}
|
||||||
href={site.data?.site_view.local_site.community_creation_admin_only &&
|
color="primary"
|
||||||
!(profile.current.user && isAdmin(profile.current.user))
|
href="/create"
|
||||||
? '/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>
|
|
||||||
<Menu placement="bottom">
|
<Menu placement="bottom">
|
||||||
{#snippet target()}
|
{#snippet target()}
|
||||||
<button
|
<button
|
||||||
@@ -219,6 +136,11 @@
|
|||||||
<Icon src={Bars3} micro size="18" />
|
<Icon src={Bars3} micro size="18" />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/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>
|
</button>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
{#snippet children(open)}
|
{#snippet children(open)}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { env } from '$env/dynamic/public'
|
import { env } from '$env/dynamic/public'
|
||||||
import { notifications, profile } from '$lib/auth.svelte'
|
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 SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||||
import { t } from '$lib/i18n/translations'
|
import { t } from '$lib/i18n/translations'
|
||||||
@@ -30,6 +34,7 @@
|
|||||||
Inbox,
|
Inbox,
|
||||||
Moon,
|
Moon,
|
||||||
ServerStack,
|
ServerStack,
|
||||||
|
ShieldCheck,
|
||||||
Sun,
|
Sun,
|
||||||
Swatch,
|
Swatch,
|
||||||
UserCircle,
|
UserCircle,
|
||||||
@@ -54,13 +59,18 @@
|
|||||||
</Modal>
|
</Modal>
|
||||||
{/if}
|
{/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}
|
{#if profile.current?.jwt}
|
||||||
<MenuButton href="/profile">
|
|
||||||
{#snippet prefix()}
|
|
||||||
<Icon src={UserCircle} micro size="16" />
|
|
||||||
{/snippet}
|
|
||||||
{$t('profile.profile')}
|
|
||||||
</MenuButton>
|
|
||||||
<MenuButton href="/inbox">
|
<MenuButton href="/inbox">
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
<Icon src={Inbox} micro size="16" />
|
<Icon src={Inbox} micro size="16" />
|
||||||
@@ -72,6 +82,29 @@
|
|||||||
</Badge>
|
</Badge>
|
||||||
{/if}
|
{/if}
|
||||||
</MenuButton>
|
</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">
|
<MenuButton href="/saved">
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
<Icon src={Bookmark} micro size="16" />
|
<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 { getClient } from '$lib/lemmy.svelte.js'
|
||||||
import { trycatch } from '$lib/util.svelte'
|
import { trycatch } from '$lib/util.svelte'
|
||||||
import type { Community, MyUserInfo } from 'lemmy-js-client'
|
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
|
profile.favorites?.map(i => i.id).includes(id) ?? false
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<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>
|
<div class={[!showLabel && 'sr-only']}>{@render children?.()}</div>
|
||||||
<hr
|
<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'
|
import CommunityForm from '$lib/components/lemmy/community/CommunityForm.svelte'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CommunityForm />
|
<CommunityForm>
|
||||||
|
{#snippet formtitle()}{/snippet}
|
||||||
|
</CommunityForm>
|
||||||
@@ -32,8 +32,7 @@
|
|||||||
<title>{$t('form.post.create')}</title>
|
<title>{$t('form.post.create')}</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div class="w-full max-w-5xl mx-auto h-full">
|
<PostForm
|
||||||
<PostForm
|
|
||||||
passedData={data.crosspost == true
|
passedData={data.crosspost == true
|
||||||
? post
|
? post
|
||||||
: {
|
: {
|
||||||
@@ -47,11 +46,6 @@
|
|||||||
}}
|
}}
|
||||||
passedCommunity={community}
|
passedCommunity={community}
|
||||||
onsubmit={e => goto(`/post/${e.post.id}`)}
|
onsubmit={e => goto(`/post/${e.post.id}`)}
|
||||||
>
|
>
|
||||||
{#snippet formtitle()}
|
{#snippet formtitle()}{/snippet}
|
||||||
<Header class="text-3xl font-bold" pageHeader>
|
</PostForm>
|
||||||
{$t('routes.createPost')}
|
|
||||||
</Header>
|
|
||||||
{/snippet}
|
|
||||||
</PostForm>
|
|
||||||
</div>
|
|
||||||
@@ -9,9 +9,7 @@
|
|||||||
<title>{$t('routes.moderation.title')}</title>
|
<title>{$t('routes.moderation.title')}</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div class="w-full space-y-4 pb-8">
|
<Tabs
|
||||||
<Tabs
|
|
||||||
class="overflow-auto"
|
|
||||||
routes={[
|
routes={[
|
||||||
{
|
{
|
||||||
href: '/moderation',
|
href: '/moderation',
|
||||||
@@ -22,6 +20,7 @@
|
|||||||
name: $t('routes.communities.title'),
|
name: $t('routes.communities.title'),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
|
<div class="w-full space-y-4 pb-8">
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
</div>
|
</div>
|
||||||
@@ -19,10 +19,10 @@
|
|||||||
import {
|
import {
|
||||||
ArrowPath,
|
ArrowPath,
|
||||||
ArrowTrendingDown,
|
ArrowTrendingDown,
|
||||||
|
ChatBubbleOvalLeft,
|
||||||
Clock,
|
Clock,
|
||||||
Fire,
|
Fire,
|
||||||
Icon,
|
Icon,
|
||||||
PlusCircle,
|
|
||||||
Star,
|
Star,
|
||||||
Trophy,
|
Trophy,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
)}
|
)}
|
||||||
onclick={() => (commenting = true)}
|
onclick={() => (commenting = true)}
|
||||||
>
|
>
|
||||||
<Icon src={PlusCircle} size="16" micro />
|
<Icon src={ChatBubbleOvalLeft} size="16" micro />
|
||||||
{$t('routes.post.addComment')}
|
{$t('routes.post.addComment')}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user