From 4fa7449d71bbb14bf37b90303ccf2370db5d87af Mon Sep 17 00:00:00 2001 From: thislight Date: Tue, 8 Oct 2024 17:18:27 +0800 Subject: [PATCH 1/6] TootComposer: don't switch the random placeholder --- package.json | 2 +- src/timelines/TootComposer.tsx | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 4c0af67..19f3a48 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "$schema": "https://json.schemastore.org/package", "name": "tutu", - "version": "1.0.7", + "version": "1.0.8", "description": "", "private": true, "type": "module", diff --git a/src/timelines/TootComposer.tsx b/src/timelines/TootComposer.tsx index b50ba64..9087d8f 100644 --- a/src/timelines/TootComposer.tsx +++ b/src/timelines/TootComposer.tsx @@ -1,5 +1,6 @@ import { createEffect, + createMemo, createSignal, createUniqueId, onMount, @@ -212,6 +213,10 @@ const TootComposer: Component<{ const [langPickerOpen, setLangPickerOpen] = createSignal(false); const appLanguage = useLanguage(); + const randomPlaceholder = createMemo(() => + randomChoose(Math.random(), ["What's happening?", "What do your think?"]), + ); + createEffect(() => { const lang = appLanguage().split("-")[0]; setLanguage(lang); @@ -311,10 +316,7 @@ const TootComposer: Component<{ placeholder={ props.replyToDisplayName ? `Reply to ${props.replyToDisplayName}...` - : randomChoose(Math.random(), [ - "What's happening?", - "What do your think?", - ]) + : randomPlaceholder() } style={{ width: "100%", border: "none" }} disabled={sending()} From eefe2812dfa3e8a87199c33998043e07cb7d060c Mon Sep 17 00:00:00 2001 From: thislight Date: Tue, 8 Oct 2024 17:33:52 +0800 Subject: [PATCH 2/6] *Toot: fix missing preview card --- src/timelines/toot.module.css | 1 + 1 file changed, 1 insertion(+) diff --git a/src/timelines/toot.module.css b/src/timelines/toot.module.css index af13f46..56b4d73 100644 --- a/src/timelines/toot.module.css +++ b/src/timelines/toot.module.css @@ -3,6 +3,7 @@ --card-gut: 16px; --toot-avatar-size: 40px; margin-block: 0; + position: relative; &.toot { /* fix composition ordering: I think the css module processor should aware the overriding and behaves, but no */ From dbb93fd76c4632c94ba10f08551c42e625efae53 Mon Sep 17 00:00:00 2001 From: thislight Date: Tue, 8 Oct 2024 17:43:33 +0800 Subject: [PATCH 3/6] MediaAttachmentGrid: improve layout as length % 2 --- src/timelines/MediaAttachmentGrid.tsx | 34 +++++++++++++++++---------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/src/timelines/MediaAttachmentGrid.tsx b/src/timelines/MediaAttachmentGrid.tsx index a88d7a6..5748f0d 100644 --- a/src/timelines/MediaAttachmentGrid.tsx +++ b/src/timelines/MediaAttachmentGrid.tsx @@ -51,9 +51,19 @@ const MediaAttachmentGrid: Component<{ setViewerIndex(index); }; + const columnCount = () => { + if (props.attachments.length === 1) { + return 1; + } else if (props.attachments.length % 2 === 0) { + return 2; + } else { + return 3; + } + }; + css` .attachments { - column-count: ${(props.attachments.length === 1 ? 1 : 3).toString()}; + column-count: ${columnCount.toString()}; } `; return ( @@ -104,17 +114,17 @@ const MediaAttachmentGrid: Component<{ /> ); case "gifv": // Later we can handle the preview - return ( -