impr: use Fixate component
This commit is contained in:
23 files changed
+66
-63
No files matched your search
Vendored
-1
@@ -14,7 +14,6 @@ declare global {
|
|||||||
slots?: {
|
slots?: {
|
||||||
sidebar?: {
|
sidebar?: {
|
||||||
component?: ComponentType
|
component?: ComponentType
|
||||||
// eslint-disable-next-line
|
|
||||||
props?: any
|
props?: any
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@
|
|||||||
listing_type?: ListingType
|
listing_type?: ListingType
|
||||||
showWhenEmpty?: boolean
|
showWhenEmpty?: boolean
|
||||||
placeholder?: string
|
placeholder?: string
|
||||||
// eslint-disable-next-line
|
|
||||||
onselect?: (item: any) => void
|
onselect?: (item: any) => void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,8 +22,6 @@
|
|||||||
Sun,
|
Sun,
|
||||||
Trophy,
|
Trophy,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import { backOut } from 'svelte/easing'
|
|
||||||
import { fly } from 'svelte/transition'
|
|
||||||
|
|
||||||
interface Props extends SelectProps<string> {
|
interface Props extends SelectProps<string> {
|
||||||
selected: string
|
selected: string
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
marked.use(linkify, {
|
marked.use(linkify, {
|
||||||
extensions: [
|
extensions: [
|
||||||
// @ts-expect-error hell with marked
|
// @ts-expect-error hell with marked
|
||||||
// eslint-disable-next-line
|
|
||||||
containerExtension((params: any) => {
|
containerExtension((params: any) => {
|
||||||
if (params.type == 'spoiler') {
|
if (params.type == 'spoiler') {
|
||||||
return {
|
return {
|
||||||
@@ -49,7 +48,6 @@
|
|||||||
return null
|
return null
|
||||||
}),
|
}),
|
||||||
// @ts-expect-error hell with marked
|
// @ts-expect-error hell with marked
|
||||||
// eslint-disable-next-line
|
|
||||||
subSupscriptExtension((params: any) => {
|
subSupscriptExtension((params: any) => {
|
||||||
if (params.type == 'subscript') {
|
if (params.type == 'subscript') {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
{#if icon}
|
{#if icon}
|
||||||
<div
|
<div
|
||||||
class={[
|
class={[
|
||||||
,
|
|
||||||
iconClass
|
iconClass
|
||||||
? iconClass
|
? iconClass
|
||||||
: 'bg-slate-100 dark:bg-zinc-900 p-3 rounded-2xl text-primary-900 dark:text-primary-100',
|
: 'bg-slate-100 dark:bg-zinc-900 p-3 rounded-2xl text-primary-900 dark:text-primary-100',
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import type { Snippet } from 'svelte'
|
||||||
|
|
||||||
|
const placements = {
|
||||||
|
top: 'top-6 lg:top-22',
|
||||||
|
bottom: 'bottom-22 lg:bottom-6',
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
placement: keyof typeof placements
|
||||||
|
children?: Snippet
|
||||||
|
}
|
||||||
|
|
||||||
|
let { placement, children }: Props = $props()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class={['sticky z-30 mb-0', placements[placement]]}>
|
||||||
|
{@render children?.()}
|
||||||
|
</div>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
class={[
|
class={[
|
||||||
'fixed lg:sticky bottom-0 lg:top-0',
|
'fixed lg:sticky bottom-0 lg:top-0',
|
||||||
!dockVisible && 'max-lg:-bottom-24',
|
!dockVisible && 'max-lg:-bottom-24',
|
||||||
'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',
|
'max-w-3xl p-3 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="transition: bottom .4s cubic-bezier(0.075, 0.82, 0.165, 1);"
|
style="transition: bottom .4s cubic-bezier(0.075, 0.82, 0.165, 1);"
|
||||||
|
|||||||
@@ -56,7 +56,7 @@
|
|||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
<div class={(icon || customIcon) && adaptive ? 'lg:hidden' : ''}>
|
<div class={(icon || customIcon) && adaptive ? 'lg:hidden' : ''}>
|
||||||
{#if icon}
|
{#if icon}
|
||||||
<Icon src={icon} size="18" micro />
|
<Icon src={icon} size="20" mini />
|
||||||
{:else}
|
{:else}
|
||||||
{@render customIcon?.({ size: 16, isSelected })}
|
{@render customIcon?.({ size: 16, isSelected })}
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -42,7 +42,6 @@
|
|||||||
|
|
||||||
const debounce = (fn: Function, ms = 300) => {
|
const debounce = (fn: Function, ms = 300) => {
|
||||||
let timeoutId: ReturnType<typeof setTimeout>
|
let timeoutId: ReturnType<typeof setTimeout>
|
||||||
// eslint-disable-next-line
|
|
||||||
return function (this: any, ...args: any[]) {
|
return function (this: any, ...args: any[]) {
|
||||||
clearTimeout(timeoutId)
|
clearTimeout(timeoutId)
|
||||||
timeoutId = setTimeout(() => fn.apply(this, args), ms)
|
timeoutId = setTimeout(() => fn.apply(this, args), ms)
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import { Modal } from 'mono-svelte'
|
import { Modal } from 'mono-svelte'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
// eslint-disable-next-line
|
|
||||||
object: any
|
object: any
|
||||||
open?: boolean
|
open?: boolean
|
||||||
title?: import('svelte').Snippet
|
title?: import('svelte').Snippet
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import DebugTree from './DebugTree.svelte'
|
import DebugTree from './DebugTree.svelte'
|
||||||
interface Props {
|
interface Props {
|
||||||
// eslint-disable-next-line
|
|
||||||
object: any
|
object: any
|
||||||
isParent?: boolean
|
isParent?: boolean
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ export const aliases = new Map([
|
|||||||
])
|
])
|
||||||
|
|
||||||
export const { t, locale, locales, loading, loadTranslations } = new i18n<
|
export const { t, locale, locales, loading, loadTranslations } = new i18n<
|
||||||
Parser.Params<any, object>, // eslint-disable-line
|
Parser.Params<any, object>,
|
||||||
object,
|
object,
|
||||||
object
|
object
|
||||||
>(config)
|
>(config)
|
||||||
@@ -14,7 +14,6 @@ export function errorMessage(error: any, instance?: string): string {
|
|||||||
|
|
||||||
return t.get(`error.${error}`)
|
return t.get(`error.${error}`)
|
||||||
} catch {
|
} catch {
|
||||||
// eslint-disable-next-line
|
|
||||||
return error as any
|
return error as any
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
export const debounce = (fn: Function, ms = 300) => {
|
export const debounce = (fn: Function, ms = 300) => {
|
||||||
let timeoutId: ReturnType<typeof setTimeout>
|
let timeoutId: ReturnType<typeof setTimeout>
|
||||||
// eslint-disable-next-line
|
|
||||||
return function (this: any, ...args: any[]) {
|
return function (this: any, ...args: any[]) {
|
||||||
clearTimeout(timeoutId)
|
clearTimeout(timeoutId)
|
||||||
timeoutId = setTimeout(() => fn.apply(this, args), ms)
|
timeoutId = setTimeout(() => fn.apply(this, args), ms)
|
||||||
|
|||||||
@@ -74,7 +74,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</ul>
|
</ul>
|
||||||
<form
|
<form
|
||||||
class="flex flex-row items-center gap-2 mt-auto w-full"
|
class="flex flex-row gap-2 mt-auto w-full"
|
||||||
onsubmit={preventDefault(() => {
|
onsubmit={preventDefault(() => {
|
||||||
trycatch(async () => {
|
trycatch(async () => {
|
||||||
if (!profile.current?.jwt || newAdmin == '') return
|
if (!profile.current?.jwt || newAdmin == '') return
|
||||||
@@ -106,7 +106,7 @@
|
|||||||
disabled={adding}
|
disabled={adding}
|
||||||
rounding="xl"
|
rounding="xl"
|
||||||
color="primary"
|
color="primary"
|
||||||
class="h-full"
|
size="sm"
|
||||||
submit
|
submit
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
import { goto } from '$app/navigation'
|
import { goto } from '$app/navigation'
|
||||||
import { profile } from '$lib/auth.svelte.js'
|
import { profile } from '$lib/auth.svelte.js'
|
||||||
import PostForm from '$lib/components/lemmy/post/form/PostForm.svelte'
|
import PostForm from '$lib/components/lemmy/post/form/PostForm.svelte'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
|
||||||
import { t } from '$lib/i18n/translations.js'
|
import { t } from '$lib/i18n/translations.js'
|
||||||
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
|
import { getSessionStorage, setSessionStorage } from '$lib/session.js'
|
||||||
import { onDestroy, onMount } from 'svelte'
|
import { onDestroy, onMount } from 'svelte'
|
||||||
@@ -24,7 +23,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
// TODO remove this
|
// TODO remove this
|
||||||
// eslint-disable-next-line
|
|
||||||
let post = getSessionStorage('postDraft') as any
|
let post = getSessionStorage('postDraft') as any
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
import { Button, Option, Select } from 'mono-svelte'
|
import { Button, Option, Select } from 'mono-svelte'
|
||||||
import { ArrowPath, Check, Funnel, Icon, Inbox } from 'svelte-hero-icons'
|
import { ArrowPath, Check, Funnel, Icon, Inbox } from 'svelte-hero-icons'
|
||||||
import InboxItem from './InboxItem.svelte'
|
import InboxItem from './InboxItem.svelte'
|
||||||
|
import Fixate from '$lib/components/ui/generic/Fixate.svelte'
|
||||||
|
|
||||||
let { data } = $props()
|
let { data } = $props()
|
||||||
|
|
||||||
@@ -114,9 +115,7 @@
|
|||||||
</CommonList>
|
</CommonList>
|
||||||
{/if}
|
{/if}
|
||||||
{#if !(data.page == 1 && (data?.inbox?.value.length ?? 0) == 0)}
|
{#if !(data.page == 1 && (data?.inbox?.value.length ?? 0) == 0)}
|
||||||
<div
|
<Fixate placement="bottom">
|
||||||
class="sticky z-30 mx-auto max-w-full self-end mt-auto bottom-22 lg:bottom-6"
|
|
||||||
>
|
|
||||||
<Pageination
|
<Pageination
|
||||||
hasMore={!(
|
hasMore={!(
|
||||||
!data.inbox || (data.inbox.value?.length ?? 0) < (data?.limit ?? 0)
|
!data.inbox || (data.inbox.value?.length ?? 0) < (data?.limit ?? 0)
|
||||||
@@ -124,5 +123,5 @@
|
|||||||
page={data.page}
|
page={data.page}
|
||||||
href={page => `?page=${page}`}
|
href={page => `?page=${page}`}
|
||||||
/>
|
/>
|
||||||
</div>
|
</Fixate>
|
||||||
{/if}
|
{/if}
|
||||||
@@ -21,6 +21,4 @@
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<div class="w-full space-y-4 pb-8">
|
{@render children?.()}
|
||||||
{@render children?.()}
|
|
||||||
</div>
|
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
import { tick } from 'svelte'
|
import { tick } from 'svelte'
|
||||||
import { Check, Funnel, Icon, ShieldCheck, XMark } from 'svelte-hero-icons'
|
import { Check, Funnel, Icon, ShieldCheck, XMark } from 'svelte-hero-icons'
|
||||||
import Report from './Report.svelte'
|
import Report from './Report.svelte'
|
||||||
|
import Fixate from '$lib/components/ui/generic/Fixate.svelte'
|
||||||
|
|
||||||
let { data = $bindable() } = $props()
|
let { data = $bindable() } = $props()
|
||||||
|
|
||||||
@@ -153,11 +154,13 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</CommonList>
|
</CommonList>
|
||||||
<Pageination
|
<Fixate placement="bottom">
|
||||||
page={data.page}
|
<Pageination
|
||||||
href={current => `?page=${current}`}
|
page={data.page}
|
||||||
hasMore={data.items.value.length >= 20}
|
href={current => `?page=${current}`}
|
||||||
/>
|
hasMore={data.items.value.length >= 20}
|
||||||
|
/>
|
||||||
|
</Fixate>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="h-full grid place-items-center">
|
<div class="h-full grid place-items-center">
|
||||||
<Placeholder
|
<Placeholder
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
import { profile } from '$lib/auth.svelte.js'
|
import { profile } from '$lib/auth.svelte.js'
|
||||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
|
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
||||||
import Entity from '$lib/components/ui/Entity.svelte'
|
import Entity from '$lib/components/ui/Entity.svelte'
|
||||||
|
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
|
||||||
import { t } from '$lib/i18n/translations.js'
|
import { t } from '$lib/i18n/translations.js'
|
||||||
import { getClient } from '$lib/lemmy.svelte.js'
|
import { getClient } from '$lib/lemmy.svelte.js'
|
||||||
import type {
|
import type {
|
||||||
@@ -14,11 +15,8 @@
|
|||||||
PersonBlockView,
|
PersonBlockView,
|
||||||
} from 'lemmy-js-client'
|
} from 'lemmy-js-client'
|
||||||
import { Button } from 'mono-svelte'
|
import { Button } from 'mono-svelte'
|
||||||
import Material from 'mono-svelte/materials/Material.svelte'
|
|
||||||
import { Check, Icon, XMark } from 'svelte-hero-icons'
|
import { Check, Icon, XMark } from 'svelte-hero-icons'
|
||||||
import type { PageData } from './$types.js'
|
import type { PageData } from './$types.js'
|
||||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
|
||||||
import EndPlaceholder from '$lib/components/ui/EndPlaceholder.svelte'
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
// sveltekit doesn't feel like making types work right now
|
// sveltekit doesn't feel like making types work right now
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
import { page } from '$app/state'
|
import { page } from '$app/state'
|
||||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||||
import PostItem from '$lib/components/lemmy/post/PostItem.svelte'
|
import PostItem from '$lib/components/lemmy/post/PostItem.svelte'
|
||||||
|
import Fixate from '$lib/components/ui/generic/Fixate.svelte'
|
||||||
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
import CommonList from '$lib/components/ui/layout/CommonList.svelte'
|
||||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||||
@@ -78,10 +79,10 @@
|
|||||||
{/snippet}
|
{/snippet}
|
||||||
</CommonList>
|
</CommonList>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="sticky z-30 mx-auto max-w-full bottom-22 lg:bottom-6">
|
<Fixate placement="bottom">
|
||||||
<Pageination
|
<Pageination
|
||||||
hasMore={data.data.length == 40}
|
hasMore={data.data.length == 40}
|
||||||
href={page => `?page=${page}`}
|
href={page => `?page=${page}`}
|
||||||
page={data.page}
|
page={data.page}
|
||||||
/>
|
/>
|
||||||
</div>
|
</Fixate>
|
||||||
@@ -26,7 +26,7 @@ export async function load({ url, fetch }) {
|
|||||||
const { posts, comments } = await client({ func: fetch }).getPersonDetails({
|
const { posts, comments } = await client({ func: fetch }).getPersonDetails({
|
||||||
saved_only: true,
|
saved_only: true,
|
||||||
limit: 20,
|
limit: 20,
|
||||||
page: 1,
|
page: page,
|
||||||
person_id: user?.local_user_view.person.id,
|
person_id: user?.local_user_view.person.id,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -13,30 +13,28 @@
|
|||||||
let searchElement = $state<HTMLInputElement>()
|
let searchElement = $state<HTMLInputElement>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="mb-0 sticky z-30 top-6 lg:top-22">
|
<div
|
||||||
<div
|
class="flex gap-2 flex-row items-center w-full text-base h-10 drop-shadow-xl"
|
||||||
class="flex gap-2 flex-row items-center w-full text-base h-10 drop-shadow-xl"
|
>
|
||||||
|
<TextInput
|
||||||
|
bind:value={query}
|
||||||
|
bind:element={searchElement}
|
||||||
|
name="q"
|
||||||
|
placeholder={$t('routes.search.query')}
|
||||||
|
size="lg"
|
||||||
|
class="flex-1 rounded-full! h-full text-base!"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
submit
|
||||||
|
color="primary"
|
||||||
|
size="custom"
|
||||||
|
class="shrink-0 h-full aspect-square shadow-md"
|
||||||
|
title="Search"
|
||||||
|
rounding="pill"
|
||||||
|
loading={navigating.to?.route.id == '/search'}
|
||||||
>
|
>
|
||||||
<TextInput
|
{#snippet prefix()}
|
||||||
bind:value={query}
|
<Icon src={MagnifyingGlass} size="16" micro />
|
||||||
bind:element={searchElement}
|
{/snippet}
|
||||||
name="q"
|
</Button>
|
||||||
placeholder={$t('routes.search.query')}
|
|
||||||
size="lg"
|
|
||||||
class="flex-1 rounded-full! h-full text-base!"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
submit
|
|
||||||
color="primary"
|
|
||||||
size="custom"
|
|
||||||
class="shrink-0 h-full aspect-square shadow-md"
|
|
||||||
title="Search"
|
|
||||||
rounding="pill"
|
|
||||||
loading={navigating.to?.route.id == '/search'}
|
|
||||||
>
|
|
||||||
{#snippet prefix()}
|
|
||||||
<Icon src={MagnifyingGlass} size="16" micro />
|
|
||||||
{/snippet}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
Reference in new issue
Block a user