From 3a91d49fc059a5330e55367dc318e9d53994cea3 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Wed, 28 Jun 2023 10:52:02 -0700 Subject: [PATCH] Small note display bugfixes --- ROADMAP.md | 3 +++ src/app/shared/NoteContent.svelte | 3 ++- src/app/shared/NoteContentEllipsis.svelte | 7 +++++++ src/app/shared/NoteContentKind1.svelte | 13 ++++++++++++- src/app/views/Notification.svelte | 11 +++++++---- src/app/views/Notifications.svelte | 1 + src/partials/Compose.svelte | 2 +- src/util/notes.ts | 8 +++++--- 8 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 src/app/shared/NoteContentEllipsis.svelte diff --git a/ROADMAP.md b/ROADMAP.md index e200f1d4..108fdb3e 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,5 +1,8 @@ # Current +- [ ] Fix @ mention on safari +- [ ] Fix http://localhost:5173/nevent1qqspulrcsx0ceunrnk88vvdta4lw70ch32e03rl8elughxpwsdy0kkgpzfmhxue69uhk7enxvd5xz6tw9ec82cs56smhk +- [ ] Get rid of Button - [ ] Make notifications beautiful and usable - [ ] Render threads in a way that makes them easy to use - [ ] White-labeled diff --git a/src/app/shared/NoteContent.svelte b/src/app/shared/NoteContent.svelte index 0818cc9b..084cb128 100644 --- a/src/app/shared/NoteContent.svelte +++ b/src/app/shared/NoteContent.svelte @@ -11,6 +11,7 @@ export let anchorId = null export let maxLength = 700 export let showEntire = false + export let hideShowMore = true export let showMedia = user.getSetting("showMedia") @@ -25,5 +26,5 @@ {:else if note.kind === 30023} {:else} - + {/if} diff --git a/src/app/shared/NoteContentEllipsis.svelte b/src/app/shared/NoteContentEllipsis.svelte new file mode 100644 index 00000000..8648e514 --- /dev/null +++ b/src/app/shared/NoteContentEllipsis.svelte @@ -0,0 +1,7 @@ + + +
+ See more +
diff --git a/src/app/shared/NoteContentKind1.svelte b/src/app/shared/NoteContentKind1.svelte index 28a4a9f2..868c6c07 100644 --- a/src/app/shared/NoteContentKind1.svelte +++ b/src/app/shared/NoteContentKind1.svelte @@ -7,11 +7,14 @@ LINK, INVOICE, NEWLINE, + ELLIPSIS, TOPIC, + TEXT, } from "src/util/notes" import MediaSet from "src/partials/MediaSet.svelte" import QRCode from "src/partials/QRCode.svelte" import NoteContentNewline from "src/app/shared/NoteContentNewline.svelte" + import NoteContentEllipsis from "src/app/shared/NoteContentEllipsis.svelte" import NoteContentTopic from "src/app/shared/NoteContentTopic.svelte" import NoteContentLink from "src/app/shared/NoteContentLink.svelte" import NoteContentPerson from "src/app/shared/NoteContentPerson.svelte" @@ -22,13 +25,17 @@ export let anchorId = false export let showEntire = false export let showMedia = false + export let hideShowMore = false const fullContent = parseContent(note) const shortContent = truncateContent(fullContent, {maxLength, showEntire, showMedia}) const links = getLinks(shortContent) const extraLinks = without(links, getLinks(fullContent)) - export const isNewline = i => !shortContent[i] || shortContent[i].type === NEWLINE + export const isNewline = i => + !shortContent[i] || + shortContent[i].type === NEWLINE || + (shortContent[i].type === TEXT && shortContent[i].value.match(/^\s+$/)) export const isStartOrEnd = i => isNewline(i - 1) || isNewline(i + 1) @@ -38,6 +45,10 @@ {#each shortContent as { type, value }, i} {#if type === NEWLINE} + {:else if type === ELLIPSIS} + {#if !hideShowMore} + + {/if} {:else if type === TOPIC} {:else if type === INVOICE} diff --git a/src/app/views/Notification.svelte b/src/app/views/Notification.svelte index 48e594ac..961fead6 100644 --- a/src/app/views/Notification.svelte +++ b/src/app/views/Notification.svelte @@ -1,7 +1,7 @@