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