rename dm components for concistency

This commit is contained in:
sam committed 2025-10-19 14:12:29 +07:00
1 parent cb231c7770
commit 71b9c9d380
4 files changed
+13 -13

No files matched your search

@@ -14,7 +14,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/comp
import { ArrowLeft, Send, Loader2, AlertTriangle } from 'lucide-react'; import { ArrowLeft, Send, Loader2, AlertTriangle } from 'lucide-react';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
interface ChatAreaProps { interface DMChatAreaProps {
pubkey: string | null; pubkey: string | null;
onBack?: () => void; onBack?: () => void;
className?: string; className?: string;
@@ -147,7 +147,7 @@ const EmptyState = ({ isLoading }: { isLoading: boolean }) => {
); );
}; };
export const ChatArea = ({ pubkey, onBack, className }: ChatAreaProps) => { export const DMChatArea = ({ pubkey, onBack, className }: DMChatAreaProps) => {
const { user } = useCurrentUser(); const { user } = useCurrentUser();
const { sendMessage, protocolMode, isLoading } = useDMContext(); const { sendMessage, protocolMode, isLoading } = useDMContext();
const { messages } = useConversationMessages(pubkey || ''); const { messages } = useConversationMessages(pubkey || '');
@@ -11,7 +11,7 @@ import { Skeleton } from '@/components/ui/skeleton';
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'; import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
import { cn } from '@/lib/utils'; import { cn } from '@/lib/utils';
interface ConversationListProps { interface DMConversationListProps {
selectedPubkey: string | null; selectedPubkey: string | null;
onSelectConversation: (pubkey: string) => void; onSelectConversation: (pubkey: string) => void;
className?: string; className?: string;
@@ -126,12 +126,12 @@ const ConversationListSkeleton = () => {
); );
}; };
export const ConversationList = ({ export const DMConversationList = ({
selectedPubkey, selectedPubkey,
onSelectConversation, onSelectConversation,
className, className,
onStatusClick onStatusClick
}: ConversationListProps) => { }: DMConversationListProps) => {
const { conversations, isLoading } = useDMContext(); const { conversations, isLoading } = useDMContext();
const [activeTab, setActiveTab] = useState<'known' | 'requests'>('known'); const [activeTab, setActiveTab] = useState<'known' | 'requests'>('known');
@@ -1,6 +1,6 @@
import { useState } from 'react'; import { useState } from 'react';
import { ConversationList } from '@/components/dm/ConversationList'; import { DMConversationList } from '@/components/dm/DMConversationList';
import { ChatArea } from '@/components/dm/ChatArea'; import { DMChatArea } from '@/components/dm/DMChatArea';
import { DMStatusInfo } from '@/components/dm/DMStatusInfo'; import { DMStatusInfo } from '@/components/dm/DMStatusInfo';
import { useDMContext } from '@/contexts/DMContext'; import { useDMContext } from '@/contexts/DMContext';
import { useIsMobile } from '@/hooks/useIsMobile'; import { useIsMobile } from '@/hooks/useIsMobile';
@@ -13,11 +13,11 @@ import {
DialogTitle, DialogTitle,
} from '@/components/ui/dialog'; } from '@/components/ui/dialog';
interface MessagingInterfaceProps { interface DMMessagingInterfaceProps {
className?: string; className?: string;
} }
export const MessagingInterface = ({ className }: MessagingInterfaceProps) => { export const DMMessagingInterface = ({ className }: DMMessagingInterfaceProps) => {
const [selectedPubkey, setSelectedPubkey] = useState<string | null>(null); const [selectedPubkey, setSelectedPubkey] = useState<string | null>(null);
const [statusModalOpen, setStatusModalOpen] = useState(false); const [statusModalOpen, setStatusModalOpen] = useState(false);
const isMobile = useIsMobile(); const isMobile = useIsMobile();
@@ -57,7 +57,7 @@ export const MessagingInterface = ({ className }: MessagingInterfaceProps) => {
isMobile && !showConversationList && "hidden", isMobile && !showConversationList && "hidden",
isMobile && showConversationList && "w-full" isMobile && showConversationList && "w-full"
)}> )}>
<ConversationList <DMConversationList
selectedPubkey={selectedPubkey} selectedPubkey={selectedPubkey}
onSelectConversation={handleSelectConversation} onSelectConversation={handleSelectConversation}
className="h-full" className="h-full"
@@ -71,7 +71,7 @@ export const MessagingInterface = ({ className }: MessagingInterfaceProps) => {
isMobile && !showChatArea && "hidden", isMobile && !showChatArea && "hidden",
isMobile && showChatArea && "w-full" isMobile && showChatArea && "w-full"
)}> )}>
<ChatArea <DMChatArea
pubkey={selectedPubkey} pubkey={selectedPubkey}
onBack={isMobile ? handleBack : undefined} onBack={isMobile ? handleBack : undefined}
className="h-full" className="h-full"
+2 -2
View File
@@ -1,5 +1,5 @@
import { useSeoMeta } from '@unhead/react'; import { useSeoMeta } from '@unhead/react';
import { MessagingInterface } from '@/components/dm/MessagingInterface'; import { DMMessagingInterface } from '@/components/dm/DMMessagingInterface';
const Messages = () => { const Messages = () => {
useSeoMeta({ useSeoMeta({
@@ -10,7 +10,7 @@ const Messages = () => {
return ( return (
<div className="min-h-screen bg-background"> <div className="min-h-screen bg-background">
<div className="container mx-auto p-4 h-screen flex flex-col"> <div className="container mx-auto p-4 h-screen flex flex-col">
<MessagingInterface className="flex-1" /> <DMMessagingInterface className="flex-1" />
</div> </div>
</div> </div>
); );