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
@@ -75,7 +75,7 @@
|
||||
vote == 1
|
||||
? $userSettings.revertColors
|
||||
? '!text-orange-500'
|
||||
: '!text-blue-500'
|
||||
: '!text-blue-500 dark:!text-blue-400'
|
||||
: vote == -1
|
||||
? $userSettings.revertColors
|
||||
? '!text-blue-500'
|
||||
@@ -84,28 +84,31 @@
|
||||
</script>
|
||||
|
||||
<slot {upvote} {downvote} {vote} {score}>
|
||||
<div class="flex items-center text-sm gap-0.5 rounded-md border-zinc-700">
|
||||
<div
|
||||
class="flex items-center text-sm gap-1 rounded-md border border-slate-200
|
||||
dark:border-zinc-700 px-1 h-full duration-200"
|
||||
>
|
||||
<Button
|
||||
aria-label="Upvote"
|
||||
class={vote == 1 ? voteColor(vote) : ''}
|
||||
on:click={upvote}
|
||||
size="square-md"
|
||||
size="square-sm"
|
||||
color="tertiary"
|
||||
alignment="center"
|
||||
>
|
||||
<Icon src={ArrowUpCircle} mini={vote == 1} size="20" />
|
||||
<Icon src={ChevronUp} mini size="18" />
|
||||
</Button>
|
||||
<span class="font-medium {voteColor(vote)}">
|
||||
<span class="font-medium transition-colors duration-200 {voteColor(vote)}">
|
||||
<FormattedNumber number={score} />
|
||||
</span>
|
||||
<Button
|
||||
aria-label="Downvote"
|
||||
class={vote == -1 ? voteColor(vote) : ''}
|
||||
on:click={downvote}
|
||||
size="square-md"
|
||||
size="square-sm"
|
||||
color="tertiary"
|
||||
>
|
||||
<Icon src={ArrowDownCircle} mini={vote == -1} size="20" />
|
||||
<Icon src={ChevronDown} mini size="18" />
|
||||
</Button>
|
||||
</div>
|
||||
</slot>
|
||||
@@ -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