feat: color overhaul
This commit is contained in:
1 parent
8fc452951b
commit
e5fbf7493c
22 files changed
+234
-243
No files matched your search
@@ -42,9 +42,14 @@
|
||||
</svelte:head>
|
||||
|
||||
<div
|
||||
class="flex flex-col min-h-screen {$userSettings.systemUI
|
||||
class="flex flex-col min-h-screen
|
||||
font-inter
|
||||
{$userSettings.font == 'inter'
|
||||
? 'font-inter'
|
||||
: $userSettings.font == 'system'
|
||||
? 'font-system'
|
||||
: 'font-sans'}"
|
||||
: 'font-sans'}
|
||||
"
|
||||
>
|
||||
<Navbar />
|
||||
<ToastContainer />
|
||||
@@ -53,7 +58,7 @@
|
||||
<Sidebar />
|
||||
<main
|
||||
class="p-3 sm:p-6 min-w-0 w-full flex-[3] sm:rounded-tl-lg
|
||||
border-slate-200 dark:border-zinc-900 sm:border-l border-t"
|
||||
border-slate-200 dark:border-zinc-900 sm:border-l border-t bg-slate-25 dark:bg-zinc-950"
|
||||
>
|
||||
<slot />
|
||||
</main>
|
||||
|
||||
@@ -4,42 +4,71 @@
|
||||
import { page } from '$app/stores'
|
||||
import {
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
Check,
|
||||
GlobeAmericas,
|
||||
Icon,
|
||||
InformationCircle,
|
||||
PencilSquare,
|
||||
Plus,
|
||||
QuestionMarkCircle,
|
||||
UserGroup,
|
||||
} from 'svelte-hero-icons'
|
||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||
import Subscribe from './Subscribe.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { searchParam } from '$lib/util.js'
|
||||
import {
|
||||
DOMAIN_REGEX,
|
||||
DOMAIN_REGEX_FORMS,
|
||||
isSubscribed,
|
||||
searchParam,
|
||||
} from '$lib/util.js'
|
||||
import { addSubscription } from '$lib/lemmy/user.js'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { Button, Select, TextInput } from 'mono-svelte'
|
||||
import { Button, Material, Popover, Select, TextInput } from 'mono-svelte'
|
||||
import Sort from '$lib/components/lemmy/Sort.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte'
|
||||
|
||||
export let data
|
||||
|
||||
let search = ''
|
||||
let search = data.query || ''
|
||||
let instance = ''
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
<title>Communities</title>
|
||||
</svelte:head>
|
||||
|
||||
<h1 class="text-2xl font-bold">Communities</h1>
|
||||
<p class="text-slate-600 dark:text-zinc-400 mt-2">
|
||||
Can't find a community on your home instance? Go to the <a
|
||||
href="/search"
|
||||
class="text-blue-500 hover:underline"
|
||||
<h1 class="text-2xl font-bold">
|
||||
<span>Communities</span>
|
||||
<Popover
|
||||
openOnHover
|
||||
class="!inline-flex"
|
||||
targetClass="inline"
|
||||
origin="bottom-center"
|
||||
>
|
||||
search
|
||||
</a>
|
||||
page, and search with this syntax:
|
||||
<code>!community@instance.com</code>
|
||||
</p>
|
||||
<Icon
|
||||
src={InformationCircle}
|
||||
size="20"
|
||||
mini
|
||||
slot="target"
|
||||
class="!inline"
|
||||
/>
|
||||
<Material slot="popover" color="distinct" class="w-72">
|
||||
<p class="font-normal">
|
||||
Can't find a community on your home instance? Go to the <a
|
||||
href="/search"
|
||||
class="text-blue-500 hover:underline"
|
||||
>
|
||||
search
|
||||
</a>
|
||||
page, and search with this syntax:
|
||||
<code>!community@instance.com</code>
|
||||
</p>
|
||||
</Material>
|
||||
</Popover>
|
||||
</h1>
|
||||
<div class="flex flex-row flex-wrap gap-4 mt-4">
|
||||
<Select
|
||||
bind:value={data.type}
|
||||
@@ -54,124 +83,33 @@
|
||||
<option value="Subscribed">Subscribed</option>
|
||||
</Select>
|
||||
<Sort selected={data.sort} />
|
||||
<div class="flex flex-col sm:flex-row gap-2 sm:ml-auto items-center">
|
||||
<TextInput
|
||||
bind:value={search}
|
||||
on:change={() => () => searchParam($page.url, 'q', search, 'page')}
|
||||
/>
|
||||
<Button
|
||||
on:click={() => searchParam($page.url, 'q', search, 'page')}
|
||||
color="ghost"
|
||||
class="h-max"
|
||||
>
|
||||
Search
|
||||
</Button>
|
||||
</div>
|
||||
<form
|
||||
on:submit|preventDefault={() =>
|
||||
goto(`/search?q=${search}&type=Communities`)}
|
||||
class="flex flex-col sm:flex-row gap-2 sm:ml-auto items-center"
|
||||
>
|
||||
<TextInput bind:value={search} />
|
||||
<Button submit color="ghost" class="h-max">Search</Button>
|
||||
</form>
|
||||
</div>
|
||||
<ul class="flex flex-col divide-y dark:divide-zinc-800">
|
||||
{#if data.communities.length == 0}
|
||||
<div
|
||||
class="text-slate-600 dark:text-zinc-400 flex flex-col justify-center items-center py-8"
|
||||
>
|
||||
<Icon src={QuestionMarkCircle} size="32" solid />
|
||||
<h1 class="font-bold text-2xl">No communities</h1>
|
||||
<p class="mt-2 text-center">
|
||||
There are no communities with that name. Try refining your search.
|
||||
</p>
|
||||
</div>
|
||||
<Placeholder
|
||||
icon={QuestionMarkCircle}
|
||||
title="No communities"
|
||||
description="There are no communities that match this filter. Try refining your
|
||||
search."
|
||||
/>
|
||||
{/if}
|
||||
{#each data.communities as community}
|
||||
<li class="py-3">
|
||||
<div
|
||||
class="
|
||||
flex flex-col gap-1 text-sm max-w-full"
|
||||
>
|
||||
<div class="flex flex-row items-center">
|
||||
<span
|
||||
class="break-words max-w-full w-max text-base font-bold text-sky-400 hover:underline"
|
||||
>
|
||||
<CommunityLink
|
||||
showInstance={false}
|
||||
avatar
|
||||
community={community.community}
|
||||
/>
|
||||
</span>
|
||||
<div class="ml-auto">
|
||||
<Subscribe {community} let:subscribe let:subscribing>
|
||||
<Button
|
||||
disabled={subscribing || !$profile?.jwt}
|
||||
loading={subscribing}
|
||||
on:click={async () => {
|
||||
const res = await subscribe()
|
||||
|
||||
if (res) {
|
||||
community.subscribed =
|
||||
res.community_view.subscribed != 'NotSubscribed'
|
||||
? 'Subscribed'
|
||||
: 'NotSubscribed'
|
||||
|
||||
addSubscription(
|
||||
community.community,
|
||||
res.community_view.subscribed == 'Subscribed' ||
|
||||
res.community_view.subscribed == 'Pending'
|
||||
)
|
||||
}
|
||||
}}
|
||||
color={community.subscribed == 'Subscribed'
|
||||
? 'primary'
|
||||
: 'ghost'}
|
||||
>
|
||||
{community.subscribed == 'Subscribed'
|
||||
? 'Subscribed'
|
||||
: 'Subscribe'}
|
||||
</Button>
|
||||
</Subscribe>
|
||||
</div>
|
||||
</div>
|
||||
<span class="opacity-80 mb-2">
|
||||
{new URL(community.community.actor_id).hostname}
|
||||
</span>
|
||||
<div class="flex flex-row gap-3 items-center">
|
||||
<div class="flex flex-row gap-1 items-center">
|
||||
<Icon src={UserGroup} width={16} mini />
|
||||
<span>
|
||||
{Intl.NumberFormat('en', { notation: 'compact' }).format(
|
||||
community.counts.subscribers
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex flex-row gap-1 items-center">
|
||||
<Icon src={PencilSquare} mini width={16} />
|
||||
<span>
|
||||
{Intl.NumberFormat('en', { notation: 'compact' }).format(
|
||||
community.counts.posts
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex flex-row gap-1 items-center">
|
||||
<Icon src={ChatBubbleOvalLeftEllipsis} mini width={16} />
|
||||
<span>
|
||||
{Intl.NumberFormat('en', { notation: 'compact' }).format(
|
||||
community.counts.comments
|
||||
)}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<CommunityItem {community} />
|
||||
{/each}
|
||||
</ul>
|
||||
{#if data.communities.length > 0}
|
||||
<div class="mt-2 w-full">
|
||||
<Pageination
|
||||
page={Number($page.url.searchParams.get('page')) || 1}
|
||||
on:change={(p) => {
|
||||
$page.url.searchParams.set('page', p.detail.toString())
|
||||
|
||||
goto($page.url.toString(), {
|
||||
invalidateAll: true,
|
||||
})
|
||||
}}
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -25,6 +25,8 @@ export async function load({ url, fetch }) {
|
||||
})),
|
||||
type: type,
|
||||
sort: sort,
|
||||
query: query,
|
||||
page: page,
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
@@ -37,6 +39,8 @@ export async function load({ url, fetch }) {
|
||||
})),
|
||||
type: type,
|
||||
sort: sort,
|
||||
query: query,
|
||||
page: page,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,23 +26,46 @@
|
||||
<title>Settings</title>
|
||||
</svelte:head>
|
||||
|
||||
<div class="flex flex-col">
|
||||
<h1 class="text-3xl font-bold flex justify-between">
|
||||
Settings <Button
|
||||
on:click={() => {
|
||||
toast({
|
||||
content:
|
||||
'Are you sure you want to reset your settings to the default?',
|
||||
action: () => ($userSettings = defaultSettings),
|
||||
})
|
||||
}}
|
||||
class="font-normal"
|
||||
>
|
||||
<Icon src={ArrowPath} mini size="16" slot="prefix" />
|
||||
Reset to default
|
||||
</Button>
|
||||
</h1>
|
||||
<SectionTitle class="mt-4">General</SectionTitle>
|
||||
<h1 class="text-3xl font-bold flex justify-between">
|
||||
Settings <Button
|
||||
on:click={() => {
|
||||
toast({
|
||||
content: 'Are you sure you want to reset your settings to the default?',
|
||||
action: () => ($userSettings = defaultSettings),
|
||||
})
|
||||
}}
|
||||
class="font-normal"
|
||||
>
|
||||
<Icon src={ArrowPath} mini size="16" slot="prefix" />
|
||||
Reset to default
|
||||
</Button>
|
||||
</h1>
|
||||
|
||||
<div class="flex flex-col max-w-4xl mx-auto">
|
||||
<SectionTitle class="mt-4">UI</SectionTitle>
|
||||
<Setting>
|
||||
<span slot="title">Post style</span>
|
||||
<ViewSelect />
|
||||
<p slot="description">
|
||||
{#if $userSettings.view == 'list'}
|
||||
Show posts in a list, with post bodies and compact images.
|
||||
{:else if $userSettings.view == 'compact'}
|
||||
Show posts in a list, without post bodies and with tighter spacing.
|
||||
{:else if $userSettings.view == 'card'}
|
||||
Show posts in cards, with large images.
|
||||
{/if}
|
||||
</p>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Random placeholders</span>
|
||||
<span slot="description">
|
||||
Show a random placeholder for forms for comments, posts, etc.
|
||||
</span>
|
||||
<Checkbox bind:checked={$userSettings.randomPlaceholders}>
|
||||
{$userSettings.randomPlaceholders ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
</Setting>
|
||||
|
||||
<Setting>
|
||||
<span slot="title">Default sort</span>
|
||||
<span slot="description">The default sort to use for feeds.</span>
|
||||
@@ -76,17 +99,42 @@
|
||||
</div>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Post style</span>
|
||||
<ViewSelect />
|
||||
<p>
|
||||
{#if $userSettings.view == 'list'}
|
||||
Show posts in a list, with post bodies and compact images.
|
||||
{:else if $userSettings.view == 'compact'}
|
||||
Show posts in a list, without post bodies and with tighter spacing.
|
||||
{:else if $userSettings.view == 'card'}
|
||||
Show posts in cards, with large images.
|
||||
{/if}
|
||||
</p>
|
||||
<span slot="title">Use display name</span>
|
||||
<span slot="description">
|
||||
Show a user's display name instead of their account username.
|
||||
</span>
|
||||
|
||||
<Checkbox bind:checked={$userSettings.displayNames}>
|
||||
{$userSettings.displayNames ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
</Setting>
|
||||
|
||||
<SectionTitle class="mt-4">Posts</SectionTitle>
|
||||
<Setting>
|
||||
<span slot="title">Fade read posts</span>
|
||||
<span slot="description">Fade the title of posts you've already read.</span>
|
||||
<Checkbox bind:checked={$userSettings.markReadPosts}>
|
||||
{$userSettings.markReadPosts ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">NSFW blur</span>
|
||||
<span slot="description">
|
||||
Blur images and remove post bodies of NSFW content.
|
||||
</span>
|
||||
<Checkbox bind:checked={$userSettings.nsfwBlur}>
|
||||
{$userSettings.nsfwBlur ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Expand Images</span>
|
||||
<span slot="description">
|
||||
Clicking on an image brings you to an expanded view rather than sending
|
||||
you to the post page.
|
||||
</span>
|
||||
<Checkbox bind:checked={$userSettings.expandImages}>
|
||||
{$userSettings.expandImages ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<span slot="title">Hide Posts</span>
|
||||
@@ -110,45 +158,6 @@
|
||||
</Checkbox>
|
||||
</div>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<Checkbox slot="title" bind:checked={$userSettings.displayNames}>
|
||||
Use display name
|
||||
</Checkbox>
|
||||
<span slot="description">
|
||||
Show a user's display name instead of their account username.
|
||||
</span>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<Checkbox slot="title" bind:checked={$userSettings.randomPlaceholders}>
|
||||
Random placeholders
|
||||
</Checkbox>
|
||||
<span slot="description">
|
||||
Show a random placeholder for forms for comments, posts, etc.
|
||||
</span>
|
||||
</Setting>
|
||||
|
||||
<SectionTitle class="mt-4">UI</SectionTitle>
|
||||
<Setting>
|
||||
<Checkbox bind:checked={$userSettings.markReadPosts} slot="title">
|
||||
Fade read posts
|
||||
</Checkbox>
|
||||
<span slot="description">Fade the title of posts you've already read.</span>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<Checkbox bind:checked={$userSettings.nsfwBlur} slot="title">
|
||||
NSFW blur
|
||||
</Checkbox>
|
||||
<span slot="description">Blur images of NSFW content.</span>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<Checkbox bind:checked={$userSettings.expandImages} slot="title">
|
||||
Expand Images
|
||||
</Checkbox>
|
||||
<span slot="description">
|
||||
Clicking on an image brings you to an expanded view rather than sending
|
||||
you to the post page.
|
||||
</span>
|
||||
</Setting>
|
||||
|
||||
<SectionTitle class="mt-4">Instances</SectionTitle>
|
||||
<Setting>
|
||||
@@ -215,17 +224,19 @@
|
||||
<span slot="title">Font</span>
|
||||
<span slot="description">What font Photon should use.</span>
|
||||
<MultiSelect
|
||||
options={[true, false]}
|
||||
optionNames={['System UI', 'Browser Font']}
|
||||
bind:selected={$userSettings.systemUI}
|
||||
options={['inter', 'system', 'browser']}
|
||||
optionNames={['Inter', 'System UI', 'Browser Font']}
|
||||
bind:selected={$userSettings.font}
|
||||
/>
|
||||
</Setting>
|
||||
<Setting>
|
||||
<Checkbox bind:checked={$userSettings.debugInfo} slot="title">
|
||||
Debug Info
|
||||
</Checkbox>
|
||||
<span slot="title">Debug Info</span>
|
||||
<span slot="description">
|
||||
Show an option to show debug information. (in posts and such)
|
||||
</span>
|
||||
|
||||
<Checkbox bind:checked={$userSettings.debugInfo}>
|
||||
{$userSettings.debugInfo ? 'Enabled' : 'Disabled'}
|
||||
</Checkbox>
|
||||
</Setting>
|
||||
</div>
|
||||
@@ -2,12 +2,20 @@
|
||||
import { Material } from 'mono-svelte'
|
||||
</script>
|
||||
|
||||
<Material padding="lg" class="flex flex-col gap-3 my-2">
|
||||
<h1 class="font-bold"><slot name="title" /></h1>
|
||||
{#if $$slots.description}
|
||||
<p class="text-slate-700 dark:text-zinc-300">
|
||||
<slot name="description" />
|
||||
</p>
|
||||
<Material color="distinct" padding="none" class="my-2">
|
||||
<div class="px-5 pt-5 flex flex-col gap-3" class:pb-5={!$$slots.default}>
|
||||
<h1 class="font-bold text-lg"><slot name="title" /></h1>
|
||||
{#if $$slots.description}
|
||||
<p class="text-slate-800 dark:text-zinc-200">
|
||||
<slot name="description" />
|
||||
</p>
|
||||
{/if}
|
||||
</div>
|
||||
{#if $$slots.default}
|
||||
<div
|
||||
class="w-full px-5 py-3 bg-slate-50 dark:bg-zinc-950 border-t dark:border-zinc-800 mt-4"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
{/if}
|
||||
<slot />
|
||||
</Material>
|
||||
Reference in new issue
Block a user