feat: add theme actions
This commit is contained in:
1 parent
bcd168df45
commit
e31071aef3
5 files changed
+29
-7
No files matched your search
@@ -156,7 +156,7 @@
|
||||
<PostBody body={post.post.body} {view} style="grid-area: body" />
|
||||
{/if}
|
||||
{#if actions}
|
||||
<PostActions on:hide bind:post {type} style="grid-area: actions;" {view} />
|
||||
<PostActions on:hide bind:post style="grid-area: actions;" {view} />
|
||||
{:else if view == 'compact'}
|
||||
<div class="flex flex-row items-center gap-2 text-sm">
|
||||
<Badge>
|
||||
|
||||
@@ -48,13 +48,12 @@
|
||||
import { fediseer, type Data } from '$lib/fediseer/fediseer'
|
||||
import { t } from '$lib/translations'
|
||||
import { text } from '$lib/components/translate/translation'
|
||||
import { hidePost, type MediaType } from './helpers'
|
||||
import { hidePost } from './helpers'
|
||||
import { feature } from '$lib/version'
|
||||
import Switch from '$lib/components/input/Switch.svelte'
|
||||
import { instanceToURL } from '$lib/util'
|
||||
|
||||
export let post: PostView
|
||||
export let type: MediaType | undefined = undefined
|
||||
export let view: View = 'cozy'
|
||||
export let debug: boolean = false
|
||||
|
||||
|
||||
@@ -9,13 +9,19 @@
|
||||
import { afterNavigate, goto } from '$app/navigation'
|
||||
import { profile, profileData } from '$lib/auth'
|
||||
import { getGroups, type Action, type Group } from './actions'
|
||||
import { themeData } from '$lib/ui/colors'
|
||||
|
||||
export let open = false
|
||||
$: if (open) search = ''
|
||||
|
||||
export let groups: Group[] = []
|
||||
|
||||
$: groups = getGroups($resumables, $profile, $profileData.profiles)
|
||||
$: groups = getGroups(
|
||||
$resumables,
|
||||
$profile,
|
||||
$profileData.profiles,
|
||||
$themeData
|
||||
)
|
||||
|
||||
let search = ''
|
||||
let container: HTMLElement
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
import { resumables, type ResumableItem } from '$lib/lemmy/item'
|
||||
import { userSettings } from '$lib/settings'
|
||||
import { t } from '$lib/translations'
|
||||
import { colorScheme } from '$lib/ui/colors'
|
||||
import { colorScheme, theme, themeData, type ThemeData } from '$lib/ui/colors'
|
||||
import { fullCommunityName } from '$lib/util'
|
||||
import {
|
||||
ArrowRightOnRectangle,
|
||||
@@ -42,6 +42,7 @@ import {
|
||||
ArrowTrendingDown,
|
||||
ChatBubbleOvalLeftEllipsis,
|
||||
ChatBubbleLeftRight,
|
||||
Swatch,
|
||||
} from 'svelte-hero-icons'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
@@ -64,7 +65,8 @@ export interface Action {
|
||||
export function getGroups(
|
||||
resumables: ResumableItem[],
|
||||
profile: Profile,
|
||||
profiles: Profile[]
|
||||
profiles: Profile[],
|
||||
td: ThemeData
|
||||
) {
|
||||
return [
|
||||
{
|
||||
@@ -373,6 +375,19 @@ export function getGroups(
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: t.get('nav.commands.setTheme'),
|
||||
icon: Swatch,
|
||||
subActions: td.themes.map((th) => ({
|
||||
name: t.get('nav.commands.setThemeTo', { default: th.name }),
|
||||
icon: Swatch,
|
||||
handle: () =>
|
||||
themeData.update((td) => ({
|
||||
...td,
|
||||
currentTheme: th.id,
|
||||
})),
|
||||
})),
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -44,7 +44,9 @@
|
||||
"setColor": "Set color scheme",
|
||||
"setColorTo": "Set color scheme to {{default}}",
|
||||
"feeds": "Feeds",
|
||||
"downloading": "Downloading actions"
|
||||
"downloading": "Downloading actions",
|
||||
"setTheme": "Set theme",
|
||||
"setThemeTo": "Set theme to {{default}}"
|
||||
}
|
||||
},
|
||||
"account": {
|
||||
|
||||
Reference in new issue
Block a user