minor changes and biome fixes
This commit is contained in:
+24
-24
@@ -3,17 +3,17 @@ import { PageLayout } from "@components/PageLayout.js";
|
||||
import { Sidebar } from "@components/Sidebar.js";
|
||||
import { SidebarSection } from "@components/UI/Sidebar/SidebarSection.js";
|
||||
import { SidebarButton } from "@components/UI/Sidebar/sidebarButton.js";
|
||||
import { useToast } from "@core/hooks/useToast.js";
|
||||
import { useDevice } from "@core/stores/deviceStore.js";
|
||||
import { Hashicon } from "@emeraldpay/hashicon-react";
|
||||
import { Protobuf, Types } from "@meshtastic/js";
|
||||
import { getChannelName } from "@pages/Channels.js";
|
||||
import { HashIcon, WaypointsIcon } from "lucide-react";
|
||||
import { useState } from "react";
|
||||
import { useToast } from "@core/hooks/useToast.js";
|
||||
|
||||
|
||||
export const MessagesPage = (): JSX.Element => {
|
||||
const { channels, nodes, hardware, messages, traceroutes, connection } = useDevice();
|
||||
const { channels, nodes, hardware, messages, traceroutes, connection } =
|
||||
useDevice();
|
||||
const [chatType, setChatType] =
|
||||
useState<Types.PacketDestination>("broadcast");
|
||||
const [activeChat, setActiveChat] = useState<number>(
|
||||
@@ -29,7 +29,6 @@ export const MessagesPage = (): JSX.Element => {
|
||||
const currentChannel = channels.get(activeChat);
|
||||
const { toast } = useToast();
|
||||
|
||||
|
||||
return (
|
||||
<>
|
||||
<Sidebar>
|
||||
@@ -76,26 +75,27 @@ export const MessagesPage = (): JSX.Element => {
|
||||
? nodes.get(activeChat)?.user?.longName ?? "Unknown"
|
||||
: "Loading..."
|
||||
}`}
|
||||
actions={
|
||||
chatType === "direct"
|
||||
? [
|
||||
{
|
||||
icon: WaypointsIcon,
|
||||
async onClick() {
|
||||
if (nodes.get(activeChat)?.num === undefined) return;
|
||||
toast({
|
||||
title: "Sending Traceroute, please wait..."
|
||||
})
|
||||
await connection?.traceRoute(nodes.get(activeChat)?.num!).then(() =>
|
||||
toast({
|
||||
title: `Traceroute sent.`,
|
||||
}),
|
||||
);
|
||||
},
|
||||
},
|
||||
]
|
||||
: []
|
||||
}
|
||||
actions={
|
||||
chatType === "direct"
|
||||
? [
|
||||
{
|
||||
icon: WaypointsIcon,
|
||||
async onClick() {
|
||||
const targetNode = nodes.get(activeChat)?.num;
|
||||
if (targetNode === undefined) return;
|
||||
toast({
|
||||
title: "Sending Traceroute, please wait...",
|
||||
});
|
||||
await connection?.traceRoute(targetNode).then(() =>
|
||||
toast({
|
||||
title: "Traceroute sent.",
|
||||
}),
|
||||
);
|
||||
},
|
||||
},
|
||||
]
|
||||
: []
|
||||
}
|
||||
>
|
||||
{allChannels.map(
|
||||
(channel) =>
|
||||
|
||||
Reference in New Issue
Block a user