mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-06-10 14:48:48 +02:00
fix: use RichText for zap comments and remove arrow in chat
- Use RichText with zap request event for zap comments (renders emoji tags) - Remove the arrow (→) between zapper and recipient in zap messages
This commit is contained in:
@@ -3,6 +3,7 @@ import { use$ } from "applesauce-react/hooks";
|
|||||||
import { from } from "rxjs";
|
import { from } from "rxjs";
|
||||||
import { Virtuoso, VirtuosoHandle } from "react-virtuoso";
|
import { Virtuoso, VirtuosoHandle } from "react-virtuoso";
|
||||||
import { Reply, Zap } from "lucide-react";
|
import { Reply, Zap } from "lucide-react";
|
||||||
|
import { getZapRequest } from "applesauce-common/helpers/zap";
|
||||||
import accountManager from "@/services/accounts";
|
import accountManager from "@/services/accounts";
|
||||||
import eventStore from "@/services/event-store";
|
import eventStore from "@/services/event-store";
|
||||||
import type {
|
import type {
|
||||||
@@ -175,6 +176,8 @@ const MessageItem = memo(function MessageItem({
|
|||||||
if (message.type === "zap") {
|
if (message.type === "zap") {
|
||||||
const zapAmount = message.metadata?.zapAmount || 0;
|
const zapAmount = message.metadata?.zapAmount || 0;
|
||||||
const zapRecipient = message.metadata?.zapRecipient;
|
const zapRecipient = message.metadata?.zapRecipient;
|
||||||
|
// Get the zap request event for RichText (contains emoji tags)
|
||||||
|
const zapRequest = message.event ? getZapRequest(message.event) : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="px-3 py-1">
|
<div className="px-3 py-1">
|
||||||
@@ -196,17 +199,24 @@ const MessageItem = memo(function MessageItem({
|
|||||||
{zapAmount.toLocaleString("en", { notation: "compact" })}
|
{zapAmount.toLocaleString("en", { notation: "compact" })}
|
||||||
</span>
|
</span>
|
||||||
{zapRecipient && (
|
{zapRecipient && (
|
||||||
<>
|
<UserName pubkey={zapRecipient} className="text-sm" />
|
||||||
<span className="text-muted-foreground text-xs">→</span>
|
|
||||||
<UserName pubkey={zapRecipient} className="text-sm" />
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
<span className="text-xs text-muted-foreground ml-auto">
|
<span className="text-xs text-muted-foreground ml-auto">
|
||||||
<Timestamp timestamp={message.timestamp} />
|
<Timestamp timestamp={message.timestamp} />
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{message.content && (
|
{message.content && (
|
||||||
<div className="mt-1 text-sm break-words">{message.content}</div>
|
<div className="mt-1 text-sm break-words">
|
||||||
|
{zapRequest ? (
|
||||||
|
<RichText
|
||||||
|
event={zapRequest}
|
||||||
|
className="text-sm leading-tight"
|
||||||
|
options={{ showMedia: false, showEventEmbeds: false }}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
message.content
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user