import Enclave from "@/app/app";
import { Channel, ChannelKind } from "@/app/protocol";
import { ChevronDown, ChevronUp, HashIcon, SettingsIcon } from "lucide-react";
import { useState } from "react";
import { Card, CardTitle } from "../ui/card";
import { Avatar, AvatarImage } from "../ui/avatar";
import { Button } from "../ui/button";
export function ChannelIcon({ kind }: { kind: ChannelKind["kind"] }) {
switch (kind) {
case "text":
return ;
default:
return null;
}
}
export function RenderCategory({ channel }: { channel: Channel }) {
if (channel.kind !== "category") return null;
const [open, setOpen] = useState(true);
return (
setOpen((v) => !v)}
>
{channel.name}
{open ? (
) : (
)}
{open && (
)}
);
}
export function RenderChannels({ channels }: { channels: Channel[] }) {
return channels.map((channel) =>
channel.kind === "category" ? (
) : (
{channel.name}
),
);
}
export default function Sidebar({
appRef,
}: {
appRef: React.RefObject;
}) {
return (
{appRef.current?.server?.meta && (
<>
{appRef.current.server.meta.name}
>
)}
);
}