From 4a0ec3a7410a6e5e9f35c6d5e453428a1ba9ec46 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 14 Jan 2026 11:08:06 +0000 Subject: [PATCH] feat: Add configurable media rendering options for RichText Extends RichTextOptions interface with display preferences including: - Media size presets (compact/normal/large) - Adaptive grid columns (auto or fixed 1-4) - Aspect ratio preservation toggle - Visual polish options (transitions, rounded corners) - Interaction controls (zoom enable/disable) Implements adaptive grid layout in Gallery component: - Auto-adapts columns based on media count (1 col for single, 2 for pair, 3 for multiple) - Respects fixed column preferences when specified - Preserves aspect ratios or applies crops based on configuration Creates media preset configurations for different contexts: - CHAT_PRESET: Balanced for conversation flow with adaptive columns - REPLY_PRESET: Minimal for lightweight reply previews - FEED_PRESET: Efficient for scrolling with compact size - DETAIL_PRESET: Full quality for focused viewing - COMPACT_PRESET: Minimal footprint for constrained spaces Updates ChatViewer to use CHAT_PRESET for optimal chat experience. --- src/components/ChatViewer.tsx | 19 +++- src/components/nostr/RichText.tsx | 25 ++++++ src/components/nostr/RichText/Gallery.tsx | 86 +++++++++++++++++- src/components/nostr/RichText/Link.tsx | 29 +++++- src/lib/media-presets.ts | 104 ++++++++++++++++++++++ tsconfig.node.tsbuildinfo | 2 +- 6 files changed, 255 insertions(+), 10 deletions(-) create mode 100644 src/lib/media-presets.ts diff --git a/src/components/ChatViewer.tsx b/src/components/ChatViewer.tsx index 6749b5f..540990c 100644 --- a/src/components/ChatViewer.tsx +++ b/src/components/ChatViewer.tsx @@ -30,6 +30,7 @@ import { parseSlashCommand } from "@/lib/chat/slash-command-parser"; import { UserName } from "./nostr/UserName"; import { RichText } from "./nostr/RichText"; import Timestamp from "./Timestamp"; +import { CHAT_PRESET } from "@/lib/media-presets"; import { ReplyPreview } from "./chat/ReplyPreview"; import { MembersDropdown } from "./chat/MembersDropdown"; import { RelaysDropdown } from "./chat/RelaysDropdown"; @@ -174,7 +175,11 @@ const ComposerReplyPreview = memo(function ComposerReplyPreview({