Iframe com

This commit is contained in:
2025-12-10 21:55:20 +01:00
parent acb8c34df6
commit e585aa9458
7 changed files with 102 additions and 10 deletions
+60
View File
@@ -0,0 +1,60 @@
import { Channel, Message, Server } from "@/types/types";
import MessageBox from "./MessageBox";
import App from "@/types/app";
import React, { Ref, useEffect, useRef } from "react";
import PluginChannel from "./PluginChannel";
export default function ChannelView({
app,
messages,
ip,
serverRef,
}: {
app: App;
messages: Record<string, Message[]>;
ip: string;
serverRef: React.RefObject<WebSocket | null>;
}) {
if (!app.currentChannel)
return (
<div className="h-svh w-full max-h-svh flex flex-col pb-5 pl-5 gap-5" />
);
switch (app.currentChannel.kind) {
case "text":
return (
<MessageBox
app={app}
channelName={app.currentChannel.name}
messages={
messages[ip]?.filter(
(m) => m.channel_id === app.currentChannel?.id
) || []
}
sendMessage={(message) => {
serverRef.current?.send(
JSON.stringify({
type: "send_message",
params: {
channel_id: app.currentChannel?.id,
contents: message,
},
})
);
}}
/>
);
case "voice":
return null;
default:
return (
<PluginChannel
app={app}
messages={messages}
ip={ip}
serverRef={serverRef}
/>
);
}
}