feat: add subactions
This commit is contained in:
1 parent
2bf28fcdb7
commit
69be40b4b7
6 files changed
+298
-132
No files matched your search
@@ -38,13 +38,13 @@
|
|||||||
import { LINKED_INSTANCE_URL } from '$lib/instance'
|
import { LINKED_INSTANCE_URL } from '$lib/instance'
|
||||||
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
import SiteCard from '$lib/components/lemmy/SiteCard.svelte'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import Commands from './commands/Commands.svelte'
|
import CommandsWrapper from './commands/CommandsWrapper.svelte'
|
||||||
|
|
||||||
let searching = false
|
let searching = false
|
||||||
let promptOpen: boolean = false
|
let promptOpen: boolean = false
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Commands bind:open={promptOpen} />
|
<CommandsWrapper bind:open={promptOpen} />
|
||||||
<nav
|
<nav
|
||||||
class="flex flex-row gap-2 items-center w-full mx-auto z-50 box-border p-0.5
|
class="flex flex-row gap-2 items-center w-full mx-auto z-50 box-border p-0.5
|
||||||
duration-150
|
duration-150
|
||||||
|
|||||||
@@ -1,25 +1,24 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Button, Material } from 'mono-svelte'
|
import { Button, Material } from 'mono-svelte'
|
||||||
import { Icon, QuestionMarkCircle, type IconSource } from 'svelte-hero-icons'
|
import {
|
||||||
|
ArrowUturnDown,
|
||||||
|
Icon,
|
||||||
|
QuestionMarkCircle,
|
||||||
|
type IconSource,
|
||||||
|
} from 'svelte-hero-icons'
|
||||||
import Avatar from '../../Avatar.svelte'
|
import Avatar from '../../Avatar.svelte'
|
||||||
|
import type { Action } from './actions'
|
||||||
|
|
||||||
export let action: {
|
export let action: Action
|
||||||
name: string
|
|
||||||
desc?: string
|
|
||||||
handle?: () => any
|
|
||||||
href?: string
|
|
||||||
shortcut?: string
|
|
||||||
icon: string | IconSource
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
href={action.href}
|
href={action.href}
|
||||||
on:click={action.handle}
|
on:click
|
||||||
alignment="left"
|
alignment="left"
|
||||||
color="tertiary"
|
color="tertiary"
|
||||||
size="lg"
|
size="lg"
|
||||||
class="focus:bg-slate-200 focus:dark:bg-zinc-800 block {$$props.class}"
|
class="focus:bg-slate-200 focus:dark:bg-zinc-800 block w-full {$$props.class}"
|
||||||
data-sveltekit-preload-code="viewport"
|
data-sveltekit-preload-code="viewport"
|
||||||
data-sveltekit-preload-data="tap"
|
data-sveltekit-preload-data="tap"
|
||||||
>
|
>
|
||||||
@@ -29,10 +28,13 @@
|
|||||||
<Icon src={action.icon ?? QuestionMarkCircle} size="20" />
|
<Icon src={action.icon ?? QuestionMarkCircle} size="20" />
|
||||||
{/if}
|
{/if}
|
||||||
<slot />
|
<slot />
|
||||||
{action.name}
|
<span class="mr-auto">{action.name}</span>
|
||||||
{#if action.shortcut}
|
{#if action.shortcut}
|
||||||
<div class="ml-auto flex items-center gap-0.5 text-xs font-medium">
|
<div class="flex items-center gap-0.5 text-xs font-medium">
|
||||||
⌘ {action.shortcut}
|
⌘ {action.shortcut}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if action.subActions}
|
||||||
|
<Icon src={ArrowUturnDown} size="16" micro />
|
||||||
|
{/if}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -1,58 +1,18 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { resumables } from '$lib/lemmy/item'
|
import { resumables } from '$lib/lemmy/item'
|
||||||
import {
|
import { TextInput } from 'mono-svelte'
|
||||||
Button,
|
|
||||||
buttonColor,
|
|
||||||
buttonSize,
|
|
||||||
Modal,
|
|
||||||
TextInput,
|
|
||||||
} from 'mono-svelte'
|
|
||||||
import { createEventDispatcher, onMount } from 'svelte'
|
import { createEventDispatcher, onMount } from 'svelte'
|
||||||
import {
|
import { Home, Icon, MagnifyingGlass } from 'svelte-hero-icons'
|
||||||
ArrowRightOnRectangle,
|
|
||||||
Bookmark,
|
|
||||||
Cog6Tooth,
|
|
||||||
Fire,
|
|
||||||
GlobeAlt,
|
|
||||||
Home,
|
|
||||||
Icon,
|
|
||||||
Identification,
|
|
||||||
Inbox,
|
|
||||||
MagnifyingGlass,
|
|
||||||
Newspaper,
|
|
||||||
PencilSquare,
|
|
||||||
QuestionMarkCircle,
|
|
||||||
ShieldCheck,
|
|
||||||
UserCircle,
|
|
||||||
UserGroup,
|
|
||||||
type IconSource,
|
|
||||||
} from 'svelte-hero-icons'
|
|
||||||
import Avatar from '../../Avatar.svelte'
|
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import CommandItem from './CommandItem.svelte'
|
import CommandItem from './CommandItem.svelte'
|
||||||
import { browser } from '$app/environment'
|
import { browser } from '$app/environment'
|
||||||
import { afterNavigate, goto } from '$app/navigation'
|
import { afterNavigate, goto } from '$app/navigation'
|
||||||
import { profile } from '$lib/auth'
|
import { profile } from '$lib/auth'
|
||||||
import { fullCommunityName } from '$lib/util'
|
import { getGroups, type Action, type Group } from './actions'
|
||||||
import { getGroups } from './actions'
|
|
||||||
|
|
||||||
export let open = false
|
export let open = false
|
||||||
$: if (open) search = ''
|
$: if (open) search = ''
|
||||||
|
|
||||||
interface Group {
|
|
||||||
name: string
|
|
||||||
actions: Action[]
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Action {
|
|
||||||
name: string
|
|
||||||
desc?: string
|
|
||||||
handle?: () => any
|
|
||||||
href?: string
|
|
||||||
shortcut?: string
|
|
||||||
icon: string | IconSource
|
|
||||||
}
|
|
||||||
|
|
||||||
export let groups: Group[] = []
|
export let groups: Group[] = []
|
||||||
|
|
||||||
$: groups = getGroups($resumables, $profile)
|
$: groups = getGroups($resumables, $profile)
|
||||||
@@ -61,6 +21,8 @@
|
|||||||
let container: HTMLElement
|
let container: HTMLElement
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
let selectedIndex = 0
|
let selectedIndex = 0
|
||||||
|
let filteredGroups: Group[] = []
|
||||||
|
let breadcrumbs: Action[] = []
|
||||||
|
|
||||||
function fuzzySearch(text: string, pattern: string): number {
|
function fuzzySearch(text: string, pattern: string): number {
|
||||||
const textLower = text.toLowerCase()
|
const textLower = text.toLowerCase()
|
||||||
@@ -94,47 +56,97 @@
|
|||||||
return score
|
return score
|
||||||
}
|
}
|
||||||
|
|
||||||
$: filteredGroups = groups
|
const debounce = (fn: Function, ms = 300) => {
|
||||||
.map((group) => {
|
let timeoutId: ReturnType<typeof setTimeout>
|
||||||
const scoredActions = group.actions
|
return function (this: any, ...args: any[]) {
|
||||||
.map((action) => ({
|
clearTimeout(timeoutId)
|
||||||
...action,
|
timeoutId = setTimeout(() => fn.apply(this, args), ms)
|
||||||
score: Math.max(fuzzySearch(action.name, search)),
|
}
|
||||||
}))
|
}
|
||||||
.filter((action) => action.score > 0)
|
|
||||||
.sort((a, b) => b.score - a.score)
|
|
||||||
|
|
||||||
return {
|
const debouncedSearch = debounce((term: string) => {
|
||||||
...group,
|
if (term.length < 1) {
|
||||||
actions: scoredActions,
|
if (breadcrumbs.length <= 0) {
|
||||||
score: Math.max(
|
filteredGroups = groups.map((group) => ({
|
||||||
fuzzySearch(group.name, search),
|
...group,
|
||||||
...scoredActions.map((a) => a.score)
|
actions: flattenActions(group.actions, false),
|
||||||
),
|
}))
|
||||||
}
|
}
|
||||||
})
|
} else {
|
||||||
.filter((group) => group.actions.length > 0)
|
filteredGroups = groups
|
||||||
.sort((a, b) => b.score - a.score)
|
.map((group) => {
|
||||||
|
const scoredActions = flattenActions(group.actions)
|
||||||
|
.map((action) => ({
|
||||||
|
...action,
|
||||||
|
score: Math.max(
|
||||||
|
fuzzySearch(action.name, term),
|
||||||
|
fuzzySearch(group.name, term)
|
||||||
|
),
|
||||||
|
}))
|
||||||
|
.filter((action) => action.score > 0)
|
||||||
|
.sort((a, b) => b.score - a.score)
|
||||||
|
|
||||||
|
return {
|
||||||
|
...group,
|
||||||
|
actions: scoredActions,
|
||||||
|
score: Math.max(
|
||||||
|
fuzzySearch(group.name, term),
|
||||||
|
...scoredActions.map((a) => a.score)
|
||||||
|
),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter((group) => group.actions.length > 0)
|
||||||
|
.sort((a, b) => b.score - a.score)
|
||||||
|
}
|
||||||
|
}, 50)
|
||||||
|
|
||||||
|
function updateFilteredGroups() {
|
||||||
|
if (breadcrumbs.length === 0) {
|
||||||
|
filteredGroups = groups
|
||||||
|
} else {
|
||||||
|
const lastAction = breadcrumbs[breadcrumbs.length - 1]
|
||||||
|
filteredGroups = [
|
||||||
|
{
|
||||||
|
name: lastAction.name,
|
||||||
|
actions: lastAction.subActions || [],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
selectedIndex = 0
|
||||||
|
search = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
function goBack() {
|
||||||
|
breadcrumbs.pop()
|
||||||
|
updateFilteredGroups()
|
||||||
|
}
|
||||||
|
|
||||||
$: flattenedActions = filteredGroups.flatMap((group) => group.actions)
|
$: flattenedActions = filteredGroups.flatMap((group) => group.actions)
|
||||||
|
$: debouncedSearch(search)
|
||||||
|
|
||||||
|
function flattenActions(
|
||||||
|
actions: Action[],
|
||||||
|
subaction: boolean = true
|
||||||
|
): Action[] {
|
||||||
|
return actions.flatMap((action) => [
|
||||||
|
action,
|
||||||
|
...(action.subActions && subaction
|
||||||
|
? flattenActions(action.subActions)
|
||||||
|
: []),
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
function togglePalette() {
|
function togglePalette() {
|
||||||
open = !open
|
open = !open
|
||||||
if (open) {
|
if (open) {
|
||||||
search = ''
|
search = ''
|
||||||
selectedIndex = 0
|
selectedIndex = 0
|
||||||
|
filteredGroups = groups
|
||||||
|
breadcrumbs = []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleKeydown(event: KeyboardEvent) {
|
function handleKeydown(event: KeyboardEvent) {
|
||||||
if (
|
|
||||||
(event.ctrlKey && event.key === 'p') ||
|
|
||||||
(event.key == '/' && document.activeElement == document.body)
|
|
||||||
) {
|
|
||||||
event.preventDefault()
|
|
||||||
togglePalette()
|
|
||||||
}
|
|
||||||
|
|
||||||
if (event.ctrlKey) {
|
if (event.ctrlKey) {
|
||||||
const actions = groups
|
const actions = groups
|
||||||
.flatMap((g) => g.actions)
|
.flatMap((g) => g.actions)
|
||||||
@@ -169,7 +181,12 @@
|
|||||||
break
|
break
|
||||||
case 'Escape':
|
case 'Escape':
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
togglePalette()
|
if (breadcrumbs.length > 0) {
|
||||||
|
breadcrumbs.pop()
|
||||||
|
updateFilteredGroups()
|
||||||
|
} else {
|
||||||
|
togglePalette()
|
||||||
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,59 +206,80 @@
|
|||||||
|
|
||||||
async function handleSelect(action: Action) {
|
async function handleSelect(action: Action) {
|
||||||
if (!action) return
|
if (!action) return
|
||||||
if (action.href) goto(action.href)
|
if (action.subActions && action.subActions.length > 0) {
|
||||||
if (action.handle) action.handle()
|
breadcrumbs = [...breadcrumbs, action]
|
||||||
togglePalette()
|
updateFilteredGroups()
|
||||||
dispatch('select', action)
|
} else {
|
||||||
|
if (action.href) goto(action.href)
|
||||||
|
if (action.handle) action.handle()
|
||||||
|
togglePalette()
|
||||||
|
dispatch('select', action)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
afterNavigate(() => {
|
afterNavigate(() => {
|
||||||
open = false
|
// open = false
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window on:keydown={handleKeydown} />
|
<svelte:window on:keydown={handleKeydown} />
|
||||||
|
|
||||||
<Modal title={$t('nav.commands.prompt')} bind:open>
|
<TextInput bind:value={search} autofocus class="sticky" />
|
||||||
<TextInput bind:value={search} autofocus class="sticky" />
|
<div class="h-96 overflow-auto border-t border-slate-200 dark:border-zinc-800">
|
||||||
<div
|
{#if breadcrumbs.length > 0}
|
||||||
class="h-96 overflow-auto border-t border-slate-200 dark:border-zinc-800"
|
<div class="flex items-center gap-2 my-1">
|
||||||
>
|
<button
|
||||||
<div class="space-y-1" bind:this={container}>
|
class="text-[13px] font-medium text-slate-600 dark:text-zinc-400"
|
||||||
{#each filteredGroups as group, groupIndex}
|
on:click={goBack}
|
||||||
<div class="space-y-1">
|
>
|
||||||
<span class="text-sm font-medium">{group.name}</span>
|
<Icon src={Home} size="16" mini />
|
||||||
<ul class="flex flex-col gap-1">
|
</button>
|
||||||
{#each group.actions as action, actionIndex}
|
{#each breadcrumbs as crumb, index}
|
||||||
{@const globalIndex =
|
<span class="text-base text-slate-400 dark:text-zinc-600">/</span>
|
||||||
filteredGroups
|
<span class="text-[13px] font-medium">
|
||||||
.slice(0, groupIndex)
|
{crumb.name}
|
||||||
.reduce((sum, g) => sum + g.actions.length, 0) + actionIndex}
|
</span>
|
||||||
<li>
|
|
||||||
<CommandItem
|
|
||||||
{action}
|
|
||||||
class="{globalIndex == selectedIndex
|
|
||||||
? '!bg-slate-100 dark:!bg-zinc-800 text-inherit'
|
|
||||||
: 'text-slate-600 dark:text-zinc-400'} block"
|
|
||||||
/>
|
|
||||||
</li>
|
|
||||||
{/each}
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
{/each}
|
{/each}
|
||||||
{#if search != ''}
|
|
||||||
<CommandItem
|
|
||||||
action={{
|
|
||||||
name: search,
|
|
||||||
href: `/search?q=${encodeURIComponent(search)}`,
|
|
||||||
icon: MagnifyingGlass,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span class="font-normal text-slate-600 dark:text-zinc-400">
|
|
||||||
{$t('nav.commands.search', { default: '' })}
|
|
||||||
</span>
|
|
||||||
</CommandItem>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
|
<div class="space-y-1" bind:this={container}>
|
||||||
|
{#each filteredGroups as group, groupIndex}
|
||||||
|
<div class="space-y-1">
|
||||||
|
<span class="text-sm font-medium">{group.name}</span>
|
||||||
|
<ul class="flex flex-col gap-1">
|
||||||
|
{#each group.actions as action, actionIndex}
|
||||||
|
{@const globalIndex =
|
||||||
|
filteredGroups
|
||||||
|
.slice(0, groupIndex)
|
||||||
|
.reduce((sum, g) => sum + g.actions.length, 0) + actionIndex}
|
||||||
|
<li>
|
||||||
|
<CommandItem
|
||||||
|
{action}
|
||||||
|
on:click={(e) => {
|
||||||
|
e.stopPropagation()
|
||||||
|
handleSelect(action)
|
||||||
|
}}
|
||||||
|
class="{globalIndex == selectedIndex
|
||||||
|
? '!bg-slate-100 dark:!bg-zinc-800 text-inherit'
|
||||||
|
: 'text-slate-600 dark:text-zinc-400'} block"
|
||||||
|
/>
|
||||||
|
</li>
|
||||||
|
{/each}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
{#if search != ''}
|
||||||
|
<CommandItem
|
||||||
|
action={{
|
||||||
|
name: search,
|
||||||
|
href: `/search?q=${encodeURIComponent(search)}`,
|
||||||
|
icon: MagnifyingGlass,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<span class="font-normal text-slate-600 dark:text-zinc-400">
|
||||||
|
{$t('nav.commands.search', { default: '' })}
|
||||||
|
</span>
|
||||||
|
</CommandItem>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</div>
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { t } from '$lib/translations'
|
||||||
|
import { Modal, Spinner } from 'mono-svelte'
|
||||||
|
import Commands from './Commands.svelte'
|
||||||
|
|
||||||
|
export let open: boolean = false
|
||||||
|
|
||||||
|
function handleKeydown(event: KeyboardEvent) {
|
||||||
|
if (
|
||||||
|
(event.ctrlKey && event.key === 'p') ||
|
||||||
|
(event.key == '/' && document.activeElement == document.body)
|
||||||
|
) {
|
||||||
|
event.preventDefault()
|
||||||
|
open = !open
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:window on:keydown={handleKeydown} />
|
||||||
|
|
||||||
|
{#if open}
|
||||||
|
<Modal title={$t('nav.commands.prompt')} bind:open>
|
||||||
|
{#await import('./Commands.svelte')}
|
||||||
|
<div class="h-96 flex flex-col gap-2 items-center justify-center">
|
||||||
|
<Spinner width={32} />
|
||||||
|
<span class="font-medium text-lg">Downloading actions...</span>
|
||||||
|
</div>
|
||||||
|
{:then { default: Commands }}
|
||||||
|
<Commands bind:open />
|
||||||
|
{/await}
|
||||||
|
</Modal>
|
||||||
|
{/if}
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
import type { Profile } from '$lib/auth'
|
import type { Profile } from '$lib/auth'
|
||||||
|
import {
|
||||||
|
amModOfAny,
|
||||||
|
isAdmin,
|
||||||
|
} from '$lib/components/lemmy/moderation/moderation'
|
||||||
import { resumables, type ResumableItem } from '$lib/lemmy/item'
|
import { resumables, type ResumableItem } from '$lib/lemmy/item'
|
||||||
|
import { userSettings } from '$lib/settings'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import { fullCommunityName } from '$lib/util'
|
import { fullCommunityName } from '$lib/util'
|
||||||
import {
|
import {
|
||||||
@@ -12,10 +17,29 @@ import {
|
|||||||
Inbox,
|
Inbox,
|
||||||
Newspaper,
|
Newspaper,
|
||||||
PencilSquare,
|
PencilSquare,
|
||||||
|
ServerStack,
|
||||||
|
ShieldCheck,
|
||||||
UserCircle,
|
UserCircle,
|
||||||
UserGroup,
|
UserGroup,
|
||||||
|
ViewColumns,
|
||||||
|
type IconSource,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
|
|
||||||
|
export interface Group {
|
||||||
|
name: string
|
||||||
|
actions: Action[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Action {
|
||||||
|
name: string
|
||||||
|
desc?: string
|
||||||
|
handle?: () => any
|
||||||
|
href?: string
|
||||||
|
shortcut?: string
|
||||||
|
icon: string | IconSource
|
||||||
|
subActions?: Action[]
|
||||||
|
}
|
||||||
|
|
||||||
export function getGroups(resumables: ResumableItem[], profile: Profile) {
|
export function getGroups(resumables: ResumableItem[], profile: Profile) {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
@@ -35,6 +59,24 @@ export function getGroups(resumables: ResumableItem[], profile: Profile) {
|
|||||||
name: t.get('nav.communities'),
|
name: t.get('nav.communities'),
|
||||||
icon: GlobeAlt,
|
icon: GlobeAlt,
|
||||||
},
|
},
|
||||||
|
...(amModOfAny(profile.user)
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
href: '/moderation',
|
||||||
|
name: t.get('nav.moderation'),
|
||||||
|
icon: ShieldCheck,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
|
...(profile.user && isAdmin(profile.user)
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
href: '/admin',
|
||||||
|
name: t.get('nav.admin'),
|
||||||
|
icon: ServerStack,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: []),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -89,6 +131,56 @@ export function getGroups(resumables: ResumableItem[], profile: Profile) {
|
|||||||
name: t.get('nav.menu.settings'),
|
name: t.get('nav.menu.settings'),
|
||||||
icon: Cog6Tooth,
|
icon: Cog6Tooth,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: t.get('nav.commands.setView'),
|
||||||
|
icon: ViewColumns,
|
||||||
|
subActions: [
|
||||||
|
{
|
||||||
|
name: t.get('nav.commands.setViewTo', {
|
||||||
|
default: t.get('filter.view.compact'),
|
||||||
|
}),
|
||||||
|
icon: ViewColumns,
|
||||||
|
handle: () =>
|
||||||
|
userSettings.update((s) => ({
|
||||||
|
...s,
|
||||||
|
view: 'compact',
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t.get('nav.commands.setViewTo', {
|
||||||
|
default: t.get('filter.view.cozy'),
|
||||||
|
}),
|
||||||
|
icon: ViewColumns,
|
||||||
|
handle: () =>
|
||||||
|
userSettings.update((s) => ({
|
||||||
|
...s,
|
||||||
|
view: 'cozy',
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t.get('nav.commands.setViewTo', {
|
||||||
|
default: t.get('filter.view.list'),
|
||||||
|
}),
|
||||||
|
icon: ViewColumns,
|
||||||
|
handle: () =>
|
||||||
|
userSettings.update((s) => ({
|
||||||
|
...s,
|
||||||
|
view: 'list',
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t.get('nav.commands.setViewTo', {
|
||||||
|
default: t.get('filter.view.legacy'),
|
||||||
|
}),
|
||||||
|
icon: ViewColumns,
|
||||||
|
handle: () =>
|
||||||
|
userSettings.update((s) => ({
|
||||||
|
...s,
|
||||||
|
view: 'card',
|
||||||
|
})),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,7 +38,9 @@
|
|||||||
"recents": "Recents",
|
"recents": "Recents",
|
||||||
"content": "Content",
|
"content": "Content",
|
||||||
"search": "Search for {{default}}",
|
"search": "Search for {{default}}",
|
||||||
"main": "Main"
|
"main": "Main",
|
||||||
|
"setView": "Set view",
|
||||||
|
"setViewTo": "Set view to {{default}}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"account": {
|
"account": {
|
||||||
|
|||||||
Reference in new issue
Block a user