mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-05 16:33:36 +00:00
add warn to all nip4 messages
This commit is contained in:
1 parent
f37d86b8d3
commit
d8e2e62736
1 file changed
+19
-1
@@ -10,7 +10,8 @@ import { Card } from '@/components/ui/card';
|
|||||||
import { Textarea } from '@/components/ui/textarea';
|
import { Textarea } from '@/components/ui/textarea';
|
||||||
import { ScrollArea } from '@/components/ui/scroll-area';
|
import { ScrollArea } from '@/components/ui/scroll-area';
|
||||||
import { Badge } from '@/components/ui/badge';
|
import { Badge } from '@/components/ui/badge';
|
||||||
import { ArrowLeft, Send, Loader2 } from 'lucide-react';
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
|
||||||
|
import { ArrowLeft, Send, Loader2, AlertTriangle } from 'lucide-react';
|
||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
|
|
||||||
interface ChatAreaProps {
|
interface ChatAreaProps {
|
||||||
@@ -25,6 +26,7 @@ const MessageBubble = ({
|
|||||||
}: {
|
}: {
|
||||||
message: {
|
message: {
|
||||||
id: string;
|
id: string;
|
||||||
|
kind: number;
|
||||||
decryptedContent?: string;
|
decryptedContent?: string;
|
||||||
error?: string;
|
error?: string;
|
||||||
created_at: number;
|
created_at: number;
|
||||||
@@ -37,6 +39,8 @@ const MessageBubble = ({
|
|||||||
return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isNIP4Message = message.kind === 4;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn("flex mb-4", isFromCurrentUser ? "justify-end" : "justify-start")}>
|
<div className={cn("flex mb-4", isFromCurrentUser ? "justify-end" : "justify-start")}>
|
||||||
<div className={cn(
|
<div className={cn(
|
||||||
@@ -59,6 +63,20 @@ const MessageBubble = ({
|
|||||||
)}>
|
)}>
|
||||||
{formatTime(message.created_at)}
|
{formatTime(message.created_at)}
|
||||||
</span>
|
</span>
|
||||||
|
{isNIP4Message && (
|
||||||
|
<TooltipProvider>
|
||||||
|
<Tooltip>
|
||||||
|
<TooltipTrigger asChild>
|
||||||
|
<div className="flex-shrink-0">
|
||||||
|
<AlertTriangle className="h-3 w-3 text-yellow-600 dark:text-yellow-500" />
|
||||||
|
</div>
|
||||||
|
</TooltipTrigger>
|
||||||
|
<TooltipContent>
|
||||||
|
<p className="text-xs">Uses outdated NIP-04 encryption</p>
|
||||||
|
</TooltipContent>
|
||||||
|
</Tooltip>
|
||||||
|
</TooltipProvider>
|
||||||
|
)}
|
||||||
{message.isSending && (
|
{message.isSending && (
|
||||||
<Loader2 className="h-3 w-3 animate-spin opacity-70" />
|
<Loader2 className="h-3 w-3 animate-spin opacity-70" />
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in new issue
Block a user