misc: improve pins

This commit is contained in:
Xylight committed 2024-07-02 12:33:21 -07:00
1 parent c2858ac3ce
commit 005a8c0e07
4 files changed
+11 -23

No files matched your search

+1 -1
View File
@@ -63,7 +63,7 @@
$: contentPadding = calculatePadding(dockProps.noGap, dockProps.top, true) $: contentPadding = calculatePadding(dockProps.noGap, dockProps.top, true)
$: sidePadding = calculatePadding(dockProps.noGap, dockProps.top, false) $: sidePadding = calculatePadding(dockProps.noGap, dockProps.top, false)
$: topPanel = $userSettings.dock.noGap && $userSettings.dock.top $: topPanel = dockProps.noGap && dockProps.top
</script> </script>
<svelte:window bind:innerWidth={screenWidth} /> <svelte:window bind:innerWidth={screenWidth} />
+3 -8
View File
@@ -12,6 +12,7 @@ import {
ShieldCheck, ShieldCheck,
ServerStack, ServerStack,
PencilSquare, PencilSquare,
MapPin,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
import { get } from 'svelte/store' import { get } from 'svelte/store'
@@ -21,10 +22,6 @@ export interface Link {
} }
export const defaultLinks: Link[] = [ export const defaultLinks: Link[] = [
{
url: '/profile',
label: get(t)('profile.profile'),
},
{ {
url: '/', url: '/',
label: t.get('nav.home'), label: t.get('nav.home'),
@@ -69,16 +66,14 @@ export const defaultLinks: Link[] = [
export const iconOfLink = (url: string): IconSource => { export const iconOfLink = (url: string): IconSource => {
switch (url) { switch (url) {
case '/profile':
return UserCircle
case '/': case '/':
return Home return Home
case '/?type=All': case '/?type=All':
return ChartBar return GlobeAmericas
case '/?type=Subscribed': case '/?type=Subscribed':
return Newspaper return Newspaper
case '/?type=Local': case '/?type=Local':
return GlobeAmericas return MapPin
case '/communities': case '/communities':
return GlobeAlt return GlobeAlt
case '/search': case '/search':
+1 -13
View File
@@ -31,18 +31,6 @@
import { iconOfLink } from '../navbar/link' import { iconOfLink } from '../navbar/link'
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { page } from '$app/stores' import { page } from '$app/stores'
function pinsEvent(node: HTMLElement) {
node.oncontextmenu = (e) => {
e.preventDefault()
console.log('test')
// $userSettings.dock.pins = $userSettings.dock.pins.splice(
// $userSettings.dock.pins.findIndex((p) => pin.url == p.url),
// 1
// )
return false
}
}
</script> </script>
<nav <nav
@@ -62,7 +50,7 @@
on:contextmenu={(e) => { on:contextmenu={(e) => {
e.preventDefault() e.preventDefault()
$userSettings.dock.pins = $userSettings.dock.pins.toSpliced( $userSettings.dock.pins = $userSettings.dock.pins.toSpliced(
$userSettings.dock.pins.findIndex((p) => pin.url == p.url), $userSettings.dock.pins.findLastIndex((p) => pin.url == p.url),
1 1
) )
return false return false
+6 -1
View File
@@ -106,6 +106,9 @@
<Button <Button
size="square-md" size="square-md"
slot="target" slot="target"
disabled={$userSettings.dock.pins
.map((p) => p.url)
.includes(pin.url)}
on:click={() => { on:click={() => {
$userSettings.dock.pins = [ $userSettings.dock.pins = [
...($userSettings.dock.pins ?? []), ...($userSettings.dock.pins ?? []),
@@ -121,7 +124,9 @@
class="px-4 py-2 flex flex-col" class="px-4 py-2 flex flex-col"
> >
<span class="font-medium text-lg">{pin.label}</span> <span class="font-medium text-lg">{pin.label}</span>
<code class="!bg-zinc-950 !rounded-md">{pin.url}</code> <code class="bg-slate-50 dark:!bg-zinc-950 !rounded-md">
{pin.url}
</code>
</Material> </Material>
</Popover> </Popover>
{/each} {/each}