MCPcopy Create free account
hub / github.com/block/buzz / ForumThreadPanel

Function ForumThreadPanel

desktop/src/features/forum/ui/ForumThreadPanel.tsx:123–296  ·  view source on GitHub ↗
({
  thread,
  isLoading,
  isSendingReply,
  channelId,
  currentPubkey,
  profiles,
  onBack,
  onReply,
  onDeletePost,
  onDeleteReply,
  onTargetReached,
  canDeletePost,
  isDeletingPost,
  targetEventId,
}: ForumThreadPanelProps)

Source from the content-addressed store, hash-verified

121}
122
123export function ForumThreadPanel({
124 thread,
125 isLoading,
126 isSendingReply,
127 channelId,
128 currentPubkey,
129 profiles,
130 onBack,
131 onReply,
132 onDeletePost,
133 onDeleteReply,
134 onTargetReached,
135 canDeletePost,
136 isDeletingPost,
137 targetEventId,
138}: ForumThreadPanelProps) {
139 const scrollRef = React.useRef<HTMLDivElement>(null);
140 const { channels } = useChannelNavigation();
141 const channelNames = React.useMemo(
142 () => channels.filter((c) => c.channelType !== "dm").map((c) => c.name),
143 [channels],
144 );
145
146 React.useEffect(() => {
147 if (!thread || !targetEventId) {
148 return;
149 }
150
151 const targetElement =
152 scrollRef.current?.querySelector<HTMLElement>(
153 `[data-forum-event-id="${targetEventId}"]`,
154 ) ?? null;
155 if (!targetElement) {
156 return;
157 }
158
159 targetElement.scrollIntoView({ block: "center" });
160 onTargetReached?.(targetEventId);
161 }, [onTargetReached, targetEventId, thread]);
162
163 if (isLoading || !thread) {
164 return (
165 <div className={cn("flex h-full flex-col", channelChrome.contentPadding)}>
166 <div className="border-b border-border/60 px-4 py-3">
167 <Button
168 className="gap-1.5 text-muted-foreground"
169 onClick={onBack}
170 size="sm"
171 variant="ghost"
172 >
173 <ArrowLeft className="h-4 w-4" />
174 Back to posts
175 </Button>
176 </div>
177 <div className="flex-1 space-y-4 p-4">
178 <Skeleton className="h-8 w-3/4" />
179 <Skeleton className="h-24 w-full" />
180 <Skeleton className="h-16 w-full" />

Callers

nothing calls this directly

Calls 6

useChannelNavigationFunction · 0.90
cnFunction · 0.90
resolveMentionNamesFunction · 0.90
resolveUserLabelFunction · 0.90
formatRelativeTimeFunction · 0.90
parseImetaTagsFunction · 0.90

Tested by

no test coverage detected