diff --git a/src/hooks.server.ts b/src/hooks.server.ts
index 5ff6f710..941fe430 100644
--- a/src/hooks.server.ts
+++ b/src/hooks.server.ts
@@ -17,7 +17,6 @@ export function handleError({ error, event }) {
export async function handle({ event, resolve }) {
// annoying hack to fix lemmy's CORS
if (event.url.pathname.startsWith('/cors')) {
- // cut off the 1st slash (empty), and remove the /cors
event.request.headers.delete('origin')
event.request.headers.delete('host')
@@ -55,19 +54,11 @@ export async function handle({ event, resolve }) {
)
}
- try {
- const json = await data.json()
+ const json = await data.json()
- return new Response(JSON.stringify(json), {
- status: data.status,
- })
- } catch (error) {
- console.log('Caught the thing')
-
- return new Response(JSON.stringify({ message: 'i hate everything' }), {
- status: 500,
- })
- }
+ return new Response(JSON.stringify(json), {
+ status: data.status,
+ })
} catch (error) {
return new Response(
JSON.stringify({
diff --git a/src/lib/components/community/CommunityCard.svelte b/src/lib/components/community/CommunityCard.svelte
new file mode 100644
index 00000000..26ece59d
--- /dev/null
+++ b/src/lib/components/community/CommunityCard.svelte
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {community_view.community.name}
+
+
+
diff --git a/src/lib/components/community/CommunityLink.svelte b/src/lib/components/community/CommunityLink.svelte
index dd7ac010..e3d97089 100644
--- a/src/lib/components/community/CommunityLink.svelte
+++ b/src/lib/components/community/CommunityLink.svelte
@@ -3,6 +3,7 @@
export let community: Community
export let avatar: boolean = false
+ export let avatarSize: number = 24
function linkFromCommunity(community: Community) {
const domain = new URL(community.actor_id).hostname
@@ -19,8 +20,8 @@
src={community.icon ??
`https://api.dicebear.com/6.x/initials/svg?seed=${community.name}`}
alt=""
- width={24}
- height={24}
+ width={avatarSize}
+ height={avatarSize}
class="rounded-full aspect-square object-cover"
loading="lazy"
/>
diff --git a/src/lib/components/input/Button.svelte b/src/lib/components/input/Button.svelte
index 79e9ef53..7c958ba8 100644
--- a/src/lib/components/input/Button.svelte
+++ b/src/lib/components/input/Button.svelte
@@ -7,6 +7,7 @@
export let loading = false
export let large = false
export let disabled = false
+ export let submit = false
const dispatch = createEventDispatcher()
@@ -19,6 +20,7 @@
: 'px-3 py-1.5'} rounded-md {color} text-sm transition-all {disabled
? 'opacity-50 pointer-events-none'
: ''}"
+ type={submit ? 'submit' : 'button'}
>
+ import { DocumentPlus, Icon } from 'svelte-hero-icons'
+
+ export let accept = 'image/*,video/*'
+ export let multiple = false
+ export let files: FileList | null | undefined = null
+ export let image = false
+
+ let previewURL = ''
+ let dragover = false
+
+ $: if (files) {
+ previewURL = URL.createObjectURL(files[0])
+ }
+
+
+
diff --git a/src/lib/components/input/SelectMenu.svelte b/src/lib/components/input/SelectMenu.svelte
new file mode 100644
index 00000000..d1e61f08
--- /dev/null
+++ b/src/lib/components/input/SelectMenu.svelte
@@ -0,0 +1,33 @@
+
+
+
diff --git a/src/lib/components/input/TextArea.svelte b/src/lib/components/input/TextArea.svelte
new file mode 100644
index 00000000..de05e6bb
--- /dev/null
+++ b/src/lib/components/input/TextArea.svelte
@@ -0,0 +1,34 @@
+
+
+
diff --git a/src/lib/components/input/TextInput.svelte b/src/lib/components/input/TextInput.svelte
index e438de1c..6f427db3 100644
--- a/src/lib/components/input/TextInput.svelte
+++ b/src/lib/components/input/TextInput.svelte
@@ -6,6 +6,7 @@
export let placeholder: string = ''
export let value: string = ''
export let maxlength: number = -1
+ export let required = false
function typeAction(node: Node) {
// @ts-ignore
@@ -24,6 +25,9 @@
class="font-bold text-sm text-left mb-1 cursor-pointer w-max self-start"
>
{label}
+ {#if required}
+
*
+ {/if}
{/if}
- import type {
- CommentView,
- GetPostResponse,
- PostView,
- Comment,
- } from 'lemmy-js-client'
+ import type { PostView } from 'lemmy-js-client'
import {
- ArrowDown,
- ArrowUp,
- ChatBubbleLeft,
ChatBubbleOvalLeft,
- ChatBubbleOvalLeftEllipsis,
- ChevronDown,
- ChevronUp,
+ EllipsisHorizontal,
Icon,
+ Square2Stack,
+ Trash,
} from 'svelte-hero-icons'
import RelativeDate from '$lib/components/util/RelativeDate.svelte'
import CommunityLink from '$lib/components/community/CommunityLink.svelte'
import { isImage, isVideo } from '$lib/ui/image.js'
- import { authData, getClient } from '$lib/lemmy.js'
import PostVote from '$lib/components/lemmy/PostVote.svelte'
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import UserLink from '$lib/components/user/UserLink.svelte'
+ import Card from '$lib/components/ui/Card.svelte'
+ import {
+ DEFAULT_INSTANCE_URL,
+ authData,
+ getClient,
+ user,
+ } from '$lib/lemmy.js'
+ import Menu from '$lib/components/ui/menu/Menu.svelte'
+ import Button from '$lib/components/input/Button.svelte'
+ import MenuButton from '$lib/components/ui/menu/MenuButton.svelte'
+ import { Color } from '$lib/ui/colors.js'
+ import { page } from '$app/stores'
let postRes: PostView
export { postRes as post }
- let vote = postRes.my_vote
+ let deleting = false
- async function upvote() {
+ async function deletePost() {
if (!$authData) return
- const upvoted = postRes.my_vote == 1
+ deleting = true
- await getClient()
- .likePost({
- score: upvoted ? 0 : 1,
- auth: $authData.token,
- post_id: postRes.post.id,
- })
- .catch((_) => undefined)
- }
+ await getClient().deletePost({
+ auth: $authData.token,
+ deleted: true,
+ post_id: postRes.post.id,
+ })
- async function downvote() {
- if (!$authData) return
-
- const upvoted = postRes.my_vote == -1
-
- await getClient()
- .likePost({
- score: upvoted ? 0 : -1,
- auth: $authData.token,
- post_id: postRes.post.id,
- })
- .catch((_) => undefined)
+ deleting = false
}
-
+
-
-
+
+
+
+
+
-
-
+
-
+
{postRes.post.name}
{#if postRes.post.url}
@@ -100,7 +88,10 @@
{/if}
{#if postRes.post.body}
-
+
{postRes.post.body}
{/if}
@@ -113,10 +104,10 @@
/>
@@ -124,5 +115,29 @@
+
-
+
diff --git a/src/lib/components/lemmy/PostVote.svelte b/src/lib/components/lemmy/PostVote.svelte
index ed03ef5c..d4a4aa93 100644
--- a/src/lib/components/lemmy/PostVote.svelte
+++ b/src/lib/components/lemmy/PostVote.svelte
@@ -37,39 +37,41 @@
}
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/src/lib/components/lemmy/comment/Comment.svelte b/src/lib/components/lemmy/comment/Comment.svelte
index e002af6e..d27d9778 100644
--- a/src/lib/components/lemmy/comment/Comment.svelte
+++ b/src/lib/components/lemmy/comment/Comment.svelte
@@ -16,6 +16,7 @@
import CommentForm from './CommentForm.svelte'
import { page } from '$app/stores'
import UserLink from '$lib/components/user/UserLink.svelte'
+ import Markdown from '$lib/components/markdown/Markdown.svelte'
export let node: CommentNodeI
@@ -59,7 +60,7 @@