@@ -198,7 +123,6 @@ export function ForumThreadPanel({
targetEventId,
}: ForumThreadPanelProps) {
const scrollRef = React.useRef(null);
- const [isDeletePostOpen, setIsDeletePostOpen] = React.useState(false);
const { channels } = useChannelNavigation();
const channelNames = React.useMemo(
() => channels.filter((c) => c.channelType !== "dm").map((c) => c.name),
@@ -298,33 +222,10 @@ export function ForumThreadPanel({
{canDeletePost && onDeletePost ? (
- onDeletePost(post.eventId)}
+ />
) : null}
diff --git a/mobile/lib/features/forum/forum_post_card.dart b/mobile/lib/features/forum/forum_post_card.dart
index 5597b42a2..308c65141 100644
--- a/mobile/lib/features/forum/forum_post_card.dart
+++ b/mobile/lib/features/forum/forum_post_card.dart
@@ -4,6 +4,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:lucide_icons_flutter/lucide_icons.dart';
import '../../shared/theme/theme.dart';
+import '../channels/message_content.dart';
import '../profile/user_cache_provider.dart';
import '../profile/user_profile.dart';
import 'forum_models.dart';
@@ -33,6 +34,11 @@ class ForumPostCard extends ConsumerWidget {
ref.watch(userCacheProvider.select((cache) => cache[pk])) ??
ref.read(userCacheProvider.notifier).get(pk);
final displayName = profile?.label ?? _shortPubkey(post.pubkey);
+ final mentionNames = ref.watch(
+ userCacheProvider.select(
+ (cache) => _buildMentionNames(post.mentionPubkeys, cache),
+ ),
+ );
final preview = post.content.length > 200
? '${post.content.substring(0, 200)}...'
: post.content;
@@ -94,13 +100,23 @@ class ForumPostCard extends ConsumerWidget {
const SizedBox(height: Grid.xxs),
// Content preview
- Text(
- preview,
- style: context.textTheme.bodyMedium?.copyWith(
- color: context.colors.onSurface,
+ ShaderMask(
+ shaderCallback: (bounds) => const LinearGradient(
+ begin: Alignment.topCenter,
+ end: Alignment.bottomCenter,
+ colors: [Colors.white, Colors.white, Colors.transparent],
+ stops: [0.0, 0.75, 1.0],
+ ).createShader(bounds),
+ blendMode: BlendMode.dstIn,
+ child: ConstrainedBox(
+ constraints: const BoxConstraints(maxHeight: 120),
+ child: IgnorePointer(
+ child: MessageContent(
+ content: preview,
+ mentionNames: mentionNames,
+ ),
+ ),
),
- maxLines: 4,
- overflow: TextOverflow.ellipsis,
),
// Thread summary
@@ -251,3 +267,17 @@ String _shortPubkey(String pubkey) {
if (pubkey.length > 12) return '${pubkey.substring(0, 8)}\u2026';
return pubkey;
}
+
+Map _buildMentionNames(
+ List mentionPubkeys,
+ Map userCache,
+) {
+ final names = {};
+ for (final pk in mentionPubkeys) {
+ final p = userCache[pk.toLowerCase()];
+ if (p?.displayName != null) {
+ names[pk.toLowerCase()] = p!.displayName!;
+ }
+ }
+ return names;
+}