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" />
|
<PostBody body={post.post.body} {view} style="grid-area: body" />
|
||||||
{/if}
|
{/if}
|
||||||
{#if actions}
|
{#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'}
|
{:else if view == 'compact'}
|
||||||
<div class="flex flex-row items-center gap-2 text-sm">
|
<div class="flex flex-row items-center gap-2 text-sm">
|
||||||
<Badge>
|
<Badge>
|
||||||
|
|||||||
@@ -48,13 +48,12 @@
|
|||||||
import { fediseer, type Data } from '$lib/fediseer/fediseer'
|
import { fediseer, type Data } from '$lib/fediseer/fediseer'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import { text } from '$lib/components/translate/translation'
|
import { text } from '$lib/components/translate/translation'
|
||||||
import { hidePost, type MediaType } from './helpers'
|
import { hidePost } from './helpers'
|
||||||
import { feature } from '$lib/version'
|
import { feature } from '$lib/version'
|
||||||
import Switch from '$lib/components/input/Switch.svelte'
|
import Switch from '$lib/components/input/Switch.svelte'
|
||||||
import { instanceToURL } from '$lib/util'
|
import { instanceToURL } from '$lib/util'
|
||||||
|
|
||||||
export let post: PostView
|
export let post: PostView
|
||||||
export let type: MediaType | undefined = undefined
|
|
||||||
export let view: View = 'cozy'
|
export let view: View = 'cozy'
|
||||||
export let debug: boolean = false
|
export let debug: boolean = false
|
||||||
|
|
||||||
|
|||||||
@@ -9,13 +9,19 @@
|
|||||||
import { afterNavigate, goto } from '$app/navigation'
|
import { afterNavigate, goto } from '$app/navigation'
|
||||||
import { profile, profileData } from '$lib/auth'
|
import { profile, profileData } from '$lib/auth'
|
||||||
import { getGroups, type Action, type Group } from './actions'
|
import { getGroups, type Action, type Group } from './actions'
|
||||||
|
import { themeData } from '$lib/ui/colors'
|
||||||
|
|
||||||
export let open = false
|
export let open = false
|
||||||
$: if (open) search = ''
|
$: if (open) search = ''
|
||||||
|
|
||||||
export let groups: Group[] = []
|
export let groups: Group[] = []
|
||||||
|
|
||||||
$: groups = getGroups($resumables, $profile, $profileData.profiles)
|
$: groups = getGroups(
|
||||||
|
$resumables,
|
||||||
|
$profile,
|
||||||
|
$profileData.profiles,
|
||||||
|
$themeData
|
||||||
|
)
|
||||||
|
|
||||||
let search = ''
|
let search = ''
|
||||||
let container: HTMLElement
|
let container: HTMLElement
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
import { resumables, type ResumableItem } from '$lib/lemmy/item'
|
import { resumables, type ResumableItem } from '$lib/lemmy/item'
|
||||||
import { userSettings } from '$lib/settings'
|
import { userSettings } from '$lib/settings'
|
||||||
import { t } from '$lib/translations'
|
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 { fullCommunityName } from '$lib/util'
|
||||||
import {
|
import {
|
||||||
ArrowRightOnRectangle,
|
ArrowRightOnRectangle,
|
||||||
@@ -42,6 +42,7 @@ import {
|
|||||||
ArrowTrendingDown,
|
ArrowTrendingDown,
|
||||||
ChatBubbleOvalLeftEllipsis,
|
ChatBubbleOvalLeftEllipsis,
|
||||||
ChatBubbleLeftRight,
|
ChatBubbleLeftRight,
|
||||||
|
Swatch,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import { get } from 'svelte/store'
|
import { get } from 'svelte/store'
|
||||||
|
|
||||||
@@ -64,7 +65,8 @@ export interface Action {
|
|||||||
export function getGroups(
|
export function getGroups(
|
||||||
resumables: ResumableItem[],
|
resumables: ResumableItem[],
|
||||||
profile: Profile,
|
profile: Profile,
|
||||||
profiles: Profile[]
|
profiles: Profile[],
|
||||||
|
td: ThemeData
|
||||||
) {
|
) {
|
||||||
return [
|
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",
|
"setColor": "Set color scheme",
|
||||||
"setColorTo": "Set color scheme to {{default}}",
|
"setColorTo": "Set color scheme to {{default}}",
|
||||||
"feeds": "Feeds",
|
"feeds": "Feeds",
|
||||||
"downloading": "Downloading actions"
|
"downloading": "Downloading actions",
|
||||||
|
"setTheme": "Set theme",
|
||||||
|
"setThemeTo": "Set theme to {{default}}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"account": {
|
"account": {
|
||||||
|
|||||||
Reference in new issue
Block a user