Skip to content

Commit 1205920

Browse files
committed
Add reaction history avatar link
1 parent 45ba32d commit 1205920

1 file changed

Lines changed: 30 additions & 21 deletions

File tree

src/entries/contentScript/components/ReactionsHistoryNotice.jsx

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ import { buildReactionFromUrl } from '~/common/pretty';
1616
function ReactionPreview({ reaction }) {
1717
const { t } = useTranslation();
1818

19-
const showAvatar = useMemo(() => reaction.from_info?.avatar_url && false, []);
20-
19+
const showAvatar = useMemo(() => reaction.from_info?.avatar_url, [reaction]);
2120
const showServiceIcon = useMemo(() => !showAvatar && reaction.from_info?.service, [showAvatar, reaction]);
2221

2322
return (
@@ -27,11 +26,17 @@ function ReactionPreview({ reaction }) {
2726
>
2827
<div>
2928
{showAvatar && (
30-
<img
31-
src={reaction.from_info.avatar_url}
32-
className="inline size-7 overflow-hidden rounded-full"
33-
alt={reaction.from_info.name}
34-
/>
29+
<a
30+
href={reaction.from_info?.service_external_url}
31+
target="_blank"
32+
rel="noreferrer"
33+
>
34+
<img
35+
src={reaction.from_info.avatar_url}
36+
className="inline size-7 overflow-hidden rounded-full"
37+
alt={reaction.from_info.name}
38+
/>
39+
</a>
3540
)}
3641
{showServiceIcon && (
3742
<ServiceIcon
@@ -180,31 +185,35 @@ function ReactionsHistoryNotice() {
180185
</>
181186
) : (
182187
<div className="flex flex-col gap-4 text-sm">
183-
{liveReactions.length > 0 && (
188+
{videoReactions.length > 0 && (
184189
<div>
185190
<div className="mb-2 font-bold">
186-
Live Reactions
191+
{t('words.videoReactions')}
187192
</div>
188193

189-
{liveReactions.map((reaction) => (
190-
<Fragment key={reaction.id}>
191-
<ReactionPreview reaction={reaction} />
192-
</Fragment>
193-
))}
194+
<div className="flex flex-col gap-1">
195+
{videoReactions.map((reaction) => (
196+
<Fragment key={reaction.id}>
197+
<ReactionPreview reaction={reaction} />
198+
</Fragment>
199+
))}
200+
</div>
194201
</div>
195202
)}
196203

197-
{videoReactions.length > 0 && (
204+
{liveReactions.length > 0 && (
198205
<div>
199206
<div className="mb-2 font-bold">
200-
{t('words.videoReactions')}
207+
Live Reactions
201208
</div>
202209

203-
{videoReactions.map((reaction) => (
204-
<Fragment key={reaction.id}>
205-
<ReactionPreview reaction={reaction} />
206-
</Fragment>
207-
))}
210+
<div className="flex flex-col gap-1">
211+
{liveReactions.map((reaction) => (
212+
<Fragment key={reaction.id}>
213+
<ReactionPreview reaction={reaction} />
214+
</Fragment>
215+
))}
216+
</div>
208217
</div>
209218
)}
210219
</div>

0 commit comments

Comments
 (0)