feat: add community search to search page
This commit is contained in:
1 parent
819fde66ab
commit
e946d0de48
44 files changed
+79
-218
No files matched your search
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { toast as showToast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast as showToast } from 'mono-svelte'
|
||||
import { useRegisterSW } from 'virtual:pwa-register/svelte'
|
||||
const { needRefresh, updateServiceWorker, offlineReady } = useRegisterSW({
|
||||
onRegistered(r) {
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { amModOfAny } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { DEFAULT_INSTANCE_URL, instance } from '$lib/instance.js'
|
||||
import { getClient, site } from '$lib/lemmy.js'
|
||||
import { getInbox, getInboxItemPublished } from '$lib/lemmy/inbox.js'
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
<div class="flex flex-row gap-4 flex-wrap">
|
||||
{#if selected?.startsWith('Top')}
|
||||
<div class="w-32" transition:fly={{ x: 4 }}>
|
||||
<div transition:fly={{ x: 4 }}>
|
||||
<Select
|
||||
bind:value={selected}
|
||||
on:change={(e) => {
|
||||
@@ -45,7 +45,6 @@
|
||||
setSelected()
|
||||
if (navigate) searchParam($page.url, 'sort', selected, 'page')
|
||||
}}
|
||||
class="w-32"
|
||||
>
|
||||
<span slot="label" class="flex items-center gap-1">
|
||||
<Icon src={ChartBar} size="14" mini />
|
||||
@@ -56,5 +55,7 @@
|
||||
<option value="TopAll">Top</option>
|
||||
<option value="New">New</option>
|
||||
<option value="Old">Old</option>
|
||||
<option value="MostComments">Most Comments</option>
|
||||
<option value="NewComments">New Comments</option>
|
||||
</Select>
|
||||
</div>
|
||||
@@ -15,7 +15,7 @@
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import CommentActions from '$lib/components/lemmy/comment/CommentActions.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { Button, Modal } from 'mono-svelte'
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
Trash,
|
||||
} from 'svelte-hero-icons'
|
||||
import { getClient, getInstance } from '$lib/lemmy.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import Menu from '$lib/components/ui/menu/Menu.svelte'
|
||||
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { placeholders } from '$lib/util.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { CommentView, Post } from 'lemmy-js-client'
|
||||
import { fly } from 'svelte/transition'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import StickyCard from '$lib/components/ui/StickyCard.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
|
||||
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import { profile } from '$lib/auth.js'
|
||||
import FileInput from '$lib/components/input/FileInput.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { getClient, uploadImage } from '$lib/lemmy.js'
|
||||
import { addSubscription } from '$lib/lemmy/user.js'
|
||||
import { Button, Checkbox, TextInput } from 'mono-svelte'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.js'
|
||||
import FileInput from '$lib/components/input/FileInput.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { uploadImage } from '$lib/lemmy.js'
|
||||
import { Button, Modal } from 'mono-svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||
import type { Community, Person, PersonView } from 'lemmy-js-client'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { Button, Checkbox, Modal, TextInput } from 'mono-svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import { Color } from '$lib/ui/colors.js'
|
||||
import { isCommentView, isPostView } from '$lib/lemmy/item.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { isCommentView, isPostView } from '$lib/lemmy/item.js'
|
||||
import type { CommentView, PostView } from 'lemmy-js-client'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { CommentView, PostView } from 'lemmy-js-client'
|
||||
import { profile } from '$lib/auth.js'
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import PostLink from '$lib/components/lemmy/post/PostLink.svelte'
|
||||
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import Spinner from '$lib/components/ui/loader/Spinner.svelte'
|
||||
|
||||
@@ -95,7 +95,9 @@
|
||||
{:else if post.post.url}
|
||||
<PostLink
|
||||
url={post.post.url}
|
||||
thumbnail_url={post.post.thumbnail_url ? `${post.post.thumbnail_url}?format=webp&thumbnail=512` : undefined}
|
||||
thumbnail_url={post.post.thumbnail_url
|
||||
? `${post.post.thumbnail_url}?format=webp&thumbnail=512`
|
||||
: undefined}
|
||||
nsfw={post.post.nsfw}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { createEventDispatcher, onDestroy, onMount } from 'svelte'
|
||||
import { getClient, uploadImage } from '$lib/lemmy.js'
|
||||
import type { Community, Post, PostView } from 'lemmy-js-client'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { Check, Icon, Photo } from 'svelte-hero-icons'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
</Button>
|
||||
</div>
|
||||
{:else}
|
||||
<Popover targetClass="h-8" openOnHover>
|
||||
<Popover targetClass="h-8 z-30" openOnHover>
|
||||
<div
|
||||
class="flex items-center text-sm gap-1 rounded-md border border-slate-200
|
||||
dark:border-zinc-700 px-1 h-8 duration-200 dark:bg-zinc-900"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import FileInput from '$lib/components/input/FileInput.svelte'
|
||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { uploadImage } from '$lib/lemmy.js'
|
||||
import { Button, Label, Modal, TextArea } from 'mono-svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<div
|
||||
class="overflow-visible {absolute
|
||||
? 'absolute'
|
||||
: 'relative'} cursor-auto {clazz} {itemsClass}"
|
||||
: 'relative'} cursor-auto h-max {clazz} {itemsClass}"
|
||||
bind:this={element}
|
||||
tabindex="-1"
|
||||
>
|
||||
@@ -70,7 +70,7 @@
|
||||
{$$props.containerClass}"
|
||||
>
|
||||
{#if open}
|
||||
<div on:click={toggleOpen} class="flex flex-col gap-0">
|
||||
<div on:click={toggleOpen} class="flex flex-col gap-0 h-max">
|
||||
<slot {toggleOpen} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
<script lang="ts">
|
||||
import Spinner from '$lib/components/ui/loader/Spinner.svelte'
|
||||
import {
|
||||
type Toast,
|
||||
toasts,
|
||||
toastColors,
|
||||
} from '$lib/components/ui/toasts/toasts'
|
||||
import {
|
||||
InformationCircle,
|
||||
ExclamationTriangle,
|
||||
ExclamationCircle,
|
||||
CheckCircle,
|
||||
Icon,
|
||||
XMark,
|
||||
Check,
|
||||
} from 'svelte-hero-icons'
|
||||
import { fly } from 'svelte/transition'
|
||||
|
||||
export let toast: Toast
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="{toastColors[
|
||||
toast.type
|
||||
]} relative w-80 rounded-md overflow-hidden flex flex-row items-center"
|
||||
transition:fly={{
|
||||
duration: 300,
|
||||
y: 8,
|
||||
opacity: 0,
|
||||
}}
|
||||
>
|
||||
{#if toast.loading}
|
||||
<div class="relative m-2 ml-4 flex-shrink-0">
|
||||
<Spinner width={20} />
|
||||
</div>
|
||||
{:else}
|
||||
<Icon
|
||||
size="20"
|
||||
mini
|
||||
class="relative m-2 ml-4 flex-shrink-0"
|
||||
src={toast.type == 'info'
|
||||
? InformationCircle
|
||||
: toast.type == 'success'
|
||||
? CheckCircle
|
||||
: toast.type == 'warning'
|
||||
? ExclamationTriangle
|
||||
: toast.type == 'error'
|
||||
? ExclamationCircle
|
||||
: ExclamationCircle}
|
||||
/>
|
||||
{/if}
|
||||
<div class="flex flex-col p-4 pl-0 break-words max-w-full">
|
||||
{#if toast.title}
|
||||
<h1 class="text-base font-bold">{toast.title}</h1>
|
||||
{/if}
|
||||
<p class="text-sm">{toast.content}</p>
|
||||
</div>
|
||||
<div class="ml-auto flex items-center gap-2 m-2">
|
||||
{#if toast.action}
|
||||
<button
|
||||
on:click={() => {
|
||||
toast.action?.()
|
||||
toasts.update((toasts) => toasts.filter((t) => t.id != toast.id))
|
||||
}}
|
||||
class="rounded-lg w-max transition-colors hover:bg-black/20 hover:dark:bg-white/20 p-2"
|
||||
>
|
||||
<Icon src={Check} size="16" mini />
|
||||
</button>
|
||||
{/if}
|
||||
<button
|
||||
on:click={() => {
|
||||
toasts.update((toasts) => toasts.filter((t) => t.id != toast.id))
|
||||
}}
|
||||
class="rounded-lg w-max transition-colors hover:bg-black/20 hover:dark:bg-white/20 p-2"
|
||||
>
|
||||
<Icon src={XMark} size="16" mini />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,21 +0,0 @@
|
||||
<script lang="ts">
|
||||
import Toast from '$lib/components/ui/toasts/Toast.svelte'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { toasts } from '$lib/components/ui/toasts/toasts'
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="fixed right-0 bottom-0 flex flex-col items-end justify-end z-[200] p-4
|
||||
group
|
||||
overflow-hidden h-screen min-w-[24rem] pointer-events-none"
|
||||
>
|
||||
{#each $toasts as toast, index (toast.id)}
|
||||
<div
|
||||
animate:flip={{ duration: 300 }}
|
||||
class="pointer-events-auto -mt-8 transition-all group-hover:pt-12
|
||||
duration-300"
|
||||
>
|
||||
<Toast {toast} />
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -1,64 +0,0 @@
|
||||
import { writable } from 'svelte/store'
|
||||
|
||||
type ToastType = keyof typeof toastColors
|
||||
|
||||
export const toastColors = {
|
||||
error: 'bg-red-600 text-white border border-red-700',
|
||||
warning: 'bg-yellow-400 text-black border border-yellow-500',
|
||||
success: 'bg-green-400 text-black border border-green-500',
|
||||
info: 'dark:bg-zinc-900 bg-white border border-slate-200 dark:border-zinc-800 shadow-lg',
|
||||
}
|
||||
|
||||
export interface Toast {
|
||||
id: number
|
||||
title?: string
|
||||
content: string
|
||||
type: ToastType
|
||||
loading?: boolean
|
||||
action?: () => any
|
||||
}
|
||||
|
||||
export const toasts = writable<Toast[]>([])
|
||||
|
||||
export function toast({
|
||||
title,
|
||||
content,
|
||||
type = 'info',
|
||||
duration = 5000,
|
||||
loading = false,
|
||||
action,
|
||||
}: {
|
||||
title?: string
|
||||
content: string
|
||||
type?: ToastType
|
||||
duration?: number
|
||||
loading?: boolean
|
||||
action?: () => any
|
||||
}) {
|
||||
let id = 0
|
||||
|
||||
toasts.update((toasts) => {
|
||||
id = Math.floor(Math.random() * 10000)
|
||||
|
||||
return [
|
||||
...toasts,
|
||||
{
|
||||
id: id,
|
||||
content: content,
|
||||
title: title,
|
||||
type: type,
|
||||
loading: loading,
|
||||
action: action,
|
||||
},
|
||||
]
|
||||
})
|
||||
|
||||
setTimeout(() => {
|
||||
toasts.update((toasts) => toasts.filter((toast) => toast.id != id))
|
||||
}, duration)
|
||||
|
||||
return id
|
||||
}
|
||||
|
||||
export const removeToast = (id: number) =>
|
||||
toasts.update((toasts) => toasts.filter((toast) => toast.id != id))
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import { goto } from '$app/navigation'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { get } from 'svelte/store'
|
||||
|
||||
|
||||
@@ -4,15 +4,13 @@
|
||||
import { navigating } from '$app/stores'
|
||||
import nProgress from 'nprogress'
|
||||
import 'nprogress/nprogress.css'
|
||||
import ToastContainer from '$lib/components/ui/toasts/ToastContainer.svelte'
|
||||
import Moderation from '$lib/components/lemmy/moderation/Moderation.svelte'
|
||||
import Sidebar from '$lib/components/ui/sidebar/Sidebar.svelte'
|
||||
import { onMount } from 'svelte'
|
||||
// @ts-ignore
|
||||
import { pwaInfo } from 'virtual:pwa-info'
|
||||
import PwaReload from '$lib/PwaReload.svelte'
|
||||
import { inDarkTheme } from '$lib/ui/colors.js'
|
||||
import { userSettings } from '$lib/settings.js'
|
||||
import { ToastContainer } from 'mono-svelte'
|
||||
|
||||
nProgress.configure({
|
||||
minimum: 0.4,
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
||||
import Menu from '$lib/components/ui/menu/Menu.svelte'
|
||||
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import DebugObject from '$lib/components/util/debug/DebugObject.svelte'
|
||||
import {
|
||||
DEFAULT_INSTANCE_URL,
|
||||
@@ -173,7 +173,12 @@
|
||||
</div>
|
||||
<div class="ml-auto" />
|
||||
<Menu alignment="bottom-right">
|
||||
<Button let:toggleOpen on:click={toggleOpen} size="square-md" slot="button">
|
||||
<Button
|
||||
let:toggleOpen
|
||||
on:click={toggleOpen}
|
||||
size="square-md"
|
||||
slot="button"
|
||||
>
|
||||
<Icon src={EllipsisHorizontal} mini size="16" slot="prefix" />
|
||||
</Button>
|
||||
<MenuButton on:click={() => moveProfile(profile.id, true)}>
|
||||
@@ -246,12 +251,15 @@
|
||||
label="Guest instance"
|
||||
bind:value={newInstance}
|
||||
disabled={LINKED_INSTANCE_URL != undefined}
|
||||
/>
|
||||
size="sm"
|
||||
>
|
||||
<span slot="prefix">https://</span>
|
||||
</TextInput>
|
||||
<Button
|
||||
color="primary"
|
||||
{loading}
|
||||
disabled={loading || LINKED_INSTANCE_URL != undefined}
|
||||
class="h-[42px] self-end"
|
||||
class="self-end"
|
||||
>
|
||||
Change
|
||||
</Button>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { RegistrationApplicationView } from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { profile } from '$lib/auth.js'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { EditSite } from 'lemmy-js-client'
|
||||
import type { PageData } from './$types.js'
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { Tagline } from 'lemmy-js-client'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { instance } from '$lib/instance.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { addAdmin } from '$lib/lemmy/user.js'
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
import { Icon, Plus, Trash } from 'svelte-hero-icons'
|
||||
import type { PageData } from './$types.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { flip } from 'svelte/animate'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { CommunityView } from 'lemmy-js-client'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
|
||||
export let community: CommunityView
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
} from 'lemmy-js-client'
|
||||
import { ChatBubbleOvalLeft, Check, Icon } from 'svelte-hero-icons'
|
||||
import { page } from '$app/stores'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import { Button } from 'mono-svelte'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { goto } from '$app/navigation'
|
||||
import { setUser } from '$lib/auth.js'
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { DEFAULT_INSTANCE_URL, LINKED_INSTANCE_URL } from '$lib/instance.js'
|
||||
import { getClient, validateInstance } from '$lib/lemmy.js'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { isCommentReport, isPostReport } from '$lib/lemmy/item.js'
|
||||
import type {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import PostLink from '$lib/components/lemmy/post/PostLink.svelte'
|
||||
import PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
|
||||
import { removeToast, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { removeToast, toast } from 'mono-svelte'
|
||||
import type { CommentSortType } from 'lemmy-js-client'
|
||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import FileInput from '$lib/components/input/FileInput.svelte'
|
||||
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import { removeToast, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { removeToast, toast } from 'mono-svelte'
|
||||
import { getClient, uploadImage } from '$lib/lemmy.js'
|
||||
import type { SaveUserSettings } from 'lemmy-js-client'
|
||||
import { Button, Checkbox, Modal, TextInput } from 'mono-svelte'
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/stores'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import ObjectAutocomplete from '$lib/components/lemmy/ObjectAutocomplete.svelte'
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
@@ -29,7 +31,7 @@
|
||||
|
||||
export let data
|
||||
|
||||
let query = ''
|
||||
let query = data.query || ''
|
||||
|
||||
let pageNum = data.page
|
||||
</script>
|
||||
@@ -50,7 +52,7 @@
|
||||
Type
|
||||
</span>
|
||||
<option value="All">All</option>
|
||||
<option value="Local">Posts</option>
|
||||
<option value="Posts">Posts</option>
|
||||
<option value="Comments">Comments</option>
|
||||
<option value="Communities">Communities</option>
|
||||
<option value="Users">Users</option>
|
||||
@@ -70,6 +72,16 @@
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="max-w-sm mt-2">
|
||||
<ObjectAutocomplete
|
||||
label="Community"
|
||||
jwt={$profile?.jwt}
|
||||
listing_type={'All'}
|
||||
showWhenEmpty={true}
|
||||
on:select={(c) =>
|
||||
searchParam($page.url, 'community', c.detail?.id || undefined, 'page')}
|
||||
/>
|
||||
</div>
|
||||
{#if !data.results}
|
||||
<Placeholder
|
||||
icon={MagnifyingGlass}
|
||||
|
||||
@@ -15,7 +15,7 @@ import { get } from 'svelte/store'
|
||||
export async function load({ url, fetch }) {
|
||||
const query = url.searchParams.get('q')
|
||||
const page = Number(url.searchParams.get('page')) || 1
|
||||
const community = url.searchParams.get('community_name')
|
||||
const community = Number(url.searchParams.get('community')) || undefined
|
||||
const sort = url.searchParams.get('sort') || 'New'
|
||||
const type = url.searchParams.get('type') || 'All'
|
||||
|
||||
@@ -23,7 +23,7 @@ export async function load({ url, fetch }) {
|
||||
const results = await getClient(undefined, fetch).search({
|
||||
q: query,
|
||||
auth: get(profile)?.jwt,
|
||||
community_name: community ?? undefined,
|
||||
community_id: community ?? undefined,
|
||||
limit: 40,
|
||||
page: page,
|
||||
sort: (sort as SortType) || 'New',
|
||||
@@ -47,6 +47,7 @@ export async function load({ url, fetch }) {
|
||||
type: type,
|
||||
sort: sort,
|
||||
page: page,
|
||||
query: query,
|
||||
results: everything,
|
||||
streamed: {
|
||||
object: get(profile)?.jwt
|
||||
@@ -61,5 +62,8 @@ export async function load({ url, fetch }) {
|
||||
|
||||
return {
|
||||
page: 1,
|
||||
sort: sort,
|
||||
type: type,
|
||||
query: query,
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
import Setting from './Setting.svelte'
|
||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
||||
import Sort from '$lib/components/lemmy/Sort.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import Link from '$lib/components/input/Link.svelte'
|
||||
import {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { DEFAULT_INSTANCE_URL } from '$lib/instance.js'
|
||||
import { validateInstance } from '$lib/lemmy.js'
|
||||
import { Button, TextInput } from 'mono-svelte'
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import Placeholder from '$lib/components/ui/Placeholder.svelte'
|
||||
import Spinner from '$lib/components/ui/loader/Spinner.svelte'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { GetCaptchaResponse } from 'lemmy-js-client'
|
||||
import { Button, TextArea, TextInput } from 'mono-svelte'
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
import { isCommentView } from '$lib/lemmy/item.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { isBlocked } from '$lib/lemmy/user.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from 'mono-svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||
|
||||
Reference in new issue
Block a user