feat: add community search to search page

This commit is contained in:
Xyphyn committed 2023-09-04 10:49:31 -07:00
1 parent 819fde66ab
commit e946d0de48
44 files changed
+79 -218

No files matched your search

+1 -1
View File
@@ -42,7 +42,7 @@
"@dicebear/initials": "^6.0.4", "@dicebear/initials": "^6.0.4",
"lemmy-js-client": "^0.18.0-rc.2", "lemmy-js-client": "^0.18.0-rc.2",
"markdown-it": "^13.0.1", "markdown-it": "^13.0.1",
"mono-svelte": "^0.2.2" "mono-svelte": "^0.2.8"
}, },
"type": "module" "type": "module"
} }
+1 -1
View File
@@ -1,5 +1,5 @@
<script lang="ts"> <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' import { useRegisterSW } from 'virtual:pwa-register/svelte'
const { needRefresh, updateServiceWorker, offlineReady } = useRegisterSW({ const { needRefresh, updateServiceWorker, offlineReady } = useRegisterSW({
onRegistered(r) { onRegistered(r) {
+1 -1
View File
@@ -1,5 +1,5 @@
import { amModOfAny } from '$lib/components/lemmy/moderation/moderation.js' 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 { DEFAULT_INSTANCE_URL, instance } from '$lib/instance.js'
import { getClient, site } from '$lib/lemmy.js' import { getClient, site } from '$lib/lemmy.js'
import { getInbox, getInboxItemPublished } from '$lib/lemmy/inbox.js' import { getInbox, getInboxItemPublished } from '$lib/lemmy/inbox.js'
+3 -2
View File
@@ -14,7 +14,7 @@
<div class="flex flex-row gap-4 flex-wrap"> <div class="flex flex-row gap-4 flex-wrap">
{#if selected?.startsWith('Top')} {#if selected?.startsWith('Top')}
<div class="w-32" transition:fly={{ x: 4 }}> <div transition:fly={{ x: 4 }}>
<Select <Select
bind:value={selected} bind:value={selected}
on:change={(e) => { on:change={(e) => {
@@ -45,7 +45,6 @@
setSelected() setSelected()
if (navigate) searchParam($page.url, 'sort', selected, 'page') if (navigate) searchParam($page.url, 'sort', selected, 'page')
}} }}
class="w-32"
> >
<span slot="label" class="flex items-center gap-1"> <span slot="label" class="flex items-center gap-1">
<Icon src={ChartBar} size="14" mini /> <Icon src={ChartBar} size="14" mini />
@@ -56,5 +55,7 @@
<option value="TopAll">Top</option> <option value="TopAll">Top</option>
<option value="New">New</option> <option value="New">New</option>
<option value="Old">Old</option> <option value="Old">Old</option>
<option value="MostComments">Most Comments</option>
<option value="NewComments">New Comments</option>
</Select> </Select>
</div> </div>
@@ -15,7 +15,7 @@
import Markdown from '$lib/components/markdown/Markdown.svelte' import Markdown from '$lib/components/markdown/Markdown.svelte'
import CommentActions from '$lib/components/lemmy/comment/CommentActions.svelte' import CommentActions from '$lib/components/lemmy/comment/CommentActions.svelte'
import { getClient } from '$lib/lemmy.js' 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 { profile } from '$lib/auth.js'
import { Button, Modal } from 'mono-svelte' import { Button, Modal } from 'mono-svelte'
@@ -18,7 +18,7 @@
Trash, Trash,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
import { getClient, getInstance } from '$lib/lemmy.js' 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 Menu from '$lib/components/ui/menu/Menu.svelte'
import MenuButton from '$lib/components/ui/menu/MenuButton.svelte' import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
@@ -5,7 +5,7 @@
import MultiSelect from '$lib/components/input/MultiSelect.svelte' import MultiSelect from '$lib/components/input/MultiSelect.svelte'
import Markdown from '$lib/components/markdown/Markdown.svelte' import Markdown from '$lib/components/markdown/Markdown.svelte'
import { profile } from '$lib/auth.js' 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 MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import { placeholders } from '$lib/util.js' import { placeholders } from '$lib/util.js'
import { Button } from 'mono-svelte' import { Button } from 'mono-svelte'
@@ -7,7 +7,7 @@
import { getClient } from '$lib/lemmy.js' import { getClient } from '$lib/lemmy.js'
import type { CommentView, Post } from 'lemmy-js-client' import type { CommentView, Post } from 'lemmy-js-client'
import { fly } from 'svelte/transition' 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 { profile } from '$lib/auth.js'
import { Button } from 'mono-svelte' import { Button } from 'mono-svelte'
@@ -5,7 +5,7 @@
import Avatar from '$lib/components/ui/Avatar.svelte' import Avatar from '$lib/components/ui/Avatar.svelte'
import Card from '$lib/components/ui/Card.svelte' import Card from '$lib/components/ui/Card.svelte'
import StickyCard from '$lib/components/ui/StickyCard.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 FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import RelativeDate from '$lib/components/util/RelativeDate.svelte' import RelativeDate from '$lib/components/util/RelativeDate.svelte'
import { getClient } from '$lib/lemmy.js' import { getClient } from '$lib/lemmy.js'
@@ -3,7 +3,7 @@
import { profile } from '$lib/auth.js' import { profile } from '$lib/auth.js'
import FileInput from '$lib/components/input/FileInput.svelte' import FileInput from '$lib/components/input/FileInput.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.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 { getClient, uploadImage } from '$lib/lemmy.js'
import { addSubscription } from '$lib/lemmy/user.js' import { addSubscription } from '$lib/lemmy/user.js'
import { Button, Checkbox, TextInput } from 'mono-svelte' import { Button, Checkbox, TextInput } from 'mono-svelte'
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { profile } from '$lib/auth.js' import { profile } from '$lib/auth.js'
import FileInput from '$lib/components/input/FileInput.svelte' 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 { uploadImage } from '$lib/lemmy.js'
import { Button, Modal } from 'mono-svelte' import { Button, Modal } from 'mono-svelte'
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
@@ -2,7 +2,7 @@
import Avatar from '$lib/components/ui/Avatar.svelte' import Avatar from '$lib/components/ui/Avatar.svelte'
import type { Community, Person, PersonView } from 'lemmy-js-client' import type { Community, Person, PersonView } from 'lemmy-js-client'
import { getClient } from '$lib/lemmy.js' 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 { profile } from '$lib/auth.js'
import { Button, Checkbox, Modal, TextInput } from 'mono-svelte' import { Button, Checkbox, Modal, TextInput } from 'mono-svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
@@ -16,7 +16,7 @@
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
import { Color } from '$lib/ui/colors.js' import { Color } from '$lib/ui/colors.js'
import { isCommentView, isPostView } from '$lib/lemmy/item.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 { profile } from '$lib/auth.js'
import { Button } from 'mono-svelte' import { Button } from 'mono-svelte'
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import Comment from '$lib/components/lemmy/comment/Comment.svelte' import Comment from '$lib/components/lemmy/comment/Comment.svelte'
import Post from '$lib/components/lemmy/post/Post.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 { getClient } from '$lib/lemmy.js'
import { isCommentView, isPostView } from '$lib/lemmy/item.js' import { isCommentView, isPostView } from '$lib/lemmy/item.js'
import type { CommentView, PostView } from 'lemmy-js-client' import type { CommentView, PostView } from 'lemmy-js-client'
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import Comment from '$lib/components/lemmy/comment/Comment.svelte' import Comment from '$lib/components/lemmy/comment/Comment.svelte'
import Post from '$lib/components/lemmy/post/Post.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 { getClient } from '$lib/lemmy.js'
import type { CommentView, PostView } from 'lemmy-js-client' import type { CommentView, PostView } from 'lemmy-js-client'
import { profile } from '$lib/auth.js' import { profile } from '$lib/auth.js'
+4 -2
View File
@@ -7,7 +7,7 @@
import { userSettings } from '$lib/settings.js' import { userSettings } from '$lib/settings.js'
import PostLink from '$lib/components/lemmy/post/PostLink.svelte' import PostLink from '$lib/components/lemmy/post/PostLink.svelte'
import PostMeta from '$lib/components/lemmy/post/PostMeta.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 Markdown from '$lib/components/markdown/Markdown.svelte'
import Spinner from '$lib/components/ui/loader/Spinner.svelte' import Spinner from '$lib/components/ui/loader/Spinner.svelte'
@@ -95,7 +95,9 @@
{:else if post.post.url} {:else if post.post.url}
<PostLink <PostLink
url={post.post.url} 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} nsfw={post.post.nsfw}
/> />
{/if} {/if}
@@ -2,7 +2,7 @@
import { createEventDispatcher, onDestroy, onMount } from 'svelte' import { createEventDispatcher, onDestroy, onMount } from 'svelte'
import { getClient, uploadImage } from '$lib/lemmy.js' import { getClient, uploadImage } from '$lib/lemmy.js'
import type { Community, Post, PostView } from 'lemmy-js-client' 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 { Check, Icon, Photo } from 'svelte-hero-icons'
import { profile } from '$lib/auth.js' import { profile } from '$lib/auth.js'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
@@ -68,7 +68,7 @@
</Button> </Button>
</div> </div>
{:else} {:else}
<Popover targetClass="h-8" openOnHover> <Popover targetClass="h-8 z-30" openOnHover>
<div <div
class="flex items-center text-sm gap-1 rounded-md border border-slate-200 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" 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 FileInput from '$lib/components/input/FileInput.svelte'
import MultiSelect from '$lib/components/input/MultiSelect.svelte' import MultiSelect from '$lib/components/input/MultiSelect.svelte'
import Markdown from '$lib/components/markdown/Markdown.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 { uploadImage } from '$lib/lemmy.js'
import { Button, Label, Modal, TextArea } from 'mono-svelte' import { Button, Label, Modal, TextArea } from 'mono-svelte'
import { createEventDispatcher } from 'svelte' import { createEventDispatcher } from 'svelte'
+2 -2
View File
@@ -50,7 +50,7 @@
<div <div
class="overflow-visible {absolute class="overflow-visible {absolute
? 'absolute' ? 'absolute'
: 'relative'} cursor-auto {clazz} {itemsClass}" : 'relative'} cursor-auto h-max {clazz} {itemsClass}"
bind:this={element} bind:this={element}
tabindex="-1" tabindex="-1"
> >
@@ -70,7 +70,7 @@
{$$props.containerClass}" {$$props.containerClass}"
> >
{#if open} {#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} /> <slot {toggleOpen} />
</div> </div>
{/if} {/if}
-79
View File
@@ -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>
-64
View File
@@ -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
View File
@@ -1,5 +1,5 @@
import { goto } from '$app/navigation' 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 { userSettings } from '$lib/settings.js'
import { get } from 'svelte/store' import { get } from 'svelte/store'
+1 -3
View File
@@ -4,15 +4,13 @@
import { navigating } from '$app/stores' import { navigating } from '$app/stores'
import nProgress from 'nprogress' import nProgress from 'nprogress'
import 'nprogress/nprogress.css' import 'nprogress/nprogress.css'
import ToastContainer from '$lib/components/ui/toasts/ToastContainer.svelte'
import Moderation from '$lib/components/lemmy/moderation/Moderation.svelte' import Moderation from '$lib/components/lemmy/moderation/Moderation.svelte'
import Sidebar from '$lib/components/ui/sidebar/Sidebar.svelte' import Sidebar from '$lib/components/ui/sidebar/Sidebar.svelte'
import { onMount } from 'svelte'
// @ts-ignore // @ts-ignore
import { pwaInfo } from 'virtual:pwa-info' import { pwaInfo } from 'virtual:pwa-info'
import PwaReload from '$lib/PwaReload.svelte'
import { inDarkTheme } from '$lib/ui/colors.js' import { inDarkTheme } from '$lib/ui/colors.js'
import { userSettings } from '$lib/settings.js' import { userSettings } from '$lib/settings.js'
import { ToastContainer } from 'mono-svelte'
nProgress.configure({ nProgress.configure({
minimum: 0.4, minimum: 0.4,
+12 -4
View File
@@ -11,7 +11,7 @@
import EditableList from '$lib/components/ui/list/EditableList.svelte' import EditableList from '$lib/components/ui/list/EditableList.svelte'
import Menu from '$lib/components/ui/menu/Menu.svelte' import Menu from '$lib/components/ui/menu/Menu.svelte'
import MenuButton from '$lib/components/ui/menu/MenuButton.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 DebugObject from '$lib/components/util/debug/DebugObject.svelte'
import { import {
DEFAULT_INSTANCE_URL, DEFAULT_INSTANCE_URL,
@@ -173,7 +173,12 @@
</div> </div>
<div class="ml-auto" /> <div class="ml-auto" />
<Menu alignment="bottom-right"> <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" /> <Icon src={EllipsisHorizontal} mini size="16" slot="prefix" />
</Button> </Button>
<MenuButton on:click={() => moveProfile(profile.id, true)}> <MenuButton on:click={() => moveProfile(profile.id, true)}>
@@ -246,12 +251,15 @@
label="Guest instance" label="Guest instance"
bind:value={newInstance} bind:value={newInstance}
disabled={LINKED_INSTANCE_URL != undefined} disabled={LINKED_INSTANCE_URL != undefined}
/> size="sm"
>
<span slot="prefix">https://</span>
</TextInput>
<Button <Button
color="primary" color="primary"
{loading} {loading}
disabled={loading || LINKED_INSTANCE_URL != undefined} disabled={loading || LINKED_INSTANCE_URL != undefined}
class="h-[42px] self-end" class="self-end"
> >
Change Change
</Button> </Button>
@@ -4,7 +4,7 @@
import Card from '$lib/components/ui/Card.svelte' import Card from '$lib/components/ui/Card.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.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 { getClient } from '$lib/lemmy.js'
import type { RegistrationApplicationView } from 'lemmy-js-client' import type { RegistrationApplicationView } from 'lemmy-js-client'
import { Button } from 'mono-svelte' import { Button } from 'mono-svelte'
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import { profile } from '$lib/auth.js' import { profile } from '$lib/auth.js'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.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 } from '$lib/lemmy.js' import { getClient } from '$lib/lemmy.js'
import type { EditSite } from 'lemmy-js-client' import type { EditSite } from 'lemmy-js-client'
import type { PageData } from './$types.js' import type { PageData } from './$types.js'
+1 -1
View File
@@ -4,7 +4,7 @@
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte' import Placeholder from '$lib/components/ui/Placeholder.svelte'
import EditableList from '$lib/components/ui/list/EditableList.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 { getClient } from '$lib/lemmy.js'
import type { Tagline } from 'lemmy-js-client' import type { Tagline } from 'lemmy-js-client'
import { Button } from 'mono-svelte' import { Button } from 'mono-svelte'
+1 -1
View File
@@ -3,7 +3,7 @@
import UserLink from '$lib/components/lemmy/user/UserLink.svelte' import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte' import Placeholder from '$lib/components/ui/Placeholder.svelte'
import EditableList from '$lib/components/ui/list/EditableList.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 { instance } from '$lib/instance.js'
import { getClient } from '$lib/lemmy.js' import { getClient } from '$lib/lemmy.js'
import { addAdmin } from '$lib/lemmy/user.js' import { addAdmin } from '$lib/lemmy/user.js'
@@ -5,7 +5,7 @@
import { Icon, Plus, Trash } from 'svelte-hero-icons' import { Icon, Plus, Trash } from 'svelte-hero-icons'
import type { PageData } from './$types.js' import type { PageData } from './$types.js'
import { profile } from '$lib/auth.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 { getClient } from '$lib/lemmy.js'
import { flip } from 'svelte/animate' import { flip } from 'svelte/animate'
import { Button, TextInput } from 'mono-svelte' import { Button, TextInput } from 'mono-svelte'
+1 -1
View File
@@ -2,7 +2,7 @@
import { getClient } from '$lib/lemmy.js' import { getClient } from '$lib/lemmy.js'
import type { CommunityView } from 'lemmy-js-client' import type { CommunityView } from 'lemmy-js-client'
import { profile } from '$lib/auth.js' import { profile } from '$lib/auth.js'
import { toast } from '$lib/components/ui/toasts/toasts.js' import { toast } from 'mono-svelte'
export let community: CommunityView export let community: CommunityView
+1 -1
View File
@@ -13,7 +13,7 @@
} from 'lemmy-js-client' } from 'lemmy-js-client'
import { ChatBubbleOvalLeft, Check, Icon } from 'svelte-hero-icons' import { ChatBubbleOvalLeft, Check, Icon } from 'svelte-hero-icons'
import { page } from '$app/stores' 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 PostMeta from '$lib/components/lemmy/post/PostMeta.svelte'
import SectionTitle from '$lib/components/ui/SectionTitle.svelte' import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import { Button } from 'mono-svelte' import { Button } from 'mono-svelte'
+1 -1
View File
@@ -2,7 +2,7 @@
import { goto } from '$app/navigation' import { goto } from '$app/navigation'
import { setUser } from '$lib/auth.js' import { setUser } from '$lib/auth.js'
import Link from '$lib/components/input/Link.svelte' 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 { DEFAULT_INSTANCE_URL, LINKED_INSTANCE_URL } from '$lib/instance.js'
import { getClient, validateInstance } from '$lib/lemmy.js' import { getClient, validateInstance } from '$lib/lemmy.js'
import { Button, TextInput } from 'mono-svelte' import { Button, TextInput } from 'mono-svelte'
+1 -1
View File
@@ -1,7 +1,7 @@
<script lang="ts"> <script lang="ts">
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte' import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
import Post from '$lib/components/lemmy/post/Post.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 { getClient } from '$lib/lemmy.js'
import { isCommentReport, isPostReport } from '$lib/lemmy/item.js' import { isCommentReport, isPostReport } from '$lib/lemmy/item.js'
import type { import type {
@@ -13,7 +13,7 @@
import Card from '$lib/components/ui/Card.svelte' import Card from '$lib/components/ui/Card.svelte'
import PostLink from '$lib/components/lemmy/post/PostLink.svelte' import PostLink from '$lib/components/lemmy/post/PostLink.svelte'
import PostMeta from '$lib/components/lemmy/post/PostMeta.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 type { CommentSortType } from 'lemmy-js-client'
import MultiSelect from '$lib/components/input/MultiSelect.svelte' import MultiSelect from '$lib/components/input/MultiSelect.svelte'
import { profile } from '$lib/auth.js' import { profile } from '$lib/auth.js'
@@ -4,7 +4,7 @@
import FileInput from '$lib/components/input/FileInput.svelte' import FileInput from '$lib/components/input/FileInput.svelte'
import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte' import MarkdownEditor from '$lib/components/markdown/MarkdownEditor.svelte'
import Card from '$lib/components/ui/Card.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 { getClient, uploadImage } from '$lib/lemmy.js'
import type { SaveUserSettings } from 'lemmy-js-client' import type { SaveUserSettings } from 'lemmy-js-client'
import { Button, Checkbox, Modal, TextInput } from 'mono-svelte' import { Button, Checkbox, Modal, TextInput } from 'mono-svelte'
+14 -2
View File
@@ -1,5 +1,7 @@
<script lang="ts"> <script lang="ts">
import { page } from '$app/stores' 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 CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte' import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte'
import Post from '$lib/components/lemmy/post/Post.svelte' import Post from '$lib/components/lemmy/post/Post.svelte'
@@ -29,7 +31,7 @@
export let data export let data
let query = '' let query = data.query || ''
let pageNum = data.page let pageNum = data.page
</script> </script>
@@ -50,7 +52,7 @@
Type Type
</span> </span>
<option value="All">All</option> <option value="All">All</option>
<option value="Local">Posts</option> <option value="Posts">Posts</option>
<option value="Comments">Comments</option> <option value="Comments">Comments</option>
<option value="Communities">Communities</option> <option value="Communities">Communities</option>
<option value="Users">Users</option> <option value="Users">Users</option>
@@ -70,6 +72,16 @@
</Button> </Button>
</div> </div>
</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} {#if !data.results}
<Placeholder <Placeholder
icon={MagnifyingGlass} icon={MagnifyingGlass}
+6 -2
View File
@@ -15,7 +15,7 @@ import { get } from 'svelte/store'
export async function load({ url, fetch }) { export async function load({ url, fetch }) {
const query = url.searchParams.get('q') const query = url.searchParams.get('q')
const page = Number(url.searchParams.get('page')) || 1 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 sort = url.searchParams.get('sort') || 'New'
const type = url.searchParams.get('type') || 'All' const type = url.searchParams.get('type') || 'All'
@@ -23,7 +23,7 @@ export async function load({ url, fetch }) {
const results = await getClient(undefined, fetch).search({ const results = await getClient(undefined, fetch).search({
q: query, q: query,
auth: get(profile)?.jwt, auth: get(profile)?.jwt,
community_name: community ?? undefined, community_id: community ?? undefined,
limit: 40, limit: 40,
page: page, page: page,
sort: (sort as SortType) || 'New', sort: (sort as SortType) || 'New',
@@ -47,6 +47,7 @@ export async function load({ url, fetch }) {
type: type, type: type,
sort: sort, sort: sort,
page: page, page: page,
query: query,
results: everything, results: everything,
streamed: { streamed: {
object: get(profile)?.jwt object: get(profile)?.jwt
@@ -61,5 +62,8 @@ export async function load({ url, fetch }) {
return { return {
page: 1, page: 1,
sort: sort,
type: type,
query: query,
} }
} }
+1 -1
View File
@@ -3,7 +3,7 @@
import Setting from './Setting.svelte' import Setting from './Setting.svelte'
import MultiSelect from '$lib/components/input/MultiSelect.svelte' import MultiSelect from '$lib/components/input/MultiSelect.svelte'
import Sort from '$lib/components/lemmy/Sort.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 SectionTitle from '$lib/components/ui/SectionTitle.svelte'
import Link from '$lib/components/input/Link.svelte' import Link from '$lib/components/input/Link.svelte'
import { import {
+1 -1
View File
@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { goto } from '$app/navigation' 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 { DEFAULT_INSTANCE_URL } from '$lib/instance.js'
import { validateInstance } from '$lib/lemmy.js' import { validateInstance } from '$lib/lemmy.js'
import { Button, TextInput } from 'mono-svelte' import { Button, TextInput } from 'mono-svelte'
+1 -1
View File
@@ -8,7 +8,7 @@
import Card from '$lib/components/ui/Card.svelte' import Card from '$lib/components/ui/Card.svelte'
import Placeholder from '$lib/components/ui/Placeholder.svelte' import Placeholder from '$lib/components/ui/Placeholder.svelte'
import Spinner from '$lib/components/ui/loader/Spinner.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 { getClient } from '$lib/lemmy.js'
import type { GetCaptchaResponse } from 'lemmy-js-client' import type { GetCaptchaResponse } from 'lemmy-js-client'
import { Button, TextArea, TextInput } from 'mono-svelte' import { Button, TextArea, TextInput } from 'mono-svelte'
+1 -1
View File
@@ -24,7 +24,7 @@
import { isCommentView } from '$lib/lemmy/item.js' import { isCommentView } from '$lib/lemmy/item.js'
import { getClient } from '$lib/lemmy.js' import { getClient } from '$lib/lemmy.js'
import { isBlocked } from '$lib/lemmy/user.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 UserLink from '$lib/components/lemmy/user/UserLink.svelte'
import { profile } from '$lib/auth.js' import { profile } from '$lib/auth.js'
import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation.js' import { ban, isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
+4 -4
View File
@@ -2977,10 +2977,10 @@ mlly@^1.2.0, mlly@^1.4.0:
pkg-types "^1.0.3" pkg-types "^1.0.3"
ufo "^1.1.2" ufo "^1.1.2"
mono-svelte@^0.2.2: mono-svelte@^0.2.8:
version "0.2.2" version "0.2.8"
resolved "https://registry.yarnpkg.com/mono-svelte/-/mono-svelte-0.2.2.tgz#a7414fa09c7cae03539397e6b3a75b3db16e9fe2" resolved "https://registry.yarnpkg.com/mono-svelte/-/mono-svelte-0.2.8.tgz#30f6e83089a1f2517dfede8bba2cf36a6f26161c"
integrity sha512-SNUAFT4WvexJyqKz31tumsA+/uedzElewC/fvqfPEN03GvRk6Vz7IB8MIkBFQ2Zs2tJ1kkVicW+TAlL2VeYO2A== integrity sha512-M9KveQgHjBIp0xBPYJTPiDlNAFPIOeEQcq0H7ZokKfiyeDS+ZYCvNyyWC15ziJYWOtErKQd2e0cG7OVdE1ppPA==
mri@^1.1.0: mri@^1.1.0:
version "1.2.0" version "1.2.0"