diff --git a/src/fidgets/farcaster/components/CastRow.tsx b/src/fidgets/farcaster/components/CastRow.tsx index e0764290..b7087c25 100644 --- a/src/fidgets/farcaster/components/CastRow.tsx +++ b/src/fidgets/farcaster/components/CastRow.tsx @@ -1,4 +1,4 @@ -import React, { useState, useCallback } from "react"; +import React, { useState, useCallback, useMemo } from "react"; import { Properties } from "csstype"; import { mergeClasses as classNames } from "@/common/lib/utils/mergeClasses"; import { @@ -64,10 +64,11 @@ interface CastRowProps { }; }; onSelect?: () => void; - showChannel?: boolean; - isThreadView?: boolean; - isDetailView?: boolean; + isFocused?: boolean; isEmbed?: boolean; + isReply?: boolean; + hasReplies?: boolean; + showChannel?: boolean; hideReactions?: boolean; } @@ -90,15 +91,18 @@ const PriorityLink = ({ children, href, ...props }) => { ); }; -const CastLeftAvatar = ({ isEmbed, cast }) => { - if (isEmbed) return null; - +const CastAuthorAvatar = ({ cast, className }) => { return ( - + { > {map(cast.embeds, (embed) => { - if (isEmbedUrl(embed)) + if (isEmbedUrl(embed)) { return renderEmbedForUrl({ ...embed, key: embed.url }); + } return renderEmbedForUrl({ castId: embed.cast_id, key: embed.cast_id, @@ -133,6 +138,78 @@ const CastEmbeds = ({ cast }) => { ); }; +const CastAttributionHeader = ({ + cast, + inline, + avatar, +}: { + cast: CastWithInteractions; + inline: boolean; + avatar: boolean; +}) => { + return ( +
+ {avatar && ( + + )} +
+ + +
+
+ ); +}; + +const CastAttributionPrimary = ({ cast }) => { + if (!cast?.author?.display_name) return null; + + return ( +
+ + {cast.author.display_name} + + {cast?.author?.power_badge && ( + power badge + )} +
+ ); +}; + +const CastAttributionSecondary = ({ cast }) => { + const relativeDateString = useMemo(() => { + return cast?.timestamp ? formatTimeAgo(cast.timestamp) : ""; + }, [cast?.timestamp]); + + return ( +
+ @{cast.author.username} + {relativeDateString && ( + <> + · + {relativeDateString} + + )} +
+ ); +}; + const CastBody = ({ cast, channel, @@ -147,17 +224,12 @@ const CastBody = ({ }) => { return (
- {cast.text && (

@@ -179,41 +251,9 @@ const CastAuthorAttribution = ({ showChannel, isEmbed, }) => { - const timeAgoStr = formatTimeAgo(cast.timestamp); - return (

- - {isEmbed && ( - - )} - {cast.author.display_name} - - {cast.author.power_badge && ( - power badge - )} - - @{cast.author.username} - · -
- {"timestamp" in cast && cast.timestamp && ( - {timeAgoStr} - )} -
- {showChannel && channel && (