feat: add option to resolve posts to your home instance
This commit is contained in:
1 parent
735bdff376
commit
c09460bd9b
4 files changed
+68
-23
No files matched your search
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import Spinner from '$lib/components/ui/loader/Spinner.svelte'
|
||||
import {
|
||||
type Toast,
|
||||
toasts,
|
||||
@@ -29,20 +30,26 @@
|
||||
opacity: 0,
|
||||
}}
|
||||
>
|
||||
<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 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>
|
||||
|
||||
@@ -14,6 +14,7 @@ export interface Toast {
|
||||
title?: string
|
||||
content: string
|
||||
type: ToastType
|
||||
loading?: boolean
|
||||
action?: () => any
|
||||
}
|
||||
|
||||
@@ -24,12 +25,14 @@ export function toast({
|
||||
content,
|
||||
type = 'info',
|
||||
duration = 5000,
|
||||
loading = false,
|
||||
action,
|
||||
}: {
|
||||
title?: string
|
||||
content: string
|
||||
type?: ToastType
|
||||
duration?: number
|
||||
loading?: boolean
|
||||
action?: () => any
|
||||
}) {
|
||||
let id = 0
|
||||
@@ -44,6 +47,7 @@ export function toast({
|
||||
content: content,
|
||||
title: title,
|
||||
type: type,
|
||||
loading: loading,
|
||||
action: action,
|
||||
},
|
||||
]
|
||||
@@ -52,4 +56,9 @@ export function toast({
|
||||
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))
|
||||
Reference in new issue
Block a user