From 3e2ccbd2209bf2535eb8614e73f15f49f365331c Mon Sep 17 00:00:00 2001 From: Xylight Date: Wed, 12 Jun 2024 13:19:49 -0700 Subject: [PATCH] design: improve comments --- .../components/lemmy/ObjectAutocomplete.svelte | 10 ++++++---- .../components/lemmy/comment/Comment.svelte | 3 +++ .../components/lemmy/comment/Comments.svelte | 5 ++++- .../components/markdown/MarkdownEditor.svelte | 3 ++- src/lib/i18n/en.json | 3 ++- src/lib/util.ts | 18 +++++++----------- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/lib/components/lemmy/ObjectAutocomplete.svelte b/src/lib/components/lemmy/ObjectAutocomplete.svelte index 889d9bdf..595779a9 100644 --- a/src/lib/components/lemmy/ObjectAutocomplete.svelte +++ b/src/lib/components/lemmy/ObjectAutocomplete.svelte @@ -67,11 +67,13 @@ {:else if type == 'instance'} { - const results = await instances || {} + const results = (await instances) || {} - return q ? (results.federated_instances?.linked || []).filter( - (i) => i.software === 'lemmy' && i.domain.includes(q) - ) : [] + return q + ? (results.federated_instances?.linked || []).filter( + (i) => i.software === 'lemmy' && i.domain.includes(q) + ) + : [] }} extractName={(i) => `${i.domain}`} on:select diff --git a/src/lib/components/lemmy/comment/Comment.svelte b/src/lib/components/lemmy/comment/Comment.svelte index 34e08e59..fd6ff076 100644 --- a/src/lib/components/lemmy/comment/Comment.svelte +++ b/src/lib/components/lemmy/comment/Comment.svelte @@ -23,6 +23,8 @@ import { page } from '$app/stores' import { onMount } from 'svelte' import { t } from '$lib/translations' + import { slide } from 'svelte/transition' + import { expoOut } from 'svelte/easing' export let node: CommentNodeI export let postId: number @@ -176,6 +178,7 @@ {#if replying}

{$t('comment.reply')}

- {node.comment_view.counts.child_count} more + {$t('comment.more', { + // @ts-ignore + comments: node.comment_view.counts.child_count, + })} {/if} diff --git a/src/lib/components/markdown/MarkdownEditor.svelte b/src/lib/components/markdown/MarkdownEditor.svelte index 298e5a4e..942cd87c 100644 --- a/src/lib/components/markdown/MarkdownEditor.svelte +++ b/src/lib/components/markdown/MarkdownEditor.svelte @@ -183,7 +183,8 @@ overflow-hidden transition-colors" {#if tools}
*]:flex-shrink-0 flex flex-row overflow-auto p-1.5 gap-1.5 border-b + border-slate-200 dark:border-zinc-900 {$$props.disabled ? 'opacity-60 pointer-events-none' : ''}" > diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json index 1daff4bf..ccf2f4f4 100644 --- a/src/lib/i18n/en.json +++ b/src/lib/i18n/en.json @@ -413,7 +413,8 @@ "label": "Actions", "link": "Copy Link" }, - "locked": "This post is locked." + "locked": "This post is locked.", + "more": "{{comments:number}} more" }, "moderation": { "report": "Report", diff --git a/src/lib/util.ts b/src/lib/util.ts index f54ba268..99de8775 100644 --- a/src/lib/util.ts +++ b/src/lib/util.ts @@ -29,29 +29,25 @@ export const fullCommunityName = (name: string, actorId: string) => `${name}@${new URL(actorId).hostname}` export const placeholders = { - url: ['https://notas.cam', 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'], + url: ['https://www.youtube.com/watch?v=dQw4w9WgXcQ'], post: [ 'Is starting nuclear warfare illegal?', - 'A cool photo I took before the destruction of mankind!', - 'AITA for ending all contention and causing world peace?', + "AITA for making somebody's day?", 'BREAKING NEWS: Police break into gun shop, find weapons', 'How do I make sure my pet rock stays alive?', 'My cat just invented a time machine, what do I do?', - 'Unpopular opinion: world peace and global happiness would be beneficial to humanity', + 'Unpopular opinion: world peace would be beneficial to humanity', 'LPT: The smaller weights are easier to lift than the bigger weights in a gym', - 'javascript bad', 'ELI5: What is 4 + 8?', ], comment: [ - 'aint no way', + 'what?', 'new response just dropped', - '', - 'say, why did we name restaurant staff after computers, anyway?', - `this.\nedit: thanks for 1 upvote๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ!`, - 'Officer, I drop kicked that child in self defense! You gotta believe me man.', + "i did not read this post at all and i'm about to give my opinion on it.", 'this comment placeholder is very important dont forget', - 'As Abraham Lincoln once said, "don\'t believe everything you see on the internet."', + 'huh. i did not understand any of that.', 'existential crisis in progress', + 'hello user i am a sentient placeholder. please dont type anything or i disappear forever. thanks', ], get: (type: 'url' | 'post' | 'comment') => { return get(userSettings)?.randomPlaceholders