cleanup: use native html forms for earch and communities
This commit is contained in:
1 parent
e46422c27b
commit
73a4c16322
37 files changed
+254
-246
No files matched your search
@@ -25,7 +25,7 @@
|
||||
import { Button, Modal } from 'mono-svelte'
|
||||
import { publishedToDate } from '$lib/components/util/date.js'
|
||||
import ShieldIcon from '../moderation/ShieldIcon.svelte'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { onMount } from 'svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import { fly, slide } from 'svelte/transition'
|
||||
@@ -90,7 +90,7 @@
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if ('#' + node.comment_view.comment.id.toString() == $page.url.hash) {
|
||||
if ('#' + node.comment_view.comment.id.toString() == page.url.hash) {
|
||||
highlight = 'text-primary-900 dark:text-primary-100 font-medium'
|
||||
|
||||
setTimeout(() => (highlight = 'duration-[3s] transition-all'), 500)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import Comments from './Comments.svelte'
|
||||
import Comment from './Comment.svelte'
|
||||
import { buildCommentsTree, type CommentNodeI } from './comments.svelte'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { onMount, setContext } from 'svelte'
|
||||
import { Icon, ArrowDownCircle } from 'svelte-hero-icons'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
onMount(() => {
|
||||
hydrated = true
|
||||
if (isParent && $page.url.hash && browser) {
|
||||
document.getElementById($page.url.hash)?.scrollIntoView({
|
||||
if (isParent && page.url.hash && browser) {
|
||||
document.getElementById(page.url.hash)?.scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
block: 'center',
|
||||
})
|
||||
@@ -51,7 +51,7 @@
|
||||
try {
|
||||
parent.loading = true
|
||||
|
||||
const newComments = await getClient($page.params.instance).getComments({
|
||||
const newComments = await getClient(page.params.instance).getComments({
|
||||
max_depth: 5,
|
||||
parent_id: parent.comment_view.comment.id,
|
||||
type_: 'All',
|
||||
@@ -128,7 +128,7 @@
|
||||
<svelte:element
|
||||
this={hydrated ? 'div' : 'a'}
|
||||
class="w-full my-2 h-8"
|
||||
href="/comment/{$page.params.instance}/{node.comment_view.comment.id}"
|
||||
href="/comment/{page.params.instance}/{node.comment_view.comment.id}"
|
||||
>
|
||||
<Button
|
||||
loading={node.loading}
|
||||
@@ -140,7 +140,7 @@
|
||||
onclick={() => {
|
||||
if (node.depth > 4) {
|
||||
goto(
|
||||
`/comment/${$page.params.instance}/${node.comment_view.comment.id}#comments`,
|
||||
`/comment/${page.params.instance}/${node.comment_view.comment.id}#comments`,
|
||||
)
|
||||
} else {
|
||||
node.loading = true
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { searchParam } from '$lib/util.svelte'
|
||||
import { Select } from 'mono-svelte'
|
||||
@@ -35,7 +35,7 @@
|
||||
{...rest}
|
||||
bind:value={selected}
|
||||
onchange={() => {
|
||||
if (navigate) searchParam($page.url, 'type', selected, 'page', 'cursor')
|
||||
if (navigate) searchParam(page.url, 'type', selected, 'page', 'cursor')
|
||||
}}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { t } from '$lib/translations'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { Select } from 'mono-svelte'
|
||||
@@ -51,7 +51,7 @@
|
||||
bind:value={sort}
|
||||
onchange={() => {
|
||||
setSelected()
|
||||
if (navigate) searchParam($page.url, 'sort', selected, 'page', 'cursor')
|
||||
if (navigate) searchParam(page.url, 'sort', selected, 'page', 'cursor')
|
||||
}}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
@@ -96,7 +96,7 @@
|
||||
onchange={() => {
|
||||
sort = 'TopAll'
|
||||
if (navigate)
|
||||
searchParam($page.url, 'sort', selected, 'page', 'cursor')
|
||||
searchParam(page.url, 'sort', selected, 'page', 'cursor')
|
||||
}}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { Button, Material, toast } from 'mono-svelte'
|
||||
import {
|
||||
ArrowDownTray,
|
||||
@@ -50,7 +50,7 @@
|
||||
let { alt = '', class: clazz = '', children }: Props = $props()
|
||||
</script>
|
||||
|
||||
{#if $page.state.openImage || '' != ''}
|
||||
{#if page.state.openImage || '' != ''}
|
||||
<!-- svelte-ignore a11y_no_noninteractive_tabindex -->
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
@@ -68,7 +68,7 @@
|
||||
<img
|
||||
width={400}
|
||||
height={400}
|
||||
src={$page.state.openImage}
|
||||
src={page.state.openImage}
|
||||
class="{zoomed
|
||||
? 'object-cover'
|
||||
: 'object-contain'} max-w-max mx-auto my-auto overscroll-contain bg-white dark:bg-zinc-900"
|
||||
@@ -93,7 +93,7 @@
|
||||
>
|
||||
<Button
|
||||
download
|
||||
href={$page.state.openImage}
|
||||
href={page.state.openImage}
|
||||
color="tertiary"
|
||||
size="square-lg"
|
||||
rounding="pill"
|
||||
@@ -104,13 +104,13 @@
|
||||
<Button
|
||||
onclick={async () => {
|
||||
if (navigator.share) {
|
||||
const file = await downloadImage($page.state.openImage)
|
||||
const file = await downloadImage(page.state.openImage)
|
||||
|
||||
navigator?.share?.({
|
||||
files: [file],
|
||||
})
|
||||
} else {
|
||||
navigator.clipboard.writeText($page.state.openImage)
|
||||
navigator.clipboard.writeText(page.state.openImage)
|
||||
toast({ content: $t('toast.copied') })
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { invalidate } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { fly } from 'svelte/transition'
|
||||
|
||||
interface Props {
|
||||
@@ -47,7 +47,7 @@
|
||||
transition-colors duration-100 relative z-0 flex-shrink-0"
|
||||
>
|
||||
{route.name}
|
||||
{#if isSelected($page.url, currentRoute, route.href, defaultRoute)}
|
||||
{#if isSelected(page.url, currentRoute, route.href, defaultRoute)}
|
||||
<div
|
||||
class="rounded-full bg-slate-100/60 dark:bg-zinc-700/60
|
||||
absolute inset-0 w-full h-full -z-10"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
import { dockProps } from '../layout/Shell.svelte'
|
||||
@@ -28,7 +28,7 @@
|
||||
...rest
|
||||
}: Props = $props()
|
||||
|
||||
let isSelected = $derived(isSelectedFilter($page.url.pathname))
|
||||
let isSelected = $derived(isSelectedFilter(page.url.pathname))
|
||||
let isPanel = $derived(adaptive ? $dockProps.noGap : false)
|
||||
</script>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
import { profile, profileData } from '$lib/auth.svelte'
|
||||
import { getGroups, type Action, type Group } from './actions.svelte'
|
||||
import { themeData } from '$lib/ui/colors'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
|
||||
interface Props {
|
||||
open?: boolean
|
||||
@@ -235,7 +235,7 @@
|
||||
$profile,
|
||||
$profileData.profiles,
|
||||
$themeData,
|
||||
$page.data.contextual?.actions,
|
||||
page.data.contextual?.actions,
|
||||
)
|
||||
})
|
||||
let flattenedActions = $derived(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { setUserID, type Profile } from '$lib/auth.svelte'
|
||||
import {
|
||||
amModOfAny,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { profile, setUserID, type Profile } from '$lib/auth.svelte.js'
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance'
|
||||
@@ -31,7 +31,7 @@
|
||||
await setUserID(prof.id)
|
||||
}
|
||||
|
||||
await goto($page.url, {
|
||||
await goto(page.url, {
|
||||
invalidateAll: true,
|
||||
})
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import { Icon, type IconSource } from 'svelte-hero-icons'
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
run(() => {
|
||||
if (href != undefined) {
|
||||
selected = $page.url.pathname == href
|
||||
selected = page.url.pathname == href
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
import Menu from '../../popover/Menu.svelte'
|
||||
import MenuButton from '../../popover/MenuButton.svelte'
|
||||
import Popover from '../../popover/Popover.svelte'
|
||||
import { createEventDispatcher, onMount, setContext } from 'svelte'
|
||||
import { createEventDispatcher, onMount, setContext, tick } from 'svelte'
|
||||
import {
|
||||
CheckCircle,
|
||||
ChevronDown,
|
||||
@@ -51,8 +51,8 @@
|
||||
customLabel?: import('svelte').Snippet
|
||||
children?: import('svelte').Snippet
|
||||
customOption?: import('svelte').Snippet<[any]>
|
||||
oncontextmenu?: () => void
|
||||
onchange?: () => void
|
||||
oncontextmenu?: HTMLSelectAttributes['oncontextmenu']
|
||||
onchange?: HTMLSelectAttributes['onchange']
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -99,8 +99,8 @@
|
||||
e.preventDefault()
|
||||
open = !open
|
||||
}}
|
||||
onchange={bubble('change')}
|
||||
oncontextmenu={bubble('contextmenu')}
|
||||
{onchange}
|
||||
{oncontextmenu}
|
||||
{placeholder}
|
||||
>
|
||||
{#if placeholder}
|
||||
@@ -116,10 +116,10 @@
|
||||
selected: option.value == value,
|
||||
})}{:else}
|
||||
<MenuButton
|
||||
on:contextmenu={() => oncontextmenu?.()}
|
||||
onclick={() => {
|
||||
onclick={async () => {
|
||||
value = option.value
|
||||
onchange?.()
|
||||
await tick()
|
||||
element?.dispatchEvent(new Event('change', { bubbles: true }))
|
||||
}}
|
||||
size="custom"
|
||||
disabled={option.disabled}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { toast } from 'mono-svelte'
|
||||
import { settings } from '$lib/settings.svelte'
|
||||
import { get } from 'svelte/store'
|
||||
import type { SubscribedType } from 'lemmy-js-client'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { feature } from '$lib/version.js'
|
||||
import { client } from '$lib/lemmy.js'
|
||||
import { site } from './lemmy'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { errorMessage } from '$lib/lemmy/error'
|
||||
import { t } from '$lib/translations'
|
||||
import { Button } from 'mono-svelte'
|
||||
@@ -22,10 +22,10 @@
|
||||
class="text-primary-900 dark:text-primary-100 text-6xl font-black flex items-center flex-row gap-2
|
||||
font-display border-b pb-4 border-slate-200 dark:border-zinc-800"
|
||||
>
|
||||
{$page.status}
|
||||
{page.status}
|
||||
</h1>
|
||||
{#if $page?.error?.message}
|
||||
{@const error = getError($page?.error?.message)}
|
||||
{#if page?.error?.message}
|
||||
{@const error = getError(page?.error?.message)}
|
||||
{#if error.code}
|
||||
<code class="rounded-md dark:!bg-zinc-950 px-2 py-1 min-w-48">
|
||||
{error.string}
|
||||
@@ -39,7 +39,7 @@
|
||||
<div class="flex items-center gap-2">
|
||||
<Button
|
||||
rounding="xl"
|
||||
onclick={() => goto($page.url, { invalidateAll: true })}
|
||||
onclick={() => goto(page.url, { invalidateAll: true })}
|
||||
>
|
||||
{$t('message.retry')}
|
||||
</Button>
|
||||
|
||||
+16
-17
@@ -3,7 +3,7 @@
|
||||
|
||||
import Navbar from '$lib/components/ui/navbar/Navbar.svelte'
|
||||
import '../style/app.css'
|
||||
import { navigating, page } from '$app/stores'
|
||||
import { navigating, page } from '$app/state'
|
||||
import nProgress from 'nprogress'
|
||||
import 'nprogress/nprogress.css'
|
||||
import Moderation from '$lib/components/lemmy/moderation/Moderation.svelte'
|
||||
@@ -65,7 +65,6 @@
|
||||
})
|
||||
|
||||
if (browser) {
|
||||
let barTimeout: number = $state(0)
|
||||
$effect(() => {
|
||||
if (settings) {
|
||||
document.body.classList.remove(
|
||||
@@ -86,18 +85,18 @@
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
navigating.subscribe((value) => {
|
||||
if (value) {
|
||||
document.body.classList.toggle('wait', true)
|
||||
barTimeout = setTimeout(() => nProgress.start(), 100)
|
||||
} else {
|
||||
document.body.classList.toggle('wait', false)
|
||||
clearTimeout(barTimeout)
|
||||
nProgress.done()
|
||||
}
|
||||
})
|
||||
}
|
||||
let barTimeout: number = $state(0)
|
||||
$effect(() => {
|
||||
if (navigating.to) {
|
||||
document.body.classList.toggle('wait', true)
|
||||
barTimeout = setTimeout(() => nProgress.start(), 100)
|
||||
} else {
|
||||
document.body.classList.toggle('wait', false)
|
||||
clearTimeout(barTimeout)
|
||||
nProgress.done()
|
||||
}
|
||||
})
|
||||
|
||||
let error = $state(null)
|
||||
|
||||
@@ -139,7 +138,7 @@
|
||||
<Shell
|
||||
dir={$locale == 'he' && settings.useRtl ? 'rtl' : 'ltr'}
|
||||
class="min-h-screen "
|
||||
route={$page.route}
|
||||
route={page.route}
|
||||
>
|
||||
<Moderation />
|
||||
<ToastContainer />
|
||||
@@ -163,9 +162,9 @@
|
||||
{/snippet}
|
||||
{#snippet suffix({ class: c, style: s })}
|
||||
<div class={c} style={s}>
|
||||
{#if $page.data.slots?.sidebar?.component}
|
||||
{@const SvelteComponent = $page.data.slots.sidebar.component}
|
||||
<SvelteComponent {...$page.data.slots.sidebar.props} />
|
||||
{#if page.data.slots?.sidebar?.component}
|
||||
{@const SvelteComponent = page.data.slots.sidebar.component}
|
||||
<SvelteComponent {...page.data.slots.sidebar.props} />
|
||||
{:else if $site}
|
||||
<SiteCard
|
||||
site={$site.site_view}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
import ViewSelect from '$lib/components/lemmy/dropdowns/ViewSelect.svelte'
|
||||
@@ -70,9 +70,9 @@
|
||||
>
|
||||
<Pageination
|
||||
cursor={{ next: data.cursor.next }}
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
on:change={(p) => searchParam(page.url, 'page', p.detail.toString())}
|
||||
on:cursor={(c) => {
|
||||
searchParam($page.url, 'cursor', c.detail)
|
||||
searchParam(page.url, 'cursor', c.detail)
|
||||
}}
|
||||
>
|
||||
<span class="flex flex-row items-center gap-1">
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
@@ -18,7 +18,7 @@
|
||||
selected={data.unreadOnly ?? true}
|
||||
optionNames={[$t('filter.location.all'), $t('filter.unread')]}
|
||||
on:select={(e) =>
|
||||
searchParam($page.url, 'unreadOnly', e.detail.toString(), 'page')}
|
||||
searchParam(page.url, 'unreadOnly', e.detail.toString(), 'page')}
|
||||
/>
|
||||
{#if data.applications && data.applications.length > 0}
|
||||
<div class="flex flex-col gap-4">
|
||||
@@ -30,7 +30,7 @@
|
||||
<div class="mt-auto">
|
||||
<Pageination
|
||||
page={data.page}
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
on:change={(p) => searchParam(page.url, 'page', p.detail.toString())}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { run } from 'svelte/legacy'
|
||||
|
||||
import { navigating, page } from '$app/stores'
|
||||
import { navigating, page } from '$app/state'
|
||||
import CommunityCard from '$lib/components/lemmy/community/CommunityCard.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
@@ -47,14 +47,14 @@
|
||||
resumables.add({
|
||||
name: data.community.community_view.community.title,
|
||||
type: 'community',
|
||||
url: $page.url.toString(),
|
||||
url: page.url.toString(),
|
||||
avatar: data.community.community_view.community.icon,
|
||||
})
|
||||
})
|
||||
|
||||
onDestroy(() => {
|
||||
if (browser) {
|
||||
if ($navigating?.to?.route?.id == '/create/post') return
|
||||
if (navigating?.to?.route?.id == '/create/post') return
|
||||
|
||||
setSessionStorage('lastSeenCommunity', undefined)
|
||||
}
|
||||
@@ -119,9 +119,9 @@
|
||||
<Pageination
|
||||
page={data.page}
|
||||
cursor={{ next: data.cursor.next }}
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
on:change={(p) => searchParam(page.url, 'page', p.detail.toString())}
|
||||
on:cursor={(c) => {
|
||||
searchParam($page.url, 'cursor', c.detail)
|
||||
searchParam(page.url, 'cursor', c.detail)
|
||||
}}
|
||||
>
|
||||
<span class="flex flex-row items-center gap-1">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { navigating, page } from '$app/stores'
|
||||
import { navigating, page } from '$app/state'
|
||||
import {
|
||||
GlobeAmericas,
|
||||
Icon,
|
||||
@@ -40,7 +40,9 @@
|
||||
})
|
||||
|
||||
let search = $state(data.query || '')
|
||||
let searchElement: HTMLInputElement | undefined = $state()
|
||||
let searchElement = $state<HTMLInputElement>()
|
||||
let form = $state<HTMLFormElement>()
|
||||
|
||||
let instance = ''
|
||||
|
||||
let showTop = $derived(
|
||||
@@ -66,40 +68,46 @@
|
||||
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">
|
||||
<form
|
||||
method="get"
|
||||
action="/communities"
|
||||
class="flex gap-2 flex-row items-center w-full text-base h-10"
|
||||
>
|
||||
<TextInput
|
||||
bind:value={search}
|
||||
bind:element={searchElement}
|
||||
name="q"
|
||||
aria-label={$t('routes.search.query')}
|
||||
size="lg"
|
||||
class="flex-1 !rounded-full h-full"
|
||||
placeholder={$t('routes.communities.search.placeholder')}
|
||||
<form method="get" action="/communities" bind:this={form}>
|
||||
<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">
|
||||
<TextInput
|
||||
bind:value={search}
|
||||
bind:element={searchElement}
|
||||
name="q"
|
||||
aria-label={$t('routes.search.query')}
|
||||
size="lg"
|
||||
class="flex-1 !rounded-full h-full"
|
||||
placeholder={$t('routes.communities.search.placeholder')}
|
||||
/>
|
||||
<Button
|
||||
submit
|
||||
color="primary"
|
||||
size="custom"
|
||||
class="flex-shrink-0 h-full aspect-square"
|
||||
title="Search"
|
||||
rounding="pill"
|
||||
loading={navigating.to != null}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</Tabs>
|
||||
<div class="flex flex-row flex-wrap gap-4 mt-4 items-center">
|
||||
<Location
|
||||
name="type"
|
||||
selected={data.type}
|
||||
onchange={() => form?.requestSubmit()}
|
||||
/>
|
||||
<Button
|
||||
submit
|
||||
color="primary"
|
||||
size="custom"
|
||||
class="flex-shrink-0 h-full aspect-square"
|
||||
title="Search"
|
||||
rounding="pill"
|
||||
loading={$navigating != null}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</form>
|
||||
</Tabs>
|
||||
</div>
|
||||
<div class="flex flex-row flex-wrap gap-4 mt-4 items-center">
|
||||
<Location selected={data.type} />
|
||||
<Sort selected={data.sort} />
|
||||
<Sort
|
||||
name="sort"
|
||||
selected={data.sort}
|
||||
onchange={() => form?.requestSubmit()}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<ul
|
||||
class="flex flex-col divide-y divide-slate-100 dark:divide-zinc-800 my-6 h-full"
|
||||
@@ -179,8 +187,8 @@
|
||||
>
|
||||
<Tabs routes={[]} class="mx-auto">
|
||||
<Pageination
|
||||
page={Number($page.url.searchParams.get('page')) || 1}
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
page={Number(page.url.searchParams.get('page')) || 1}
|
||||
on:change={(p) => searchParam(page.url, 'page', p.detail.toString())}
|
||||
/>
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
$notifications.inbox = 0
|
||||
|
||||
goto($page.url, {
|
||||
goto(page.url, {
|
||||
invalidateAll: true,
|
||||
}).then(() => {
|
||||
markingAsRead = false
|
||||
@@ -104,17 +104,17 @@ items-center px-2 w-max"
|
||||
name: $t('filter.inbox.messages'),
|
||||
},
|
||||
]}
|
||||
currentRoute={$page.url.search}
|
||||
currentRoute={page.url.search}
|
||||
isSelected={(url, current, route, def) =>
|
||||
$page.url.search == route ||
|
||||
($page.url.pathname == route && $page.url.search == '') ||
|
||||
$page.url.searchParams.toString().includes(route.slice(1)) ||
|
||||
($page.url.search == '' && route == def)}
|
||||
page.url.search == route ||
|
||||
(page.url.pathname == route && page.url.search == '') ||
|
||||
page.url.searchParams.toString().includes(route.slice(1)) ||
|
||||
(page.url.search == '' && route == def)}
|
||||
class="overflow-auto w-full"
|
||||
buildUrl={(route, href) =>
|
||||
href.includes('?')
|
||||
? '?' + addSearchParam($page.url.searchParams, href).toString()
|
||||
: `${href}${$page.url.search}`}
|
||||
? '?' + addSearchParam(page.url.searchParams, href).toString()
|
||||
: `${href}${page.url.search}`}
|
||||
defaultRoute="?type=All"
|
||||
/>
|
||||
<Tabs
|
||||
@@ -129,10 +129,10 @@ items-center px-2 w-max"
|
||||
},
|
||||
]}
|
||||
isSelected={(url, current, route, def) =>
|
||||
$page.url.searchParams.toString().includes(route.slice(1)) ||
|
||||
($page.url.search == '' && route == def)}
|
||||
page.url.searchParams.toString().includes(route.slice(1)) ||
|
||||
(page.url.search == '' && route == def)}
|
||||
buildUrl={(route, href) =>
|
||||
'?' + addSearchParam($page.url.searchParams, href).toString()}
|
||||
'?' + addSearchParam(page.url.searchParams, href).toString()}
|
||||
defaultRoute="?unreadOnly=true"
|
||||
/>
|
||||
</div>
|
||||
@@ -141,7 +141,7 @@ items-center px-2 w-max"
|
||||
|
||||
<div class="flex items-center gap-2">
|
||||
<Button
|
||||
onclick={() => goto($page.url, { invalidateAll: true })}
|
||||
onclick={() => goto(page.url, { invalidateAll: true })}
|
||||
size="square-lg"
|
||||
rounding="xl"
|
||||
title={$t('common.refresh')}
|
||||
@@ -201,7 +201,7 @@ items-center px-2 w-max"
|
||||
<Pageination
|
||||
hasMore={!(!inbox || (inbox?.length ?? 0) < (data?.limit ?? 0))}
|
||||
page={data.page}
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
on:change={(p) => searchParam(page.url, 'page', p.detail.toString())}
|
||||
/>
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
clearErrorScope,
|
||||
pushError,
|
||||
} from '$lib/components/error/ErrorContainer.svelte'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
|
||||
interface Props {
|
||||
ref?: string
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
async function logIn() {
|
||||
data.loading = true
|
||||
clearErrorScope($page.route.id)
|
||||
clearErrorScope(page.route.id)
|
||||
|
||||
try {
|
||||
data.instance = data.instance.trim()
|
||||
@@ -83,7 +83,7 @@
|
||||
: `_${data.attempts + 1}`),
|
||||
)
|
||||
: errorMessage(error),
|
||||
scope: $page.route.id!,
|
||||
scope: page.route.id!,
|
||||
})
|
||||
data.attempts++
|
||||
}
|
||||
@@ -108,7 +108,7 @@
|
||||
})}
|
||||
</Note>
|
||||
{/if}
|
||||
<ErrorContainer class="pt-2" scope={$page.route.id} />
|
||||
<ErrorContainer class="pt-2" scope={page.route.id} />
|
||||
</div>
|
||||
<div class="flex flex-row w-full items-center gap-2">
|
||||
<TextInput
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { fly } from 'svelte/transition'
|
||||
import Report from './Report.svelte'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import {
|
||||
EnvelopeOpen,
|
||||
Funnel,
|
||||
@@ -33,7 +33,7 @@
|
||||
<div class="flex flex-row gap-2 flex-wrap items-end">
|
||||
<Select
|
||||
bind:value={data.type}
|
||||
on:change={() => searchParam($page.url, 'type', data.type, 'page')}
|
||||
on:change={() => searchParam(page.url, 'type', data.type, 'page')}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
@@ -48,7 +48,7 @@
|
||||
<div class="flex flex-row flex-wrap gap-2">
|
||||
<Select
|
||||
bind:value={data.type}
|
||||
onchange={() => searchParam($page.url, 'type', data.type, 'page')}
|
||||
onchange={() => searchParam(page.url, 'type', data.type, 'page')}
|
||||
class="w-48"
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
@@ -95,10 +95,10 @@
|
||||
showWhenEmpty={true}
|
||||
label="Instance"
|
||||
class="flex-1"
|
||||
q={$page.url.searchParams.get('instance') || ''}
|
||||
q={page.url.searchParams.get('instance') || ''}
|
||||
on:select={(e) =>
|
||||
searchParam(
|
||||
$page.url,
|
||||
page.url,
|
||||
'instance',
|
||||
e.detail?.domain.toString() ?? '',
|
||||
'page',
|
||||
@@ -114,28 +114,28 @@
|
||||
showWhenEmpty={true}
|
||||
label="Community"
|
||||
class="flex-1"
|
||||
q={$page.url.searchParams.get('community') ? 'Selected' : ''}
|
||||
q={page.url.searchParams.get('community') ? 'Selected' : ''}
|
||||
on:select={(e) =>
|
||||
searchParam(
|
||||
$page.url,
|
||||
page.url,
|
||||
'community',
|
||||
e.detail?.id.toString() ?? '',
|
||||
'page',
|
||||
)}
|
||||
/>
|
||||
<UserAutocomplete
|
||||
instance={$page.url.searchParams.get('instance') || undefined}
|
||||
instance={page.url.searchParams.get('instance') || undefined}
|
||||
placeholder="Filter by user"
|
||||
jwt={$profile?.jwt}
|
||||
listing_type="All"
|
||||
showWhenEmpty={true}
|
||||
class="flex-1"
|
||||
label="User"
|
||||
q={$page.url.searchParams.get('user')
|
||||
q={page.url.searchParams.get('user')
|
||||
? (data.filters.user ?? 'Selected')
|
||||
: ''}
|
||||
on:select={(e) =>
|
||||
searchParam($page.url, 'user', e.detail?.id.toString() ?? '', 'page')}
|
||||
searchParam(page.url, 'user', e.detail?.id.toString() ?? '', 'page')}
|
||||
/>
|
||||
{#if $profile?.user && isAdmin($profile?.user)}
|
||||
<UserAutocomplete
|
||||
@@ -145,12 +145,12 @@
|
||||
showWhenEmpty={true}
|
||||
class="flex-1"
|
||||
label="Moderator"
|
||||
q={$page.url.searchParams.get('mod_id')
|
||||
q={page.url.searchParams.get('mod_id')
|
||||
? (data.filters.moderator ?? 'Selected')
|
||||
: ''}
|
||||
on:select={(e) =>
|
||||
searchParam(
|
||||
$page.url,
|
||||
page.url,
|
||||
'mod_id',
|
||||
e.detail?.id.toString() ?? '',
|
||||
'page',
|
||||
@@ -160,7 +160,7 @@
|
||||
<Button
|
||||
onclick={() => {
|
||||
searchParam(
|
||||
$page.url,
|
||||
page.url,
|
||||
'',
|
||||
'',
|
||||
'user',
|
||||
@@ -221,7 +221,7 @@
|
||||
{/if}
|
||||
<Pageination
|
||||
page={data.page}
|
||||
on:change={(e) => searchParam($page.url, 'page', e.detail.toString())}
|
||||
on:change={(e) => searchParam(page.url, 'page', e.detail.toString())}
|
||||
/>
|
||||
{:else}
|
||||
<Placeholder
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { t } from '$lib/translations'
|
||||
import { XMark, Icon } from 'svelte-hero-icons'
|
||||
</script>
|
||||
@@ -13,5 +13,5 @@
|
||||
<h1 class="text-red-800 dark:text-red-300 text-2xl font-semibold">
|
||||
{$t('message.error')}
|
||||
</h1>
|
||||
<code>{$page.error?.message}</code>
|
||||
<code>{page.error?.message}</code>
|
||||
</div>
|
||||
@@ -10,7 +10,7 @@
|
||||
import CommentForm from '$lib/components/lemmy/comment/CommentForm.svelte'
|
||||
import { onMount } from 'svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import PostActions from '$lib/components/lemmy/post/PostActions.svelte'
|
||||
import {
|
||||
ArrowLeft,
|
||||
@@ -134,7 +134,7 @@
|
||||
resumables.add({
|
||||
name: data.post.post_view.post.name,
|
||||
type: 'post',
|
||||
url: $page.url.toString(),
|
||||
url: page.url.toString(),
|
||||
avatar: data.post.post_view.post.thumbnail_url,
|
||||
})
|
||||
})
|
||||
@@ -188,7 +188,7 @@
|
||||
let commenting = $state(false)
|
||||
|
||||
let remoteView = $derived(
|
||||
$page.params.instance?.toLowerCase() != $instance.toLowerCase(),
|
||||
page.params.instance?.toLowerCase() != $instance.toLowerCase(),
|
||||
)
|
||||
|
||||
function createCommentsState(tree: CommentNodeI[]) {
|
||||
@@ -201,7 +201,7 @@
|
||||
<title>{data.post.post_view.post.name}</title>
|
||||
<meta property="og:title" content={data.post.post_view.post.name} />
|
||||
<meta property="twitter:title" content={data.post.post_view.post.name} />
|
||||
<meta property="og:url" content={$page.url.toString()} />
|
||||
<meta property="og:url" content={page.url.toString()} />
|
||||
{#if isImage(data.post.post_view.post.url)}
|
||||
<meta property="og:image" content={data.post.post_view.post.url} />
|
||||
<meta property="twitter:card" content={data.post.post_view.post.url} />
|
||||
@@ -368,7 +368,7 @@
|
||||
{loading}
|
||||
disabled={loading}
|
||||
href={data.thread.showContext
|
||||
? `/comment/${$page.params.instance}/${data.thread.showContext}`
|
||||
? `/comment/${page.params.instance}/${data.thread.showContext}`
|
||||
: undefined}
|
||||
class="hover:bg-white/50 dark:hover:bg-zinc-800/30"
|
||||
onclick={data.thread.singleThread ? reloadComments : undefined}
|
||||
@@ -458,7 +458,7 @@
|
||||
.map((c) => c.community.id)
|
||||
.includes(data.post.community_view.community.id)
|
||||
)) ||
|
||||
$page.params.instance.toLowerCase() != $instance.toLowerCase()}
|
||||
page.params.instance.toLowerCase() != $instance.toLowerCase()}
|
||||
banned={data.post.community_view.banned_from_community}
|
||||
on:focus={() => (commenting = true)}
|
||||
tools={commenting}
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
/**
|
||||
* @typedef {Object} Props
|
||||
* @property {import('svelte').Snippet} [children]
|
||||
*/
|
||||
|
||||
/** @type {Props} */
|
||||
let { children } = $props();
|
||||
let { children } = $props()
|
||||
|
||||
const routes = [
|
||||
{
|
||||
@@ -38,7 +38,7 @@
|
||||
</script>
|
||||
|
||||
<Header pageHeader>
|
||||
{routes.find((r) => $page.url.pathname == r.url)?.name}
|
||||
{routes.find((r) => page.url.pathname == r.url)?.name}
|
||||
</Header>
|
||||
<div class="flex flex-row gap-12">
|
||||
<nav class="flex flex-col gap-2 flex-1 max-sm:hidden">
|
||||
@@ -46,7 +46,7 @@
|
||||
<SidebarButton
|
||||
size="lg"
|
||||
rounding="lg"
|
||||
selected={$page.url.pathname == route.url}
|
||||
selected={page.url.pathname == route.url}
|
||||
href={route.url}
|
||||
>
|
||||
{route.name}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import { client } from '$lib/lemmy.js'
|
||||
import { t } from '$lib/translations.js'
|
||||
@@ -31,7 +31,7 @@
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
goto($page.url, { invalidateAll: true })
|
||||
goto(page.url, { invalidateAll: true })
|
||||
} else {
|
||||
const res = await client().generateTotpSecret()
|
||||
totpLink = res.totp_secret_url
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script>
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/** @type {Props} */
|
||||
let { children } = $props();
|
||||
let { children } = $props()
|
||||
</script>
|
||||
|
||||
<svelte:head>
|
||||
@@ -65,9 +65,8 @@
|
||||
{#if feature('mediaAndVotes', $site?.version)}
|
||||
<Menu class="flex-1" placement="bottom-end">
|
||||
{#snippet target()}
|
||||
<Button
|
||||
<Button
|
||||
title={$t('post.actions.more.label')}
|
||||
|
||||
size="square-lg"
|
||||
rounding="pill"
|
||||
color="none"
|
||||
@@ -78,23 +77,23 @@
|
||||
>
|
||||
<Icon src={EllipsisHorizontal} size="16" mini />
|
||||
</Button>
|
||||
{/snippet}
|
||||
{/snippet}
|
||||
<MenuButton href="/profile/media">
|
||||
{#snippet prefix()}
|
||||
<Icon src={Photo} size="16" mini />
|
||||
{/snippet}
|
||||
<Icon src={Photo} size="16" mini />
|
||||
{/snippet}
|
||||
{$t('routes.profile.media.title')}
|
||||
</MenuButton>
|
||||
<MenuButton href="/profile/voted/up">
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowUp} size="16" micro />
|
||||
{/snippet}
|
||||
<Icon src={ArrowUp} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('routes.profile.upvoted')}
|
||||
</MenuButton>
|
||||
<MenuButton href="/profile/voted/down">
|
||||
{#snippet prefix()}
|
||||
<Icon src={ArrowDown} size="16" micro />
|
||||
{/snippet}
|
||||
<Icon src={ArrowDown} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('routes.profile.downvoted')}
|
||||
</MenuButton>
|
||||
</Menu>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
@@ -33,9 +33,9 @@
|
||||
</div>
|
||||
{#if data.images.length == 20}
|
||||
<Pageination
|
||||
page={Number($page.url.searchParams.get('page')) || 1}
|
||||
page={Number(page.url.searchParams.get('page')) || 1}
|
||||
on:change={(p) => {
|
||||
searchParam($page.url, 'page', p.detail.toString())
|
||||
searchParam(page.url, 'page', p.detail.toString())
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { settings } from '$lib/settings.svelte.js'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { searchParam } from '$lib/util.svelte.js'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import { Bookmark } from 'svelte-hero-icons'
|
||||
import { t } from '$lib/translations.js'
|
||||
@@ -44,7 +44,7 @@
|
||||
<div class="flex items-center">
|
||||
<Select
|
||||
bind:value={type}
|
||||
onchange={() => searchParam($page.url, 'type', type, 'page')}
|
||||
onchange={() => searchParam(page.url, 'type', type, 'page')}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
<div class="flex items-center gap-0.5">
|
||||
@@ -94,7 +94,7 @@
|
||||
>
|
||||
<Tabs routes={[]} class="mx-auto">
|
||||
<Pageination
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
on:change={(p) => searchParam(page.url, 'page', p.detail.toString())}
|
||||
page={data.page}
|
||||
/>
|
||||
</Tabs>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { navigating, page } from '$app/stores'
|
||||
import { navigating, page } from '$app/state'
|
||||
import { profile } from '$lib/auth.svelte.js'
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
import Sort from '$lib/components/lemmy/dropdowns/Sort.svelte'
|
||||
@@ -48,6 +48,7 @@
|
||||
|
||||
let query = $state(data.query || '')
|
||||
let searchElement: HTMLInputElement | undefined = $state()
|
||||
let form = $state<HTMLFormElement>()
|
||||
|
||||
let pageNum = $state(data.page)
|
||||
|
||||
@@ -71,64 +72,65 @@
|
||||
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">
|
||||
<form
|
||||
method="get"
|
||||
action="/search"
|
||||
class="flex gap-2 flex-row items-center w-full text-base h-10"
|
||||
>
|
||||
<TextInput
|
||||
bind:value={query}
|
||||
bind:element={searchElement}
|
||||
name="q"
|
||||
aria-label={$t('routes.search.query')}
|
||||
size="lg"
|
||||
class="flex-1 !rounded-full h-full !text-base"
|
||||
<form method="get" action="/search" class="" bind:this={form}>
|
||||
<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">
|
||||
<TextInput
|
||||
bind:value={query}
|
||||
bind:element={searchElement}
|
||||
name="q"
|
||||
aria-label={$t('routes.search.query')}
|
||||
size="lg"
|
||||
class="flex-1 !rounded-full h-full !text-base"
|
||||
/>
|
||||
<Button
|
||||
submit
|
||||
color="primary"
|
||||
size="custom"
|
||||
class="flex-shrink-0 h-full aspect-square"
|
||||
title="Search"
|
||||
rounding="pill"
|
||||
loading={navigating.to != null}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
</Button>
|
||||
</div>
|
||||
</Tabs>
|
||||
<div class="flex flex-row flex-wrap items-center gap-4 mt-4">
|
||||
<Select
|
||||
name="type"
|
||||
bind:value={data.type}
|
||||
onchange={() => form?.requestSubmit()}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={AdjustmentsHorizontal} mini size="15" />
|
||||
{$t('filter.type')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Option value="All">{$t('content.all')}</Option>
|
||||
<Option value="Posts">{$t('content.posts')}</Option>
|
||||
<Option value="Comments">{$t('content.comments')}</Option>
|
||||
<Option value="Communities">{$t('content.communities')}</Option>
|
||||
<Option value="Users">{$t('content.users')}</Option>
|
||||
</Select>
|
||||
<Sort
|
||||
name="sort"
|
||||
bind:selected={data.sort}
|
||||
onchange={() => form?.requestSubmit()}
|
||||
/>
|
||||
<Button
|
||||
submit
|
||||
color="primary"
|
||||
size="custom"
|
||||
class="flex-shrink-0 h-full aspect-square"
|
||||
title="Search"
|
||||
rounding="pill"
|
||||
loading={$navigating != null}
|
||||
size="square-lg"
|
||||
color="tertiary"
|
||||
class="self-end justify-self-center"
|
||||
onclick={() => (moreOptions = !moreOptions)}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={MagnifyingGlass} size="16" micro />
|
||||
{/snippet}
|
||||
<Icon src={ChevronDown} size="20" mini />
|
||||
</Button>
|
||||
</form>
|
||||
</Tabs>
|
||||
</div>
|
||||
<div class="flex flex-row flex-wrap items-center gap-4 mt-4">
|
||||
<Select
|
||||
bind:value={data.type}
|
||||
on:change={() => searchParam($page.url, 'type', data.type ?? 'All', 'page')}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={AdjustmentsHorizontal} mini size="15" />
|
||||
{$t('filter.type')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Option value="All">{$t('content.all')}</Option>
|
||||
<Option value="Posts">{$t('content.posts')}</Option>
|
||||
<Option value="Comments">{$t('content.comments')}</Option>
|
||||
<Option value="Communities">{$t('content.communities')}</Option>
|
||||
<Option value="Users">{$t('content.users')}</Option>
|
||||
</Select>
|
||||
<Sort navigate bind:selected={data.sort} />
|
||||
{#snippet summary()}
|
||||
<Button
|
||||
size="square-lg"
|
||||
color="tertiary"
|
||||
class="self-end justify-self-center"
|
||||
onclick={() => (moreOptions = !moreOptions)}
|
||||
>
|
||||
<Icon src={ChevronDown} size="20" mini />
|
||||
</Button>
|
||||
{/snippet}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{#if moreOptions}
|
||||
<div transition:slide={{ axis: 'y', easing: expoOut }} class="max-w-sm">
|
||||
@@ -138,7 +140,7 @@
|
||||
listing_type={'All'}
|
||||
showWhenEmpty={true}
|
||||
on:select={(c) =>
|
||||
searchParam($page.url, 'community', c.detail?.id || undefined, 'page')}
|
||||
searchParam(page.url, 'community', c.detail?.id || undefined, 'page')}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -215,7 +217,7 @@
|
||||
{#if data.results.length > 0}
|
||||
<Pageination
|
||||
bind:page={pageNum}
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
on:change={(p) => searchParam(page.url, 'page', p.detail.toString())}
|
||||
/>
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -2,7 +2,7 @@
|
||||
import { run, preventDefault } from 'svelte/legacy'
|
||||
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { setUser } from '$lib/auth.svelte.js'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
@@ -27,7 +27,7 @@
|
||||
|
||||
let { data } = $props()
|
||||
|
||||
const instance = $page.params.instance
|
||||
const instance = page.params.instance
|
||||
|
||||
let captchaRequired = data.site_view.local_site.captcha_enabled
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
})
|
||||
|
||||
if (res?.jwt) {
|
||||
await setUser(res.jwt, $page.params.instance, username)
|
||||
await setUser(res.jwt, page.params.instance, username)
|
||||
|
||||
toast({ content: $t('toast.logIn'), type: 'success' })
|
||||
goto('/')
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { goto } from '$app/navigation'
|
||||
import { isCommentView } from '$lib/lemmy/item.js'
|
||||
import { client, getClient } from '$lib/lemmy.js'
|
||||
@@ -72,7 +72,7 @@
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
goto($page.url, {
|
||||
goto(page.url, {
|
||||
invalidateAll: true,
|
||||
})
|
||||
} catch (err) {
|
||||
@@ -296,7 +296,7 @@
|
||||
<div class="flex flex-row gap-4 flex-wrap">
|
||||
<Select
|
||||
bind:value={data.type}
|
||||
onchange={() => searchParam($page.url, 'type', data.type, 'page')}
|
||||
onchange={() => searchParam(page.url, 'type', data.type, 'page')}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
@@ -310,7 +310,7 @@
|
||||
</Select>
|
||||
<Select
|
||||
bind:value={data.sort}
|
||||
onchange={() => searchParam($page.url, 'sort', data.sort, 'page')}
|
||||
onchange={() => searchParam(page.url, 'sort', data.sort, 'page')}
|
||||
>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
@@ -344,7 +344,7 @@
|
||||
{/if}
|
||||
<Pageination
|
||||
page={data.page}
|
||||
on:change={(p) => searchParam($page.url, 'page', p.detail.toString())}
|
||||
on:change={(p) => searchParam(page.url, 'page', p.detail.toString())}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,14 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import MultiSelect from '$lib/components/input/Switch.svelte'
|
||||
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||
import { contentPadding } from '$lib/components/ui/layout/Shell.svelte'
|
||||
interface Props {
|
||||
children?: import('svelte').Snippet;
|
||||
children?: import('svelte').Snippet
|
||||
}
|
||||
|
||||
let { children }: Props = $props();
|
||||
let { children }: Props = $props()
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col gap-2">
|
||||
@@ -44,7 +44,7 @@
|
||||
},
|
||||
]}
|
||||
class="overflow-auto"
|
||||
currentRoute={$page.url.toString()}
|
||||
currentRoute={page.url.toString()}
|
||||
/>
|
||||
</div>
|
||||
{@render children?.()}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { page } from '$app/stores'
|
||||
import { page } from '$app/state'
|
||||
import { t } from '$lib/translations'
|
||||
import { XMark, Icon } from 'svelte-hero-icons'
|
||||
</script>
|
||||
@@ -14,5 +14,5 @@
|
||||
{$t('message.error')}
|
||||
</h1>
|
||||
<p class="text-red-800 dark:text-red-300">{$t('routes.verifyEmail.error')}</p>
|
||||
<code>{$page.error?.message}</code>
|
||||
<code>{page.error?.message}</code>
|
||||
</div>
|
||||
Reference in new issue
Block a user