This commit is contained in:
Dan Ditomaso
2025-03-24 15:37:51 -04:00
parent 5a142e671d
commit 0d6c5878fc
12 changed files with 484 additions and 3727 deletions
+7 -6
View File
@@ -1,4 +1,3 @@
import { useAppStore } from "../core/stores/appStore.ts";
import { ChannelChat } from "@components/PageComponents/Messages/ChannelChat.tsx";
import { PageLayout } from "@components/PageLayout.tsx";
import { Sidebar } from "@components/Sidebar.tsx";
@@ -14,11 +13,14 @@ import { HashIcon, LockIcon, LockOpenIcon } from "lucide-react";
import { useState } from "react";
import { MessageInput } from "@components/PageComponents/Messages/MessageInput.tsx";
import { cn } from "@core/utils/cn.ts";
import { useMessageStore } from "@core/stores/messageStore.ts";
export const MessagesPage = () => {
const { channels, nodes, hardware, messages, hasNodeError } = useDevice();
const { activeChat, chatType, setActiveChat, setChatType } = useAppStore();
const { channels, nodes, hardware, hasNodeError } = useDevice();
const { getMessages, setActiveChat, chatType, activeChat, setChatType } = useMessageStore()
const { toast } = useToast();
const [searchTerm, setSearchTerm] = useState<string>("");
const filteredNodes = Array.from(nodes.values()).filter((node) => {
if (node.num === hardware.myNodeNum) return false;
const nodeName = node.user?.longName ?? `!${numberToHexUnpadded(node.num)}`;
@@ -29,7 +31,6 @@ export const MessagesPage = () => {
(ch) => ch.role !== Protobuf.Channel.Channel_Role.DISABLED,
);
const currentChannel = channels.get(activeChat);
const { toast } = useToast();
const node = nodes.get(activeChat);
const nodeHex = node?.num ? numberToHexUnpadded(node.num) : "Unknown";
@@ -130,7 +131,7 @@ export const MessagesPage = () => {
<div className="flex-1 overflow-y-auto">
<ChannelChat
key={currentChannel.index}
messages={messages.broadcast.get(currentChannel.index)}
messages={getMessages('broadcast', currentChannel?.index)}
/>
</div>
</div>
@@ -141,7 +142,7 @@ export const MessagesPage = () => {
<div className="flex-1 overflow-y-auto">
<ChannelChat
key={node.num}
messages={messages.direct.get(node.num)}
messages={getMessages('direct', node?.num)}
/>
</div>
</div>