feat: add contextual actions to command palette

This commit is contained in:
Xylight committed 2024-10-18 14:06:30 -07:00
1 parent 3738413184
commit d7d8981cc6
6 files changed
+176 -69

No files matched your search

@@ -10,6 +10,7 @@
import { profile, profileData } from '$lib/auth'
import { getGroups, type Action, type Group } from './actions'
import { themeData } from '$lib/ui/colors'
import { page } from '$app/stores'
export let open = false
$: if (open) search = ''
@@ -20,7 +21,8 @@
$resumables,
$profile,
$profileData.profiles,
$themeData
$themeData,
$page.data.contextual?.actions
)
let search = ''
@@ -43,6 +43,7 @@ import {
ChatBubbleOvalLeftEllipsis,
ChatBubbleLeftRight,
Swatch,
Plus,
} from 'svelte-hero-icons'
import { get } from 'svelte/store'
@@ -66,7 +67,8 @@ export function getGroups(
resumables: ResumableItem[],
profile: Profile,
profiles: Profile[],
td: ThemeData
td: ThemeData,
contextual?: Action[]
) {
return [
{
@@ -77,6 +79,10 @@ export function getGroups(
href: r.url,
})),
},
{
name: t.get('nav.commands.contextual'),
actions: contextual ?? [],
},
{
name: t.get('nav.commands.main'),
actions: [
@@ -254,6 +260,26 @@ export function getGroups(
name: t.get('account.accounts'),
icon: UserGroup,
},
{
href: '/login',
name: t.get('account.login'),
icon: ArrowRightOnRectangle,
},
{
href: '/signup',
name: t.get('account.signup'),
icon: Identification,
},
{
href: '/login/guest',
name: t.get('account.addGuest'),
icon: Plus,
},
{
href: '/accounts',
name: t.get('account.accounts'),
icon: UserGroup,
},
]
: [
{
@@ -266,6 +292,11 @@ export function getGroups(
name: t.get('account.signup'),
icon: Identification,
},
{
href: '/login/guest',
name: t.get('account.addGuest'),
icon: Plus,
},
{
href: '/accounts',
name: t.get('account.accounts'),
+2 -1
View File
@@ -46,7 +46,8 @@
"feeds": "Feeds",
"downloading": "Downloading actions",
"setTheme": "Set theme",
"setThemeTo": "Set theme to {{default}}"
"setThemeTo": "Set theme to {{default}}",
"contextual": "On this page"
}
},
"account": {