feat: switch to a string instead of enum
This commit is contained in:
1 parent
aeb727ae3b
commit
87612d6507
23 files changed
+92
-128
No files matched your search
@@ -9,7 +9,7 @@
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import TextInput from '$lib/components/input/TextInput.svelte'
|
||||
import EditableList from '$lib/components/ui/list/EditableList.svelte'
|
||||
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import {
|
||||
LINKED_INSTANCE_URL,
|
||||
instance,
|
||||
@@ -32,12 +32,12 @@
|
||||
|
||||
toast({
|
||||
content: 'Changed guest instance.',
|
||||
type: ToastType.success,
|
||||
type: 'success',
|
||||
})
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: 'Failed to contact that instance URL. Is it down?',
|
||||
type: ToastType.error,
|
||||
type: 'error',
|
||||
})
|
||||
|
||||
loading = false
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import type { CommunityView } from 'lemmy-js-client'
|
||||
import { ToastType, addToast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
|
||||
export let community: CommunityView
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
subscribing = false
|
||||
return res
|
||||
} catch (error) {
|
||||
addToast('Error', 'Failed to subscribe to community', ToastType.error)
|
||||
toast({ content: 'Failed to subscribe to community', type: 'error' })
|
||||
}
|
||||
|
||||
subscribing = false
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
import Comment from '$lib/components/lemmy/comment/Comment.svelte'
|
||||
import Markdown from '$lib/components/markdown/Markdown.svelte'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import { ToastType, addToast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { profile } from '$lib/auth.js'
|
||||
@@ -16,6 +15,7 @@
|
||||
} from 'lemmy-js-client'
|
||||
import { ChatBubbleOvalLeft, Icon } from 'svelte-hero-icons'
|
||||
import { page } from '$app/stores'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
|
||||
export let item: CommentReplyView | PersonMentionView | PrivateMessageView
|
||||
export let read: boolean
|
||||
@@ -44,11 +44,10 @@
|
||||
recipient_id: message.creator.id,
|
||||
})
|
||||
|
||||
addToast(
|
||||
'Success',
|
||||
'Successfully replied to that message.',
|
||||
ToastType.success
|
||||
)
|
||||
toast({
|
||||
content: 'Successfully replied to that message.',
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
replying = false
|
||||
|
||||
@@ -57,7 +56,7 @@
|
||||
replaceState: true,
|
||||
})
|
||||
} catch (error) {
|
||||
addToast('Error', error as any, ToastType.error)
|
||||
toast({ content: error as any, type: 'error' })
|
||||
}
|
||||
|
||||
loading = false
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { profileData, setUser } from '$lib/auth.js'
|
||||
import { setUser } from '$lib/auth.js'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import TextInput from '$lib/components/input/TextInput.svelte'
|
||||
import Card from '$lib/components/ui/Card.svelte'
|
||||
import {
|
||||
ToastType,
|
||||
addToast,
|
||||
toast,
|
||||
} from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import {
|
||||
DEFAULT_INSTANCE_URL,
|
||||
LINKED_INSTANCE_URL,
|
||||
@@ -42,7 +38,7 @@
|
||||
if (response?.jwt) {
|
||||
await setUser(response.jwt, data.instance, data.username)
|
||||
|
||||
toast({ content: 'Successfully logged in.', type: ToastType.success })
|
||||
toast({ content: 'Successfully logged in.', type: 'success' })
|
||||
goto('/')
|
||||
} else {
|
||||
throw new Error('Invalid credentials')
|
||||
@@ -50,7 +46,7 @@
|
||||
} catch (error) {
|
||||
toast({
|
||||
content: error as any,
|
||||
type: ToastType.error,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
data.loading = false
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import CommentItem from '$lib/components/lemmy/comment/CommentItem.svelte'
|
||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { isCommentReport, isPostReport } from '$lib/lemmy/item.js'
|
||||
import type {
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
toast({
|
||||
content: `${resolved ? 'Resolved' : 'Unresolved'} that report.`,
|
||||
type: ToastType.success,
|
||||
type: 'success',
|
||||
})
|
||||
} else if (isPostReport(item)) {
|
||||
await getClient().resolvePostReport({
|
||||
@@ -50,7 +50,7 @@
|
||||
resolved = !resolved
|
||||
toast({
|
||||
content: `${resolved ? 'Resolved' : 'Unresolved'} that report.`,
|
||||
type: ToastType.success,
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
type: ToastType.error,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,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 { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import type { CommentSortType } from 'lemmy-js-client'
|
||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
||||
import { profile } from '$lib/auth.js'
|
||||
@@ -145,7 +145,7 @@
|
||||
|
||||
toast({
|
||||
content: 'The post was edited successfully.',
|
||||
type: ToastType.success,
|
||||
type: 'success',
|
||||
})
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
} from '$lib/lemmy.js'
|
||||
import { Color } from '$lib/ui/colors.js'
|
||||
import Button from '$lib/components/input/Button.svelte'
|
||||
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import Setting from './Setting.svelte'
|
||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
import { getClient } from '$lib/lemmy.js'
|
||||
import { isBlocked } from '$lib/lemmy/user.js'
|
||||
import MultiSelect from '$lib/components/input/MultiSelect.svelte'
|
||||
import { ToastType, toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import { toast } from '$lib/components/ui/toasts/toasts.js'
|
||||
import Modal from '$lib/components/ui/modal/Modal.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
import TextArea from '$lib/components/input/TextArea.svelte'
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
toast({
|
||||
content: `Successfully ${blocked ? 'unblocked' : 'blocked'} that user.`,
|
||||
type: ToastType.success,
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
goto($page.url, {
|
||||
@@ -63,7 +63,7 @@
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
type: ToastType.error,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
blocking = false
|
||||
@@ -87,14 +87,14 @@
|
||||
|
||||
toast({
|
||||
content: 'Successfully sent that person a message.',
|
||||
type: ToastType.success,
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
messaging = false
|
||||
} catch (err) {
|
||||
toast({
|
||||
content: err as any,
|
||||
type: ToastType.error,
|
||||
type: 'error',
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user