Server functionality

This commit is contained in:
2025-10-31 15:22:14 +01:00
parent bee5b91fef
commit f123adb15f
5 changed files with 67 additions and 26 deletions
+1 -1
View File
@@ -78,7 +78,7 @@ export default function AppLayout({
<div className="flex-1 min-w-0 flex flex-col bg-sidebar">
<div className="flex-1 min-h-0">
{server ? (
<SidebarChannels server={server} />
<SidebarChannels server={server} app={app} />
) : (
<SidebarDMs app={app} />
)}
+17 -4
View File
@@ -3,6 +3,7 @@ import { ScrollArea } from "../ui/scroll-area";
import { Server, Channel } from "@/types/types";
import { Card } from "../ui/card";
import { HashIcon, Volume2Icon } from "lucide-react";
import App from "@/types/app";
export function ChannelIcon({ kind }: { kind: "text" | "voice" }) {
switch (kind) {
@@ -15,16 +16,28 @@ export function ChannelIcon({ kind }: { kind: "text" | "voice" }) {
}
}
export function ChannelItem({ channel }: { channel: Channel }) {
export function ChannelItem({ channel, app }: { channel: Channel; app: App }) {
return (
<Card className="p-2 flex items-center gap-2 cursor-pointer hover:bg-accent">
<Card
className="p-2 flex flex-row px-3 items-center gap-2 cursor-pointer hover:bg-accent"
onClick={() => {
app.setCurrentChannel(channel);
app.setSidebarOpen(false);
}}
>
<ChannelIcon kind={channel.kind} />
<span className="text-sm font-medium">{channel.name}</span>
</Card>
);
}
export default function SidebarChannels({ server }: { server: Server }) {
export default function SidebarChannels({
server,
app,
}: {
server: Server;
app: App;
}) {
return (
<div className="w-full flex flex-col bg-sidebar">
<div className="p-3 border-b flex items-center gap-2">
@@ -33,7 +46,7 @@ export default function SidebarChannels({ server }: { server: Server }) {
<ScrollArea className="flex-1">
<div className="p-2 flex flex-col gap-2">
{server.channels.map((channel: Channel) => (
<ChannelItem key={channel.id} channel={channel} />
<ChannelItem key={channel.id} channel={channel} app={app} />
))}
</div>
</ScrollArea>