cleanup: switch to a css-based navbar (#491)
* cleanup: remove dock options and make adaptive by default * cleanup: switch to css-based navbar * feat: add auto hide option
This commit is contained in:
1 parent
b5ce17308a
commit
10f0ed208f
17 files changed
+110
-261
No files matched your search
@@ -1,100 +1,8 @@
|
|||||||
<script lang="ts" module>
|
|
||||||
import { innerWidth } from 'svelte/reactivity/window'
|
|
||||||
|
|
||||||
const calculateDockProperties = (
|
|
||||||
settings: {
|
|
||||||
top: boolean | null
|
|
||||||
noGap: boolean | null
|
|
||||||
},
|
|
||||||
screenWidth: number,
|
|
||||||
): {
|
|
||||||
noGap: boolean
|
|
||||||
top: boolean
|
|
||||||
} => {
|
|
||||||
let panel = false
|
|
||||||
let top = false
|
|
||||||
|
|
||||||
if (screenWidth >= 1000) {
|
|
||||||
panel = true
|
|
||||||
top = true
|
|
||||||
} else if (screenWidth > 800) {
|
|
||||||
panel = true
|
|
||||||
top = false
|
|
||||||
} else if (screenWidth > 600) {
|
|
||||||
panel = false
|
|
||||||
top = false
|
|
||||||
}
|
|
||||||
|
|
||||||
panel = settings.noGap ?? panel
|
|
||||||
top = settings.top ?? top
|
|
||||||
|
|
||||||
return {
|
|
||||||
noGap: panel,
|
|
||||||
top: top,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const calculatePadding = (
|
|
||||||
panel: boolean,
|
|
||||||
top: boolean,
|
|
||||||
content: boolean,
|
|
||||||
): {
|
|
||||||
top: number
|
|
||||||
bottom: number
|
|
||||||
class: string
|
|
||||||
} => {
|
|
||||||
if (panel) {
|
|
||||||
if (top) {
|
|
||||||
if (content) return { top: 80, class: '!pt-20', bottom: 0 }
|
|
||||||
else
|
|
||||||
return {
|
|
||||||
top: 64,
|
|
||||||
class: 'top-16 !max-h-[calc(100vh-4rem)]',
|
|
||||||
bottom: 0,
|
|
||||||
}
|
|
||||||
} else return { top: 0, class: '!pb-20', bottom: 80 }
|
|
||||||
} else {
|
|
||||||
if (!content) return { top: 0, class: '', bottom: 0 }
|
|
||||||
|
|
||||||
if (top) return { top: 96, class: '!pt-24', bottom: 0 }
|
|
||||||
else return { top: 0, class: '!pb-24', bottom: 96 }
|
|
||||||
}
|
|
||||||
|
|
||||||
return { top: 0, class: ' failed-to-calculate', bottom: 0 }
|
|
||||||
}
|
|
||||||
|
|
||||||
export let screenWidth = writable(1000)
|
|
||||||
|
|
||||||
let dockProps = $derived(
|
|
||||||
calculateDockProperties(settings.dock, innerWidth.current ?? 1000),
|
|
||||||
)
|
|
||||||
let contentPadding = $derived(
|
|
||||||
calculatePadding(dockProps.noGap, dockProps.top, true),
|
|
||||||
)
|
|
||||||
|
|
||||||
let contentPaddingStore = writable<{
|
|
||||||
top: number
|
|
||||||
bottom: number
|
|
||||||
class: string
|
|
||||||
}>(contentPadding)
|
|
||||||
let dockPropsStore = writable<{
|
|
||||||
noGap: boolean
|
|
||||||
top: boolean
|
|
||||||
}>(dockProps)
|
|
||||||
|
|
||||||
let sidePadding = $derived(
|
|
||||||
calculatePadding(dockProps.noGap, dockProps.top, false),
|
|
||||||
)
|
|
||||||
let topPanel = $derived(dockProps.noGap && dockProps.top)
|
|
||||||
|
|
||||||
export { contentPaddingStore as contentPadding, dockPropsStore as dockProps }
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { settings } from '$lib/settings.svelte.js'
|
import { settings } from '$lib/settings.svelte.js'
|
||||||
import { theme } from '$lib/ui/colors.svelte'
|
import { theme } from '$lib/ui/colors.svelte'
|
||||||
import { writable, type Readable, type Writable } from 'svelte/store'
|
import type { ClassValue, UIEventHandler } from 'svelte/elements'
|
||||||
import type { ClassValue } from 'svelte/elements'
|
import { scrollY } from 'svelte/reactivity/window'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
route?: { id: string | null } | undefined
|
route?: { id: string | null } | undefined
|
||||||
@@ -118,12 +26,23 @@
|
|||||||
...rest
|
...rest
|
||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
|
|
||||||
$effect(() => {
|
let previousTop = 0
|
||||||
contentPaddingStore.set(contentPadding)
|
const onscroll: UIEventHandler<Window> = (e) => {
|
||||||
dockPropsStore.set(dockProps)
|
if (!settings.dock.autoHide) {
|
||||||
})
|
dockVisible = true
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
dockVisible = (scrollY?.current ?? 0) <= previousTop
|
||||||
|
|
||||||
|
previousTop = scrollY?.current ?? 0
|
||||||
|
}
|
||||||
|
|
||||||
|
let dockVisible = $state(true)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<svelte:window {onscroll} />
|
||||||
|
|
||||||
<div
|
<div
|
||||||
{...rest}
|
{...rest}
|
||||||
class="shell bg-slate-50 dark:bg-zinc-950 {clazz}"
|
class="shell bg-slate-50 dark:bg-zinc-950 {clazz}"
|
||||||
@@ -131,34 +50,18 @@
|
|||||||
>
|
>
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
<div
|
<div
|
||||||
class="
|
class="fixed lg:sticky bottom-0 {dockVisible
|
||||||
{dockProps.noGap ? '' : 'p-4 max-w-3xl left-1/2 -translate-x-1/2'}
|
? ''
|
||||||
{dockProps.top ? 'top-0' : 'bottom-0'}
|
: 'max-lg:-bottom-24'} lg:top-0
|
||||||
{topPanel ? 'fixed top-0' : 'fixed'}
|
max-w-3xl p-4 left-1/2 -translate-x-1/2 lg:max-w-full lg:p-0 lg:left-0 lg:translate-x-0
|
||||||
w-full z-50 pointer-events-none"
|
w-full z-50 pointer-events-none"
|
||||||
style="grid-area: navbar;
|
style="grid-area: navbar;
|
||||||
transition-property: padding, top, bottom;
|
transition: bottom .4s cubic-bezier(0.075, 0.82, 0.165, 1);"
|
||||||
transition-duration: 250ms;
|
|
||||||
transition-timing-function: cubic-bezier(0.075, 0.82, 0.165, 1);"
|
|
||||||
>
|
>
|
||||||
{@render navbar?.({
|
{@render navbar?.({
|
||||||
class: `
|
class: `bg-slate-50/50 dark:bg-zinc-950/90 border-slate-100 dark:border-zinc-900
|
||||||
${
|
pointer-events-auto backdrop-blur-xl border lg:border-t-0 lg:border-x-0
|
||||||
dockProps.noGap
|
rounded-full lg:rounded-none`,
|
||||||
? dockProps.top
|
|
||||||
? 'border-b shadow-none rounded-none'
|
|
||||||
: 'border-t rounded-none'
|
|
||||||
: 'border rounded-full'
|
|
||||||
}
|
|
||||||
|
|
||||||
dark:bg-transparent transition-colors duration-500
|
|
||||||
pointer-events-auto backdrop-blur-xl ${
|
|
||||||
topPanel
|
|
||||||
? 'bg-slate-50/50 dark:bg-zinc-950/90 border-slate-100 dark:border-zinc-900'
|
|
||||||
: `border-slate-200 dark:border-zinc-800 shadow-2xl
|
|
||||||
bg-white/50 dark:bg-zinc-950/70`
|
|
||||||
}`,
|
|
||||||
style: 'transition: border-radius 250ms;',
|
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -168,17 +71,16 @@
|
|||||||
>
|
>
|
||||||
{@render sidebar?.({
|
{@render sidebar?.({
|
||||||
class: `hidden md:flex sticky top-0 left-0 h-max bg-slate-50 dark:bg-zinc-950
|
class: `hidden md:flex sticky top-0 left-0 h-max bg-slate-50 dark:bg-zinc-950
|
||||||
z-40
|
z-40 lg:top-16`,
|
||||||
${sidePadding.class}`,
|
|
||||||
style: 'grid-area: sidebar; width: 100% !important;',
|
style: 'grid-area: sidebar; width: 100% !important;',
|
||||||
})}
|
})}
|
||||||
{@render main?.({
|
{@render main?.({
|
||||||
class: `w-full bg-slate-25 dark:bg-zinc-925 justify-self-center shadow-sm z-0
|
class: `w-full bg-slate-25 dark:bg-zinc-925 justify-self-center shadow-sm z-0 main !pb-22 lg:!pb-0`,
|
||||||
${contentPadding.class} main`,
|
|
||||||
style: 'grid-area: main',
|
style: 'grid-area: main',
|
||||||
})}
|
})}
|
||||||
{@render suffix?.({
|
{@render suffix?.({
|
||||||
class: `max-xl:hidden w-full sticky top-0 left-0 max-h-screen bg-slate-50 dark:bg-zinc-950 z-40 ${sidePadding.class}`,
|
class: `max-xl:hidden w-full sticky top-0 left-0 max-h-screen bg-slate-50 dark:bg-zinc-950
|
||||||
|
z-40 lg:top-16`,
|
||||||
style: 'grid-area: suffix;',
|
style: 'grid-area: suffix;',
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { settings } from '$lib/settings.svelte'
|
import { settings } from '$lib/settings.svelte'
|
||||||
import { contentPadding } from '../Shell.svelte'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
pageHeader?: boolean
|
pageHeader?: boolean
|
||||||
@@ -24,14 +23,11 @@
|
|||||||
{pageHeader
|
{pageHeader
|
||||||
? `w-[calc(100%+2rem)] sm:w-[calc(100%+3rem)]
|
? `w-[calc(100%+2rem)] sm:w-[calc(100%+3rem)]
|
||||||
bg-slate-50 dark:bg-zinc-950 -m-4 sm:-m-6 mb-0 sm:mb-0 sm:p-6 p-4
|
bg-slate-50 dark:bg-zinc-950 -m-4 sm:-m-6 mb-0 sm:mb-0 sm:p-6 p-4
|
||||||
border-b border-slate-200 dark:border-zinc-800`
|
border-b border-slate-200 dark:border-zinc-800 margin`
|
||||||
: ''}
|
: ''}
|
||||||
|
|
||||||
"
|
"
|
||||||
style="{pageHeader
|
{style}
|
||||||
? `margin-top: min(-12rem, calc(-1 * calc(${$contentPadding.top}px))); padding-top: max(12rem, calc(${$contentPadding.top}px));`
|
|
||||||
: ''} {style};
|
|
||||||
"
|
|
||||||
>
|
>
|
||||||
<h1
|
<h1
|
||||||
class="text-3xl font-medium flex gap-2 w-full
|
class="text-3xl font-medium flex gap-2 w-full
|
||||||
@@ -45,3 +41,17 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.margin {
|
||||||
|
margin-top: -12rem;
|
||||||
|
padding-top: 12rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media screen and (min-width: 1024px) {
|
||||||
|
.margin {
|
||||||
|
margin-top: -4rem;
|
||||||
|
padding-top: 4rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { page } from '$app/state'
|
import { page } from '$app/state'
|
||||||
import { Button } from 'mono-svelte'
|
import { Button, buttonColor } from 'mono-svelte'
|
||||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||||
import { dockProps } from '../layout/Shell.svelte'
|
|
||||||
import type { ButtonProps } from 'mono-svelte/button/Button.svelte'
|
import type { ButtonProps } from 'mono-svelte/button/Button.svelte'
|
||||||
|
|
||||||
interface Props extends ButtonProps {
|
interface Props extends ButtonProps {
|
||||||
@@ -19,8 +18,8 @@
|
|||||||
|
|
||||||
let {
|
let {
|
||||||
label,
|
label,
|
||||||
icon = undefined,
|
icon,
|
||||||
href = undefined,
|
href,
|
||||||
adaptive = true,
|
adaptive = true,
|
||||||
isSelectedFilter = (path) => href != undefined && path == href,
|
isSelectedFilter = (path) => href != undefined && path == href,
|
||||||
class: clazz = '',
|
class: clazz = '',
|
||||||
@@ -30,35 +29,38 @@
|
|||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
|
|
||||||
let isSelected = $derived(isSelectedFilter(page.url.pathname))
|
let isSelected = $derived(isSelectedFilter(page.url.pathname))
|
||||||
let isPanel = $derived(adaptive ? $dockProps?.noGap : false)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
color={isPanel ? 'secondary' : 'tertiary'}
|
color="none"
|
||||||
{...rest}
|
{...rest}
|
||||||
class="rounded-full w-10 h-10 flex-shrink-0 {adaptive
|
class={[
|
||||||
? '@3xl:h-8 @3xl:px-3 @3xl:rounded-[10px] @3xl:w-auto'
|
'flex-shrink-0 rounded-full w-10 h-10 lg:w-max lg:h-8 lg:px-3 lg:rounded-xl',
|
||||||
: ''} {isSelected
|
isSelected &&
|
||||||
? 'bg-slate-200 dark:bg-zinc-900 text-primary-900 dark:!text-primary-100'
|
'bg-slate-200 dark:bg-zinc-900 text-primary-900 dark:!text-primary-100',
|
||||||
: ''} {clazz}"
|
!rest.color && buttonColor.tertiary,
|
||||||
|
!rest.color &&
|
||||||
|
'lg:bg-white lg:dark:bg-zinc-900 border lg:border-slate-200 lg:border-b-slate-300 lg:dark:border-zinc-800 lg:dark:border-t-zinc-700/50 lg:hover:bg-slate-100 lg:hover:dark:bg-zinc-800 lg:active:bg-slate-200 lg:active:dark:bg-zinc-950',
|
||||||
|
clazz,
|
||||||
|
]}
|
||||||
size="custom"
|
size="custom"
|
||||||
|
rounding="none"
|
||||||
{href}
|
{href}
|
||||||
rounding="pill"
|
|
||||||
title={label}
|
title={label}
|
||||||
style="transition-property: background-color, filter;"
|
style="transition-property: background-color, filter;"
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
{#if icon}
|
{#if icon}
|
||||||
<Icon
|
<div class="lg:hidden">
|
||||||
src={icon}
|
<Icon src={icon} size="18" />
|
||||||
micro={isPanel}
|
</div>
|
||||||
solid={!isPanel && isSelected}
|
<div class="max-lg:hidden">
|
||||||
size={isPanel ? '16' : '18'}
|
<Icon src={icon} micro solid={isSelected} size="16" />
|
||||||
/>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
{@render customIcon?.({ size: isPanel ? 16 : 18, isSelected })}
|
{@render customIcon?.({ size: 16, isSelected })}
|
||||||
{/if}
|
{/if}
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<span class="hidden {adaptive ? '@3xl:block' : ''}">{label}</span>
|
<span class="hidden {adaptive ? 'lg:block' : ''}">{label}</span>
|
||||||
{@render children?.()}
|
{@render children?.()}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
}}
|
}}
|
||||||
href="/"
|
href="/"
|
||||||
label={$t('nav.home')}
|
label={$t('nav.home')}
|
||||||
class="ml-2 logo"
|
class="ml-2 lg:ml-2 logo border-0 lg:rounded-full lg:w-10 lg:h-10 lg:!p-0"
|
||||||
adaptive={false}
|
adaptive={false}
|
||||||
>
|
>
|
||||||
{#snippet customIcon()}
|
{#snippet customIcon()}
|
||||||
|
|||||||
@@ -698,6 +698,10 @@
|
|||||||
"pins": {
|
"pins": {
|
||||||
"title": "Pins",
|
"title": "Pins",
|
||||||
"description": "Click a pin to send it to the top of the sidebar. Right click a pinned item to remove it."
|
"description": "Click a pin to send it to the top of the sidebar. Right click a pinned item to remove it."
|
||||||
|
},
|
||||||
|
"autoHide": {
|
||||||
|
"title": "Auto hide dock",
|
||||||
|
"description": "Hides the dock on mobile when you scroll down, re-appears when you scroll up."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"app": {
|
"app": {
|
||||||
|
|||||||
@@ -121,7 +121,7 @@
|
|||||||
animations?: any
|
animations?: any
|
||||||
loaderWidth?: number | undefined
|
loaderWidth?: number | undefined
|
||||||
href?: string | undefined
|
href?: string | undefined
|
||||||
class?: string
|
class?: ClassValue
|
||||||
prefix?: Snippet
|
prefix?: Snippet
|
||||||
children?: Snippet
|
children?: Snippet
|
||||||
suffix?: Snippet
|
suffix?: Snippet
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { HTMLButtonAttributes } from 'svelte/elements'
|
import type { ClassValue, HTMLButtonAttributes } from 'svelte/elements'
|
||||||
|
|
||||||
import Spinner from '../loader/Spinner.svelte'
|
import Spinner from '../loader/Spinner.svelte'
|
||||||
import type { Snippet } from 'svelte'
|
import type { Snippet } from 'svelte'
|
||||||
@@ -167,19 +167,19 @@
|
|||||||
role={href ? 'link' : 'button'}
|
role={href ? 'link' : 'button'}
|
||||||
{href}
|
{href}
|
||||||
{...rest}
|
{...rest}
|
||||||
class="
|
class={[
|
||||||
{loading ? buttonColor.secondary : buttonColor[color]}
|
loading ? buttonColor.secondary : buttonColor[color],
|
||||||
{buttonSize[size]}
|
buttonSize[size],
|
||||||
{buttonRounding[rounding][roundingSide]}
|
buttonRounding[rounding][roundingSide],
|
||||||
{buttonShadow[shadow]}
|
buttonShadow[shadow],
|
||||||
text-sm transition-all font-medium cursor-pointer duration-75
|
'text-sm transition-all font-medium cursor-pointer duration-75 disabled:opacity-50 disabled:pointer-events-none',
|
||||||
disabled:opacity-50 disabled:pointer-events-none
|
alignment == 'center'
|
||||||
{alignment == 'center'
|
? 'origin-center'
|
||||||
? 'origin-center'
|
: alignment == 'left'
|
||||||
: alignment == 'left'
|
? 'origin-left'
|
||||||
? 'origin-left'
|
: 'origin-right',
|
||||||
: 'origin-right'}
|
clazz,
|
||||||
{clazz}"
|
]}
|
||||||
type={submit ? 'submit' : 'button'}
|
type={submit ? 'submit' : 'button'}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -84,9 +84,8 @@ interface Settings {
|
|||||||
piped: string | undefined
|
piped: string | undefined
|
||||||
}
|
}
|
||||||
dock: {
|
dock: {
|
||||||
noGap: boolean | null
|
|
||||||
top: boolean | null
|
|
||||||
paletteHotkey: string
|
paletteHotkey: string
|
||||||
|
autoHide: boolean
|
||||||
}
|
}
|
||||||
posts: {
|
posts: {
|
||||||
deduplicateEmbed: boolean
|
deduplicateEmbed: boolean
|
||||||
@@ -164,9 +163,8 @@ export const defaultSettings: Settings = {
|
|||||||
piped: undefined,
|
piped: undefined,
|
||||||
},
|
},
|
||||||
dock: {
|
dock: {
|
||||||
noGap: toBool(env.PUBLIC_DOCK_PANEL) ?? null,
|
|
||||||
top: toBool(env.PUBLIC_DOCK_TOP) ?? null,
|
|
||||||
paletteHotkey: '/',
|
paletteHotkey: '/',
|
||||||
|
autoHide: true,
|
||||||
},
|
},
|
||||||
posts: {
|
posts: {
|
||||||
deduplicateEmbed: toBool(env.PUBLIC_DEDUPLICATE_EMBED) ?? true,
|
deduplicateEmbed: toBool(env.PUBLIC_DEDUPLICATE_EMBED) ?? true,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import { notifications } from '$lib/auth.svelte'
|
import { notifications } from '$lib/auth.svelte'
|
||||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
import {} from '$lib/components/ui/layout/Shell.svelte'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import { Badge } from 'mono-svelte'
|
import { Badge } from 'mono-svelte'
|
||||||
/**
|
/**
|
||||||
@@ -23,8 +23,8 @@
|
|||||||
|
|
||||||
<div class="flex flex-col gap-4 h-full">
|
<div class="flex flex-col gap-4 h-full">
|
||||||
<div
|
<div
|
||||||
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2"
|
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2
|
||||||
style="top: max(1.5rem, {$contentPadding.top}px);"
|
top-6 lg:top-22"
|
||||||
>
|
>
|
||||||
<Tabs
|
<Tabs
|
||||||
routes={[
|
routes={[
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { goto } from '$app/navigation'
|
|
||||||
import { page } from '$app/state'
|
|
||||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
|
||||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
|
||||||
import { t } from '$lib/translations.js'
|
import { t } from '$lib/translations.js'
|
||||||
import { fullCommunityName } from '$lib/util.svelte.js'
|
import { fullCommunityName } from '$lib/util.svelte.js'
|
||||||
import type { PageData } from './$types.js'
|
import type { PageData } from './$types.js'
|
||||||
@@ -25,8 +21,7 @@
|
|||||||
|
|
||||||
<div class="flex flex-col gap-4 h-full">
|
<div class="flex flex-col gap-4 h-full">
|
||||||
<div
|
<div
|
||||||
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2"
|
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2 top-6 lg:top-22"
|
||||||
style="top: max(1.5rem, {$contentPadding.top}px);"
|
|
||||||
>
|
>
|
||||||
<Tabs
|
<Tabs
|
||||||
routes={[
|
routes={[
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
import { t } from '$lib/translations.js'
|
import { t } from '$lib/translations.js'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
|
||||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||||
import { fly } from 'svelte/transition'
|
import { fly } from 'svelte/transition'
|
||||||
import { backOut, expoOut } from 'svelte/easing'
|
import { backOut, expoOut } from 'svelte/easing'
|
||||||
@@ -64,10 +63,7 @@
|
|||||||
</Header>
|
</Header>
|
||||||
|
|
||||||
<form method="get" action="/communities" class="contents" bind:this={form}>
|
<form method="get" action="/communities" class="contents" bind:this={form}>
|
||||||
<div
|
<div class="mt-4 mb-0 sticky z-30 top-6 lg:top-22">
|
||||||
class="mt-4 mb-0 sticky z-30"
|
|
||||||
style="top: max(1.5rem, {$contentPadding.top}px);"
|
|
||||||
>
|
|
||||||
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70 shadow-md shadow-black/5">
|
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70 shadow-md shadow-black/5">
|
||||||
<div class="flex gap-2 flex-row items-center w-full text-base h-10">
|
<div class="flex gap-2 flex-row items-center w-full text-base h-10">
|
||||||
<TextInput
|
<TextInput
|
||||||
@@ -198,10 +194,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
{/if}
|
{/if}
|
||||||
{#if communities.length > 0}
|
{#if communities.length > 0}
|
||||||
<div
|
<div class="sticky z-30 mx-auto max-w-full bottom-22 lg:bottom-6">
|
||||||
class="sticky z-30 mx-auto max-w-full"
|
|
||||||
style="bottom: max(1.5rem, {$contentPadding.bottom}px);"
|
|
||||||
>
|
|
||||||
<Tabs routes={[]} class="mx-auto">
|
<Tabs routes={[]} class="mx-auto">
|
||||||
<Pageination
|
<Pageination
|
||||||
page={Number(page.url.searchParams.get('page')) || 1}
|
page={Number(page.url.searchParams.get('page')) || 1}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
|
||||||
import { expoOut } from 'svelte/easing'
|
import { expoOut } from 'svelte/easing'
|
||||||
|
|
||||||
let { data } = $props()
|
let { data } = $props()
|
||||||
@@ -82,8 +81,7 @@
|
|||||||
<div class=" gap-2">
|
<div class=" gap-2">
|
||||||
<div
|
<div
|
||||||
class="mt-4 mb-0 sticky z-30 mx-auto max-w-full flex gap-2 md:flex-row flex-col
|
class="mt-4 mb-0 sticky z-30 mx-auto max-w-full flex gap-2 md:flex-row flex-col
|
||||||
items-center px-2 w-max"
|
items-center px-2 w-max top-6 lg:top-22"
|
||||||
style="top: max(1.5rem, {$contentPadding.top}px);"
|
|
||||||
>
|
>
|
||||||
<Tabs
|
<Tabs
|
||||||
routes={[
|
routes={[
|
||||||
@@ -195,8 +193,7 @@ items-center px-2 w-max"
|
|||||||
{/if}
|
{/if}
|
||||||
{#if !(data.page == 1 && (data?.data?.length ?? 0) == 0)}
|
{#if !(data.page == 1 && (data?.data?.length ?? 0) == 0)}
|
||||||
<div
|
<div
|
||||||
class="sticky z-30 mx-auto max-w-full self-end mt-auto"
|
class="sticky z-30 mx-auto max-w-full self-end mt-auto bottom-22 lg:bottom-6"
|
||||||
style="bottom: max(1.5rem, {$contentPadding.bottom}px);"
|
|
||||||
>
|
>
|
||||||
<Tabs routes={[]} class="mx-auto">
|
<Tabs routes={[]} class="mx-auto">
|
||||||
<Pageination
|
<Pageination
|
||||||
|
|||||||
@@ -46,7 +46,6 @@
|
|||||||
import { Popover } from 'mono-svelte'
|
import { Popover } from 'mono-svelte'
|
||||||
import { t } from '$lib/translations.js'
|
import { t } from '$lib/translations.js'
|
||||||
import { resumables } from '$lib/lemmy/item.js'
|
import { resumables } from '$lib/lemmy/item.js'
|
||||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
|
||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
import CommentListVirtualizer from '$lib/components/lemmy/comment/CommentListVirtualizer.svelte'
|
import CommentListVirtualizer from '$lib/components/lemmy/comment/CommentListVirtualizer.svelte'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
@@ -146,7 +145,7 @@
|
|||||||
if (res.post) {
|
if (res.post) {
|
||||||
removeToast(id)
|
removeToast(id)
|
||||||
goto(`/post/${instance.data}/${res.post.post.id}`, {}).then(() =>
|
goto(`/post/${instance.data}/${res.post.post.id}`, {}).then(() =>
|
||||||
removeToast(id)
|
removeToast(id),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -176,7 +175,7 @@
|
|||||||
let commenting = $state(false)
|
let commenting = $state(false)
|
||||||
|
|
||||||
let remoteView = $derived(
|
let remoteView = $derived(
|
||||||
page.params.instance?.toLowerCase() != instance.data?.toLowerCase()
|
page.params.instance?.toLowerCase() != instance.data?.toLowerCase(),
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -342,8 +341,7 @@
|
|||||||
<div
|
<div
|
||||||
class="sticky mx-auto z-50 max-w-lg w-full min-w-0 flex items-center overflow-auto gap-1
|
class="sticky mx-auto z-50 max-w-lg w-full min-w-0 flex items-center overflow-auto gap-1
|
||||||
bg-slate-50/50 dark:bg-zinc-900/50 backdrop-blur-xl border border-slate-200/50 dark:border-zinc-800/50
|
bg-slate-50/50 dark:bg-zinc-900/50 backdrop-blur-xl border border-slate-200/50 dark:border-zinc-800/50
|
||||||
p-1 rounded-full px-2.5 justify-between"
|
p-1 rounded-full px-2.5 justify-between top-6 lg:top-22"
|
||||||
style="top: max(1.5rem, {$contentPadding.top}px);"
|
|
||||||
>
|
>
|
||||||
<p class="font-medium text-sm flex items-center gap-2">
|
<p class="font-medium text-sm flex items-center gap-2">
|
||||||
<Icon src={InformationCircle} mini size="20" />
|
<Icon src={InformationCircle} mini size="20" />
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
|
||||||
import { site } from '$lib/lemmy.svelte'
|
import { site } from '$lib/lemmy.svelte'
|
||||||
import { t } from '$lib/translations'
|
import { t } from '$lib/translations'
|
||||||
import { feature } from '$lib/version'
|
import { feature } from '$lib/version'
|
||||||
@@ -31,8 +30,7 @@
|
|||||||
|
|
||||||
<div class="flex flex-col gap-4 h-full z-0">
|
<div class="flex flex-col gap-4 h-full z-0">
|
||||||
<div
|
<div
|
||||||
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2"
|
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2 top-6 lg:top-22"
|
||||||
style="top: max(1.5rem, {$contentPadding.top}px);"
|
|
||||||
>
|
>
|
||||||
<Tabs
|
<Tabs
|
||||||
class="overflow-auto"
|
class="overflow-auto"
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
import { t } from '$lib/translations.js'
|
import { t } from '$lib/translations.js'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
|
||||||
import { Select } from 'mono-svelte'
|
import { Select } from 'mono-svelte'
|
||||||
import {
|
import {
|
||||||
Icon,
|
Icon,
|
||||||
@@ -86,10 +85,7 @@
|
|||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div class="sticky z-30 mx-auto max-w-full bottom-22 lg:bottom-6">
|
||||||
class="sticky z-30 mx-auto max-w-full"
|
|
||||||
style="bottom: max(1.5rem, {$contentPadding.bottom}px);"
|
|
||||||
>
|
|
||||||
<Tabs routes={[]} class="mx-auto">
|
<Tabs routes={[]} class="mx-auto">
|
||||||
<Pageination href={(page) => `?page=${page}`} page={data.page} />
|
<Pageination href={(page) => `?page=${page}`} page={data.page} />
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
import { t } from '$lib/translations.js'
|
import { t } from '$lib/translations.js'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
|
||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
import Skeleton from '$lib/components/ui/generic/Skeleton.svelte'
|
import Skeleton from '$lib/components/ui/generic/Skeleton.svelte'
|
||||||
@@ -71,10 +70,7 @@
|
|||||||
{$t('routes.search.title')}
|
{$t('routes.search.title')}
|
||||||
</Header>
|
</Header>
|
||||||
<form method="get" action="/search" class="contents" bind:this={form}>
|
<form method="get" action="/search" class="contents" bind:this={form}>
|
||||||
<div
|
<div class="mt-4 mb-0 sticky z-30 top-6 lg:top-22">
|
||||||
class="mt-4 mb-0 sticky z-30"
|
|
||||||
style="top: max(1.5rem, {$contentPadding.top}px);"
|
|
||||||
>
|
|
||||||
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70">
|
<Tabs routes={[]} class="p-2 dark:bg-zinc-925/70">
|
||||||
<div class="flex gap-2 flex-row items-center w-full text-base h-10">
|
<div class="flex gap-2 flex-row items-center w-full text-base h-10">
|
||||||
<TextInput
|
<TextInput
|
||||||
|
|||||||
@@ -174,10 +174,6 @@
|
|||||||
<Icon src={ArrowTopRightOnSquare} size="14" micro />
|
<Icon src={ArrowTopRightOnSquare} size="14" micro />
|
||||||
{$t('settings.app.title')}
|
{$t('settings.app.title')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button href="#nav" size="sm" class="text-xs" rounding="pill">
|
|
||||||
<Icon src={ArrowTopRightOnSquare} size="14" micro />
|
|
||||||
{$t('settings.navigation.title')}
|
|
||||||
</Button>
|
|
||||||
<Button href="#embeds" size="sm" class="text-xs" rounding="pill">
|
<Button href="#embeds" size="sm" class="text-xs" rounding="pill">
|
||||||
<Icon src={ArrowTopRightOnSquare} size="14" micro />
|
<Icon src={ArrowTopRightOnSquare} size="14" micro />
|
||||||
{$t('settings.embeds.title')}
|
{$t('settings.embeds.title')}
|
||||||
@@ -392,6 +388,12 @@
|
|||||||
title={$t('settings.app.limitLayoutWidth.title')}
|
title={$t('settings.app.limitLayoutWidth.title')}
|
||||||
description={$t('settings.app.limitLayoutWidth.description')}
|
description={$t('settings.app.limitLayoutWidth.description')}
|
||||||
/>
|
/>
|
||||||
|
<ToggleSetting
|
||||||
|
supportedPlatforms={{ desktop: false, tablet: false, mobile: true }}
|
||||||
|
bind:checked={settings.dock.autoHide}
|
||||||
|
title={$t('settings.navigation.autoHide.title')}
|
||||||
|
description={$t('settings.navigation.autoHide.description')}
|
||||||
|
/>
|
||||||
<ToggleSetting
|
<ToggleSetting
|
||||||
bind:checked={settings.openLinksInNewTab}
|
bind:checked={settings.openLinksInNewTab}
|
||||||
title={$t('settings.app.postsInNewTab.title')}
|
title={$t('settings.app.postsInNewTab.title')}
|
||||||
@@ -470,46 +472,6 @@
|
|||||||
</Setting>
|
</Setting>
|
||||||
</div>
|
</div>
|
||||||
</Section>
|
</Section>
|
||||||
<Section id="nav" title={$t('settings.navigation.title')}>
|
|
||||||
<Setting>
|
|
||||||
{#snippet title()}
|
|
||||||
<span>{$t('settings.navigation.dockPos.title')}</span>
|
|
||||||
{/snippet}
|
|
||||||
{#snippet description()}
|
|
||||||
<span>
|
|
||||||
{$t('settings.navigation.dockPos.description')}
|
|
||||||
</span>
|
|
||||||
{/snippet}
|
|
||||||
<MultiSelect
|
|
||||||
options={[true, false, null]}
|
|
||||||
optionNames={[
|
|
||||||
$t('settings.navigation.dockPos.top'),
|
|
||||||
$t('settings.navigation.dockPos.bottom'),
|
|
||||||
$t('settings.navigation.dockPos.adaptive'),
|
|
||||||
]}
|
|
||||||
bind:selected={settings.dock.top}
|
|
||||||
/>
|
|
||||||
</Setting>
|
|
||||||
<Setting>
|
|
||||||
{#snippet title()}
|
|
||||||
<span>{$t('settings.navigation.panel.title')}</span>
|
|
||||||
{/snippet}
|
|
||||||
{#snippet description()}
|
|
||||||
<span>
|
|
||||||
{$t('settings.navigation.panel.description')}
|
|
||||||
</span>
|
|
||||||
{/snippet}
|
|
||||||
<MultiSelect
|
|
||||||
options={[true, false, null]}
|
|
||||||
optionNames={[
|
|
||||||
$t('settings.navigation.panel.on'),
|
|
||||||
$t('settings.navigation.panel.off'),
|
|
||||||
$t('settings.navigation.panel.adaptive'),
|
|
||||||
]}
|
|
||||||
bind:selected={settings.dock.noGap}
|
|
||||||
/>
|
|
||||||
</Setting>
|
|
||||||
</Section>
|
|
||||||
|
|
||||||
<Section id="embeds" title={$t('settings.embeds.title')}>
|
<Section id="embeds" title={$t('settings.embeds.title')}>
|
||||||
<ToggleSetting
|
<ToggleSetting
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import { page } from '$app/state'
|
import { page } from '$app/state'
|
||||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
|
||||||
interface Props {
|
interface Props {
|
||||||
children?: import('svelte').Snippet
|
children?: import('svelte').Snippet
|
||||||
}
|
}
|
||||||
@@ -13,8 +12,7 @@
|
|||||||
|
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
<div
|
<div
|
||||||
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2"
|
class="sticky mx-auto z-50 max-w-full min-w-0 flex items-center gap-2 top-6 lg:top-22"
|
||||||
style="top: max(1.5rem, {$contentPadding.top}px);"
|
|
||||||
>
|
>
|
||||||
<Tabs
|
<Tabs
|
||||||
routes={[
|
routes={[
|
||||||
|
|||||||
Reference in new issue
Block a user