/** * Channels Page * Manage messaging channel connections */ import { useEffect } from 'react'; import { Plus, Radio, RefreshCw, Settings } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { useChannelsStore } from '@/stores/channels'; import { StatusBadge } from '@/components/common/StatusBadge'; import { LoadingSpinner } from '@/components/common/LoadingSpinner'; import { CHANNEL_ICONS, CHANNEL_NAMES, type ChannelType } from '@/types/channel'; export function Channels() { const { channels, loading, error, fetchChannels, connectChannel, disconnectChannel } = useChannelsStore(); // Fetch channels on mount useEffect(() => { fetchChannels(); }, [fetchChannels]); // Supported channel types for adding const supportedTypes: ChannelType[] = ['whatsapp', 'telegram', 'discord', 'slack']; if (loading) { return (
); } return (
{/* Header */}

Channels

Connect and manage your messaging channels

{/* Error Display */} {error && ( {error} )} {/* Channels Grid */} {channels.length === 0 ? (

No channels configured

Connect a messaging channel to start using ClawX

) : (
{channels.map((channel) => (
{CHANNEL_ICONS[channel.type]}
{channel.name} {CHANNEL_NAMES[channel.type]}
{channel.lastActivity && (

Last activity: {new Date(channel.lastActivity).toLocaleString()}

)} {channel.error && (

{channel.error}

)}
{channel.status === 'connected' ? ( ) : ( )}
))}
)} {/* Add Channel Types */} Supported Channels Click on a channel type to add it
{supportedTypes.map((type) => ( ))}
); } export default Channels;