mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-06 00:37:23 +00:00
rearrange header
This commit is contained in:
1 parent
9d3ead4428
commit
dcffee03af
2 files changed
+30
-33
No files matched your search
@@ -1,9 +1,10 @@
|
|||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { AlertTriangle } from 'lucide-react';
|
import { AlertTriangle, Info } from 'lucide-react';
|
||||||
import { useDMContext } from '@/contexts/DMContext';
|
import { useDMContext } from '@/contexts/DMContext';
|
||||||
import { useAuthor } from '@/hooks/useAuthor';
|
import { useAuthor } from '@/hooks/useAuthor';
|
||||||
import { genUserName } from '@/lib/genUserName';
|
import { genUserName } from '@/lib/genUserName';
|
||||||
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
|
||||||
|
import { Button } from '@/components/ui/button';
|
||||||
import { Card } from '@/components/ui/card';
|
import { Card } from '@/components/ui/card';
|
||||||
import { ScrollArea } from '@/components/ui/scroll-area';
|
import { ScrollArea } from '@/components/ui/scroll-area';
|
||||||
import { Skeleton } from '@/components/ui/skeleton';
|
import { Skeleton } from '@/components/ui/skeleton';
|
||||||
@@ -14,6 +15,7 @@ interface ConversationListProps {
|
|||||||
selectedPubkey: string | null;
|
selectedPubkey: string | null;
|
||||||
onSelectConversation: (pubkey: string) => void;
|
onSelectConversation: (pubkey: string) => void;
|
||||||
className?: string;
|
className?: string;
|
||||||
|
onStatusClick?: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ConversationItem = ({
|
const ConversationItem = ({
|
||||||
@@ -127,7 +129,8 @@ const ConversationListSkeleton = () => {
|
|||||||
export const ConversationList = ({
|
export const ConversationList = ({
|
||||||
selectedPubkey,
|
selectedPubkey,
|
||||||
onSelectConversation,
|
onSelectConversation,
|
||||||
className
|
className,
|
||||||
|
onStatusClick
|
||||||
}: ConversationListProps) => {
|
}: ConversationListProps) => {
|
||||||
const { conversations, isLoading } = useDMContext();
|
const { conversations, isLoading } = useDMContext();
|
||||||
const [activeTab, setActiveTab] = useState<'known' | 'requests'>('known');
|
const [activeTab, setActiveTab] = useState<'known' | 'requests'>('known');
|
||||||
@@ -164,8 +167,19 @@ export const ConversationList = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className={cn("h-full flex flex-col overflow-hidden", className)}>
|
<Card className={cn("h-full flex flex-col overflow-hidden", className)}>
|
||||||
<div className="p-4 border-b flex-shrink-0">
|
<div className="p-4 border-b flex-shrink-0 flex items-center justify-between">
|
||||||
<h2 className="font-semibold text-lg">Messages</h2>
|
<h2 className="font-semibold text-lg">Messages</h2>
|
||||||
|
{onStatusClick && (
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
className="h-8 w-8"
|
||||||
|
onClick={onStatusClick}
|
||||||
|
aria-label="View messaging status"
|
||||||
|
>
|
||||||
|
<Info className="h-4 w-4" />
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Tab buttons */}
|
{/* Tab buttons */}
|
||||||
|
|||||||
+13
-30
@@ -1,5 +1,4 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { Info } from 'lucide-react';
|
|
||||||
import { useSeoMeta } from '@unhead/react';
|
import { useSeoMeta } from '@unhead/react';
|
||||||
import { ConversationList } from '@/components/dm/ConversationList';
|
import { ConversationList } from '@/components/dm/ConversationList';
|
||||||
import { ChatArea } from '@/components/dm/ChatArea';
|
import { ChatArea } from '@/components/dm/ChatArea';
|
||||||
@@ -13,9 +12,7 @@ import {
|
|||||||
DialogDescription,
|
DialogDescription,
|
||||||
DialogHeader,
|
DialogHeader,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
DialogTrigger,
|
|
||||||
} from '@/components/ui/dialog';
|
} from '@/components/ui/dialog';
|
||||||
import { Button } from '@/components/ui/button';
|
|
||||||
|
|
||||||
const Messages = () => {
|
const Messages = () => {
|
||||||
const [selectedPubkey, setSelectedPubkey] = useState<string | null>(null);
|
const [selectedPubkey, setSelectedPubkey] = useState<string | null>(null);
|
||||||
@@ -43,33 +40,18 @@ 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">
|
||||||
{/* Header with status button */}
|
{/* Status Modal */}
|
||||||
<div className="flex items-center justify-between mb-4">
|
<Dialog open={statusModalOpen} onOpenChange={setStatusModalOpen}>
|
||||||
<h1 className="text-2xl font-bold">Messages</h1>
|
<DialogContent className="max-w-md">
|
||||||
|
<DialogHeader>
|
||||||
{/* Status Modal */}
|
<DialogTitle>Messaging Status</DialogTitle>
|
||||||
<Dialog open={statusModalOpen} onOpenChange={setStatusModalOpen}>
|
<DialogDescription>
|
||||||
<DialogTrigger asChild>
|
View loading status, cache info, and connection details
|
||||||
<Button
|
</DialogDescription>
|
||||||
variant="ghost"
|
</DialogHeader>
|
||||||
size="icon"
|
<DMStatusInfo clearCacheAndReload={clearCacheAndReload} />
|
||||||
className="h-9 w-9"
|
</DialogContent>
|
||||||
aria-label="View messaging status"
|
</Dialog>
|
||||||
>
|
|
||||||
<Info className="h-4 w-4" />
|
|
||||||
</Button>
|
|
||||||
</DialogTrigger>
|
|
||||||
<DialogContent className="max-w-md">
|
|
||||||
<DialogHeader>
|
|
||||||
<DialogTitle>Messaging Status</DialogTitle>
|
|
||||||
<DialogDescription>
|
|
||||||
View loading status, cache info, and connection details
|
|
||||||
</DialogDescription>
|
|
||||||
</DialogHeader>
|
|
||||||
<DMStatusInfo clearCacheAndReload={clearCacheAndReload} />
|
|
||||||
</DialogContent>
|
|
||||||
</Dialog>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex-1 flex gap-4 overflow-hidden">
|
<div className="flex-1 flex gap-4 overflow-hidden">
|
||||||
{/* Conversation List - Left Sidebar */}
|
{/* Conversation List - Left Sidebar */}
|
||||||
@@ -82,6 +64,7 @@ const Messages = () => {
|
|||||||
selectedPubkey={selectedPubkey}
|
selectedPubkey={selectedPubkey}
|
||||||
onSelectConversation={handleSelectConversation}
|
onSelectConversation={handleSelectConversation}
|
||||||
className="h-full"
|
className="h-full"
|
||||||
|
onStatusClick={() => setStatusModalOpen(true)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user