@anthusai/papyrus 5.43.0-next.41 → 5.43.0-next.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -202,6 +202,58 @@ export function FeedImage({ host, lead, name, src }: { host: string | null; lead
202
202
  );
203
203
  }
204
204
 
205
+ /**
206
+ * The standard Reference header: its picture, source, headline, dek and age. The feed card wraps it in the button that opens the
207
+ * Reference, and the Messages page shows it under a conversation as the thing the conversation is about. No decision controls.
208
+ */
209
+ export function ReferenceCardHeader({ capture, lead = false, messageCount = 0, now, preview, reference, titleId }: {
210
+ capture?: CaptureStatus | undefined;
211
+ lead?: boolean;
212
+ messageCount?: number;
213
+ now: number;
214
+ preview: ReferencePreview | undefined;
215
+ reference: ReferenceRecord;
216
+ titleId?: string;
217
+ }) {
218
+ const host = referenceSourceHost(reference);
219
+ const site = preview?.siteName ?? host ?? "Unknown source";
220
+ const title = referenceDisplayTitle(reference);
221
+ const dek = referenceDek(reference, preview);
222
+ const showDek = dekAddsInformation(title, dek, preview?.imageUrl ?? null);
223
+ const time = referenceDisplayTime(reference);
224
+ const age = formatFeedAge(time, now);
225
+ return (
226
+ <>
227
+ <FeedImage host={host} lead={lead} name={site} src={preview?.imageUrl ?? null} />
228
+ <span className={cn("flex flex-1 flex-col gap-2.5", lead ? "p-5 @[36rem]:p-7" : "p-5")}>
229
+ <span className="flex items-center gap-2 text-xs font-medium text-muted-foreground" data-feed-source>
230
+ <SourceMark host={host} />
231
+ <span className="truncate">{site}</span>
232
+ </span>
233
+ <span className={cn("font-bold leading-[1.15] tracking-tight text-foreground", lead ? "line-clamp-3 text-2xl @[36rem]:text-3xl @[60rem]:text-4xl" : "line-clamp-3 text-xl")} data-feed-title id={titleId}>
234
+ {title}
235
+ </span>
236
+ {showDek ? <span className={cn("text-muted-foreground", lead ? "line-clamp-3 text-base" : "line-clamp-2 text-sm")} data-feed-dek>{dek}</span> : null}
237
+ <span className="mt-auto flex flex-wrap items-center gap-x-2 gap-y-1 pt-1 text-xs text-muted-foreground">
238
+ <span>
239
+ {age ? <time dateTime={new Date(time ?? now).toISOString()} title={new Date(time ?? now).toLocaleString()}>{age}</time> : null}
240
+ {age && host ? <span aria-hidden="true"> · </span> : null}
241
+ {host}
242
+ </span>
243
+ {capture ? <CaptureBadge status={capture} /> : null}
244
+ {messageCount > 0 ? (
245
+ <span aria-label={messageCountLabel(messageCount)} className="inline-flex items-center gap-1 tabular-nums" data-feed-message-count={messageCount} role="img">
246
+ <MessageSquareIcon aria-hidden="true" className="size-3.5" />
247
+ {messageCount}
248
+ </span>
249
+ ) : null}
250
+ {isAutoAccepted(reference) ? <AutoAcceptedBadge actor={reference.curationStatusUpdatedBy} reason={reference.curationStatusReason} /> : null}
251
+ </span>
252
+ </span>
253
+ </>
254
+ );
255
+ }
256
+
205
257
  export function FeedCard({
206
258
  capture,
207
259
  messageCount = 0,
@@ -283,32 +335,7 @@ export function FeedCard({
283
335
  onClick={onOpen}
284
336
  type="button"
285
337
  >
286
- <FeedImage host={host} lead={lead} name={site} src={preview?.imageUrl ?? null} />
287
- <span className={cn("flex flex-1 flex-col gap-2.5", lead ? "p-5 @[36rem]:p-7" : "p-5")}>
288
- <span className="flex items-center gap-2 text-xs font-medium text-muted-foreground" data-feed-source>
289
- <SourceMark host={host} />
290
- <span className="truncate">{site}</span>
291
- </span>
292
- <span className={cn("font-bold leading-[1.15] tracking-tight text-foreground", lead ? "line-clamp-3 text-2xl @[36rem]:text-3xl @[60rem]:text-4xl" : "line-clamp-3 text-xl")} data-feed-title id={titleId}>
293
- {title}
294
- </span>
295
- {showDek ? <span className={cn("text-muted-foreground", lead ? "line-clamp-3 text-base" : "line-clamp-2 text-sm")} data-feed-dek>{dek}</span> : null}
296
- <span className="mt-auto flex flex-wrap items-center gap-x-2 gap-y-1 pt-1 text-xs text-muted-foreground">
297
- <span>
298
- {age ? <time dateTime={new Date(time ?? now).toISOString()} title={new Date(time ?? now).toLocaleString()}>{age}</time> : null}
299
- {age && host ? <span aria-hidden="true"> · </span> : null}
300
- {host}
301
- </span>
302
- {capture ? <CaptureBadge status={capture} /> : null}
303
- {messageCount > 0 ? (
304
- <span aria-label={messageCountLabel(messageCount)} className="inline-flex items-center gap-1 tabular-nums" data-feed-message-count={messageCount} role="img">
305
- <MessageSquareIcon aria-hidden="true" className="size-3.5" />
306
- {messageCount}
307
- </span>
308
- ) : null}
309
- {isAutoAccepted(reference) ? <AutoAcceptedBadge actor={reference.curationStatusUpdatedBy} reason={reference.curationStatusReason} /> : null}
310
- </span>
311
- </span>
338
+ <ReferenceCardHeader capture={capture} lead={lead} messageCount={messageCount} now={now} preview={preview} reference={reference} titleId={titleId} />
312
339
  </button>
313
340
 
314
341
  <div className="relative bg-[var(--feed-footer)] px-4 pb-4 pt-3" data-feed-actions>