'use client'; /** * RightPanel — collapsible right-side panel with tabbed content. * * Displays three tabs: Notifications, Activities, Contacts. * Slides in/out from the right edge with a CSS transform transition (≤300ms). * On desktop (≥1024px): fixed panel, 300px wide. * On mobile (<1024px): full-height overlay with semi-transparent backdrop. * * State is managed by useRightPanelStore (Zustand). * * Requirements: 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8 */ import { useRightPanelStore, type RightPanelTab } from '@/lib/stores/right-panel-store'; // ── Placeholder data types ────────────────────────────────────────────────── interface NotificationItem { id: string; message: string; timestamp: string; read: boolean; } interface ActivityItem { id: string; description: string; timestamp: string; user: string; } interface ContactItem { id: string; name: string; status: 'online' | 'offline' | 'away'; initials: string; } // ── Placeholder data ──────────────────────────────────────────────────────── const notifications: NotificationItem[] = [ { id: '1', message: 'New royalty payment received from Universal Music', timestamp: '2 min ago', read: false }, { id: '2', message: 'Contract #1042 has been approved', timestamp: '15 min ago', read: false }, { id: '3', message: 'Monthly income report is ready', timestamp: '1 hour ago', read: true }, { id: '4', message: 'New composer added to catalog', timestamp: '3 hours ago', read: true }, { id: '5', message: 'System maintenance scheduled for tonight', timestamp: '5 hours ago', read: true }, ]; const activities: ActivityItem[] = [ { id: '1', description: 'Updated income records for Q4', timestamp: '5 min ago', user: 'Sarah K.' }, { id: '2', description: 'Approved 3 pending contracts', timestamp: '30 min ago', user: 'Mike R.' }, { id: '3', description: 'Generated statement for December', timestamp: '2 hours ago', user: 'Anna L.' }, { id: '4', description: 'Added new work "Symphony No. 5"', timestamp: '4 hours ago', user: 'James P.' }, { id: '5', description: 'Exported audit log for review', timestamp: '6 hours ago', user: 'Sarah K.' }, ]; const contacts: ContactItem[] = [ { id: '1', name: 'Sarah Kim', status: 'online', initials: 'SK' }, { id: '2', name: 'Mike Roberts', status: 'online', initials: 'MR' }, { id: '3', name: 'Anna Lee', status: 'away', initials: 'AL' }, { id: '4', name: 'James Park', status: 'offline', initials: 'JP' }, { id: '5', name: 'Emily Chen', status: 'online', initials: 'EC' }, { id: '6', name: 'David Wilson', status: 'offline', initials: 'DW' }, ]; // ── Tab configuration ─────────────────────────────────────────────────────── const tabs: { key: RightPanelTab; label: string }[] = [ { key: 'notifications', label: 'Notifications' }, { key: 'activities', label: 'Activities' }, { key: 'contacts', label: 'Contacts' }, ]; // ── Sub-components ────────────────────────────────────────────────────────── function NotificationsTab() { return (
{notifications.map((item) => (

{item.message}

{item.timestamp}
))}
); } function ActivitiesTab() { return (
{activities.map((item) => (

{item.description}

{item.user} {item.timestamp}
))}
); } function ContactsTab() { return (
{contacts.map((item) => (
{/* Avatar */}
{item.initials}
{/* Status indicator */}
{/* Name and status */}

{item.name}

{item.status}

))}
); } // ── Main component ────────────────────────────────────────────────────────── export default function RightPanel() { const isOpen = useRightPanelStore((s) => s.isOpen); const activeTab = useRightPanelStore((s) => s.activeTab); const close = useRightPanelStore((s) => s.close); const setActiveTab = useRightPanelStore((s) => s.setActiveTab); return ( <> {/* Backdrop — visible only on mobile (<1024px) when panel is open */} {isOpen && (