Merge pull request #560 from danditomaso/fix/node-detail-use-message-store
fix: update node details page to use message store
This commit is contained in:
@@ -27,15 +27,15 @@ import {
|
||||
TooltipProvider,
|
||||
TooltipTrigger,
|
||||
} from "@radix-ui/react-tooltip";
|
||||
import { useAppStore } from "@core/stores/appStore.ts";
|
||||
import { useDevice } from "@core/stores/deviceStore.ts";
|
||||
import { MessageType, useMessageStore } from "@core/stores/messageStore.ts";
|
||||
|
||||
export interface NodeDetailProps {
|
||||
node: ProtobufType.Mesh.NodeInfo;
|
||||
}
|
||||
|
||||
export const NodeDetail = ({ node }: NodeDetailProps) => {
|
||||
const { setChatType, setActiveChat } = useAppStore();
|
||||
const { setChatType, setActiveChat } = useMessageStore();
|
||||
const { setActivePage } = useDevice();
|
||||
const name = node.user?.longName || `!${numberToHexUnpadded(node.num)}`;
|
||||
const shortName = node.user?.shortName ?? "UNK";
|
||||
@@ -44,7 +44,7 @@ export const NodeDetail = ({ node }: NodeDetailProps) => {
|
||||
Protobuf.Mesh.HardwareModel[hwModel]?.replaceAll("_", " ") ?? `${hwModel}`;
|
||||
|
||||
function handleDirectMessage() {
|
||||
setChatType("direct");
|
||||
setChatType(MessageType.Direct);
|
||||
setActiveChat(node.num);
|
||||
setActivePage("messages");
|
||||
}
|
||||
@@ -84,7 +84,6 @@ export const NodeDetail = ({ node }: NodeDetailProps) => {
|
||||
size={14}
|
||||
onClick={handleDirectMessage}
|
||||
className="cursor-pointer hover:text-blue-500"
|
||||
title="Send Message"
|
||||
/>
|
||||
</TooltipTrigger>
|
||||
<TooltipPortal>
|
||||
|
||||
@@ -77,7 +77,7 @@ export const MessagesPage = () => {
|
||||
key={otherNode.num}
|
||||
label={otherNode.user?.longName ??
|
||||
`!${numberToHexUnpadded(otherNode.num)}`}
|
||||
active={activeChat === otherNode.num && chatType === "direct"}
|
||||
active={activeChat === otherNode.num && chatType === MessageType.Direct}
|
||||
onClick={() => {
|
||||
setChatType(MessageType.Direct);
|
||||
setActiveChat(otherNode.num);
|
||||
@@ -153,7 +153,6 @@ export const MessagesPage = () => {
|
||||
|
||||
<div className="shrink-0 p-4 w-full dark:bg-slate-900">
|
||||
<MessageInput
|
||||
from={activeChat}
|
||||
to={currentChat.type === MessageType.Direct ? activeChat : MessageType.Broadcast}
|
||||
channel={currentChat.type === MessageType.Direct ? Types.ChannelNumber.Primary : currentChat.id}
|
||||
maxBytes={200}
|
||||
|
||||
Reference in New Issue
Block a user