+
+
{
}`}
>
{Types.DeviceStatusEnum[deviceStatus]}
-
+
) : (
-
+
)
}
- circle
/>
diff --git a/src/components/menu/buttons/MobileNavToggle.tsx b/src/components/menu/buttons/MobileNavToggle.tsx
index 19f5fe9d..6b63a71c 100644
--- a/src/components/menu/buttons/MobileNavToggle.tsx
+++ b/src/components/menu/buttons/MobileNavToggle.tsx
@@ -2,7 +2,7 @@ import React from 'react';
import { FiMenu } from 'react-icons/fi';
-import { Button } from '@components/generic/Button';
+import { IconButton } from '@app/components/generic/IconButton.jsx';
import { openMobileNav } from '@core/slices/appSlice';
import { useAppDispatch } from '../../../hooks/redux';
@@ -12,12 +12,11 @@ export const MobileNavToggle = (): JSX.Element => {
return (
- }
onClick={(): void => {
dispatch(openMobileNav());
}}
- circle
/>
);
diff --git a/src/components/menu/buttons/ThemeToggle.tsx b/src/components/menu/buttons/ThemeToggle.tsx
index 299617ad..164c7060 100644
--- a/src/components/menu/buttons/ThemeToggle.tsx
+++ b/src/components/menu/buttons/ThemeToggle.tsx
@@ -2,8 +2,8 @@ import React from 'react';
import { FiMoon, FiSun } from 'react-icons/fi';
+import { IconButton } from '@app/components/generic/IconButton.jsx';
import { useAppDispatch, useAppSelector } from '@app/hooks/redux';
-import { Button } from '@components/generic/Button';
import { setDarkModeEnabled } from '@core/slices/appSlice';
export const ThemeToggle = (): JSX.Element => {
@@ -11,7 +11,7 @@ export const ThemeToggle = (): JSX.Element => {
const darkMode = useAppSelector((state) => state.app.darkMode);
return (
-
@@ -19,7 +19,6 @@ export const ThemeToggle = (): JSX.Element => {
)
}
- circle
onClick={(): void => {
dispatch(setDarkModeEnabled(!darkMode));
}}
diff --git a/src/core/slices/meshtasticSlice.ts b/src/core/slices/meshtasticSlice.ts
index 79f644c7..d549ecc9 100644
--- a/src/core/slices/meshtasticSlice.ts
+++ b/src/core/slices/meshtasticSlice.ts
@@ -77,8 +77,6 @@ export const meshtasticSlice = createSlice({
},
addChannel: (state, action: PayloadAction
) => {
- console.log(action);
-
if (
state.channels.findIndex(
(channel) => channel.index === action.payload.index,
diff --git a/src/pages/Messages.tsx b/src/pages/Messages.tsx
index e229e271..5a3ef6a8 100644
--- a/src/pages/Messages.tsx
+++ b/src/pages/Messages.tsx
@@ -1,10 +1,10 @@
import React from 'react';
-import { FiHash, FiMap, FiUsers } from 'react-icons/fi';
+import { FiHash } from 'react-icons/fi';
+import { EnumSelect } from '@app/components/generic/form/EnumSelect.jsx';
import { Message } from '@components/chat/Message';
import { MessageBar } from '@components/chat/MessageBar';
-import { Button } from '@components/generic/Button';
import { Protobuf } from '@meshtastic/meshtasticjs';
import { useAppSelector } from '../hooks/redux';
@@ -14,25 +14,30 @@ export const Messages = (): JSX.Element => {
const nodes = useAppSelector((state) => state.meshtastic.nodes);
const channels = useAppSelector((state) => state.meshtastic.channels);
- const channelName = (): string => {
- const name =
- channels.find((channel) => channel.role === Protobuf.Channel_Role.PRIMARY)
- ?.settings?.name ?? 'Unknown';
-
- return name.length ? name : 'Default';
- };
-
return (
-
-
- {channelName()}
-
-
-
} circle />
-
-
} circle />
+
+
+
+ channel.role !== Protobuf.Channel_Role.DISABLED &&
+ channel.settings?.name !== 'admin',
+ )
+ .map((channel) => {
+ return {
+ name: channel.settings?.name.length
+ ? channel.settings.name
+ : channel.role === Protobuf.Channel_Role.PRIMARY
+ ? 'Primary'
+ : `CH: ${channel.index}`,
+ value: channel.index,
+ };
+ })}
+ small
+ />
diff --git a/src/pages/Nodes/Index.tsx b/src/pages/Nodes/Index.tsx
index b1b950d1..e5d3916e 100644
--- a/src/pages/Nodes/Index.tsx
+++ b/src/pages/Nodes/Index.tsx
@@ -3,9 +3,9 @@ import React from 'react';
import Avatar from 'boring-avatars';
import { FiXCircle } from 'react-icons/fi';
+import { IconButton } from '@app/components/generic/IconButton.jsx';
import { useBreakpoint } from '@app/hooks/breakpoint';
import { useAppSelector } from '@app/hooks/redux';
-import { Button } from '@components/generic/Button';
import { Drawer } from '@components/generic/Drawer';
import { SidebarItem } from '@components/generic/SidebarItem';
import { Tab } from '@headlessui/react';
@@ -36,9 +36,8 @@ export const Nodes = (): JSX.Element => {
Nodes
-
}
- circle
onClick={(): void => {
setNavOpen(false);
}}
diff --git a/src/pages/Nodes/Node.tsx b/src/pages/Nodes/Node.tsx
index d1f765cf..fd8b2560 100644
--- a/src/pages/Nodes/Node.tsx
+++ b/src/pages/Nodes/Node.tsx
@@ -5,9 +5,9 @@ import { FiMenu, FiTerminal } from 'react-icons/fi';
import { Card } from '@app/components/generic/Card';
import { Chart } from '@app/components/generic/Chart';
-import { Input } from '@app/components/generic/Input';
+import { Input } from '@app/components/generic/form/Input';
+import { IconButton } from '@app/components/generic/IconButton.jsx';
import { Toggle } from '@app/components/generic/Toggle';
-import { Button } from '@components/generic/Button';
import { PrimaryTemplate } from '@components/templates/PrimaryTemplate';
import type { Protobuf } from '@meshtastic/meshtasticjs';
@@ -23,12 +23,11 @@ export const Node = ({ navOpen, setNavOpen, node }: NodeProps): JSX.Element => {
title={node.user?.longName ?? node.num.toString()}
tagline="Node"
button={
-
}
onClick={(): void => {
setNavOpen(!navOpen);
}}
- circle
/>
}
>
diff --git a/src/pages/Plugins/Files.tsx b/src/pages/Plugins/Files.tsx
index 77c49604..d6834248 100644
--- a/src/pages/Plugins/Files.tsx
+++ b/src/pages/Plugins/Files.tsx
@@ -5,9 +5,9 @@ import { FiMenu, FiTrash, FiUploadCloud } from 'react-icons/fi';
import useSWR from 'swr';
import { Card } from '@app/components/generic/Card';
+import { IconButton } from '@app/components/generic/IconButton.jsx';
import fetcher from '@app/core/utils/fetcher.js';
import { useAppSelector } from '@app/hooks/redux';
-import { Button } from '@components/generic/Button';
import { PrimaryTemplate } from '@components/templates/PrimaryTemplate';
export interface RangeTestProps {
@@ -55,12 +55,11 @@ export const Files = ({ navOpen, setNavOpen }: RangeTestProps): JSX.Element => {
title="File Browser"
tagline="Plugin"
button={
-
}
onClick={(): void => {
setNavOpen(!navOpen);
}}
- circle
/>
}
>
@@ -80,11 +79,7 @@ export const Files = ({ navOpen, setNavOpen }: RangeTestProps): JSX.Element => {
-
-
- }
+ buttons={} />}
className="md:w-1/3"
>
{data ? (
@@ -92,34 +87,37 @@ export const Files = ({ navOpen, setNavOpen }: RangeTestProps): JSX.Element => {
{data.data.files.map((file: IFile) => (
-
-
+
-
- {file.nameModified ?? file.name}
-
-
))}
diff --git a/src/pages/Plugins/Index.tsx b/src/pages/Plugins/Index.tsx
index f9519fb1..fefb35cf 100644
--- a/src/pages/Plugins/Index.tsx
+++ b/src/pages/Plugins/Index.tsx
@@ -2,8 +2,8 @@ import React from 'react';
import { FiFileText, FiRss, FiXCircle } from 'react-icons/fi';
+import { IconButton } from '@app/components/generic/IconButton.jsx';
import { useBreakpoint } from '@app/hooks/breakpoint';
-import { Button } from '@components/generic/Button';
import { Drawer } from '@components/generic/Drawer';
import { SidebarItem } from '@components/generic/SidebarItem';
import { Tab } from '@headlessui/react';
@@ -32,7 +32,7 @@ export const Plugins = (): JSX.Element => {
Plugins
-
}
circle
onClick={(): void => {
diff --git a/src/pages/Plugins/RangeTest.tsx b/src/pages/Plugins/RangeTest.tsx
index e4a8e66b..40d0eb22 100644
--- a/src/pages/Plugins/RangeTest.tsx
+++ b/src/pages/Plugins/RangeTest.tsx
@@ -5,7 +5,8 @@ import { useTranslation } from 'react-i18next';
import { FiMenu, FiSave } from 'react-icons/fi';
import { Card } from '@app/components/generic/Card';
-import { Input } from '@app/components/generic/Input.jsx';
+import { Input } from '@app/components/generic/form/Input.jsx';
+import { IconButton } from '@app/components/generic/IconButton.jsx';
import { Toggle } from '@app/components/generic/Toggle';
import { connection } from '@app/core/connection.js';
import { useAppSelector } from '@app/hooks/redux';
@@ -45,12 +46,11 @@ export const RangeTest = ({
title="Range Test"
tagline="Plugin"
button={
-
}
onClick={(): void => {
setNavOpen(!navOpen);
}}
- circle
/>
}
footer={
diff --git a/src/pages/settings/Channels.tsx b/src/pages/settings/Channels.tsx
index a5655bd3..2b2de58e 100644
--- a/src/pages/settings/Channels.tsx
+++ b/src/pages/settings/Channels.tsx
@@ -1,16 +1,14 @@
import React from 'react';
-import { useForm } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
-import { FiMenu, FiSave, FiTrash } from 'react-icons/fi';
+import { FiMenu, FiSave } from 'react-icons/fi';
+import { Channel } from '@app/components/Channel.jsx';
import { Card } from '@app/components/generic/Card';
-import { Input } from '@app/components/generic/Input.jsx';
-import { connection } from '@app/core/connection.js';
+import { IconButton } from '@app/components/generic/IconButton.jsx';
import { useAppSelector } from '@app/hooks/redux.js';
import { Button } from '@components/generic/Button';
import { PrimaryTemplate } from '@components/templates/PrimaryTemplate';
-import { Protobuf } from '@meshtastic/meshtasticjs';
export interface ChannelsProps {
navOpen: boolean;
@@ -24,33 +22,16 @@ export const Channels = ({
const { t } = useTranslation();
const channels = useAppSelector((state) => state.meshtastic.channels);
- const { register, handleSubmit, formState } = useForm<{
- index: number;
- name: string;
- }>();
-
- const onSubmit = handleSubmit(async (data) => {
- const adminChannel = Protobuf.Channel.create({
- role: Protobuf.Channel_Role.SECONDARY,
- index: data.index,
- settings: {
- name: data.name,
- },
- });
- await connection.setChannel(adminChannel);
- });
-
return (
}
onClick={(): void => {
setNavOpen(!navOpen);
}}
- circle
/>
}
footer={
@@ -60,55 +41,37 @@ export const Channels = ({
active
border
>
- {t('strings.save_changes')}
+ Confirm
}
>
+
+ - Primary
+
+ - Secondary
+
+ - Disabled
+
+ - Admin
+
+ }
>
-
-
-
-
+
{channels.map((channel) => (
-
-
- {Protobuf.Channel_Role[channel.role]}
- {channel.settings?.name}
-
-
+
))}
+
+
+
+ Please ensure any changes are working before confirming
+
+
+
diff --git a/src/pages/settings/Connection.tsx b/src/pages/settings/Connection.tsx
index 632c66f3..bb739eed 100644
--- a/src/pages/settings/Connection.tsx
+++ b/src/pages/settings/Connection.tsx
@@ -5,7 +5,8 @@ import { useTranslation } from 'react-i18next';
import { FiLink2, FiMenu, FiSave } from 'react-icons/fi';
import { Card } from '@app/components/generic/Card';
-import { Input } from '@app/components/generic/Input';
+import { Input } from '@app/components/generic/form/Input';
+import { IconButton } from '@app/components/generic/IconButton.jsx';
import { Tabs } from '@app/components/generic/Tabs';
import { Toggle } from '@app/components/generic/Toggle';
import { bleConnection, serialConnection } from '@app/core/connection';
@@ -39,12 +40,11 @@ export const Connection = ({
title="Connection"
tagline="Settings"
button={
- }
onClick={(): void => {
setNavOpen(!navOpen);
}}
- circle
/>
}
footer={
diff --git a/src/pages/settings/Device.tsx b/src/pages/settings/Device.tsx
index 85ca6686..0ff240c6 100644
--- a/src/pages/settings/Device.tsx
+++ b/src/pages/settings/Device.tsx
@@ -5,11 +5,12 @@ import { useTranslation } from 'react-i18next';
import { FiMenu, FiSave } from 'react-icons/fi';
import { Card } from '@app/components/generic/Card';
+import { IconButton } from '@app/components/generic/IconButton.jsx';
import { Toggle } from '@app/components/generic/Toggle';
import { connection } from '@app/core/connection';
import { useAppSelector } from '@app/hooks/redux';
import { Button } from '@components/generic/Button';
-import { Input } from '@components/generic/Input';
+import { Input } from '@components/generic/form/Input';
import { PrimaryTemplate } from '@components/templates/PrimaryTemplate';
import { Protobuf } from '@meshtastic/meshtasticjs';
@@ -34,10 +35,7 @@ export const Device = ({ navOpen, setNavOpen }: DeviceProps): JSX.Element => {
});
const onSubmit = handleSubmit((data) => {
- // Protobuf.User.mergePartial(user, data);
-
void connection.setOwner({ ...user, ...data });
- console.log('submitted');
});
return (
@@ -45,12 +43,11 @@ export const Device = ({ navOpen, setNavOpen }: DeviceProps): JSX.Element => {
title="Device"
tagline="Settings"
button={
- }
onClick={(): void => {
setNavOpen(!navOpen);
}}
- circle
/>
}
footer={
diff --git a/src/pages/settings/Index.tsx b/src/pages/settings/Index.tsx
index c3a92f15..b80b29c6 100644
--- a/src/pages/settings/Index.tsx
+++ b/src/pages/settings/Index.tsx
@@ -9,8 +9,8 @@ import {
FiXCircle,
} from 'react-icons/fi';
+import { IconButton } from '@app/components/generic/IconButton.jsx';
import { useBreakpoint } from '@app/hooks/breakpoint';
-import { Button } from '@components/generic/Button';
import { Drawer } from '@components/generic/Drawer';
import { SidebarItem } from '@components/generic/SidebarItem';
import { Tab } from '@headlessui/react';
@@ -42,9 +42,8 @@ export const Settings = (): JSX.Element => {
Settings
-
}
- circle
onClick={(): void => {
setNavOpen(false);
}}
diff --git a/src/pages/settings/Radio.tsx b/src/pages/settings/Radio.tsx
index ae13e674..c3499cbe 100644
--- a/src/pages/settings/Radio.tsx
+++ b/src/pages/settings/Radio.tsx
@@ -2,13 +2,16 @@ import React from 'react';
import { useForm } from 'react-hook-form';
import { useTranslation } from 'react-i18next';
-import { FiMenu, FiSave } from 'react-icons/fi';
+import { FiMenu, FiSave, FiXCircle } from 'react-icons/fi';
import { Card } from '@app/components/generic/Card';
+import { EnumSelect } from '@app/components/generic/form/EnumSelect.jsx';
+import { IconButton } from '@app/components/generic/IconButton.jsx';
+import { Toggle } from '@app/components/generic/Toggle.jsx';
import { connection } from '@app/core/connection';
import { useAppSelector } from '@app/hooks/redux';
import { Button } from '@components/generic/Button';
-import { Input } from '@components/generic/Input';
+import { Input } from '@components/generic/form/Input';
import { PrimaryTemplate } from '@components/templates/PrimaryTemplate';
import { Protobuf } from '@meshtastic/meshtasticjs';
@@ -21,7 +24,7 @@ export const Radio = ({ navOpen, setNavOpen }: RadioProps): JSX.Element => {
const { t } = useTranslation();
const radioConfig = useAppSelector((state) => state.meshtastic.preferences);
- const { register, handleSubmit, formState } =
+ const { register, handleSubmit, formState, reset } =
useForm
({
defaultValues: radioConfig,
});
@@ -34,24 +37,33 @@ export const Radio = ({ navOpen, setNavOpen }: RadioProps): JSX.Element => {
title="Radio"
tagline="Settings"
button={
- }
onClick={(): void => {
setNavOpen(!navOpen);
}}
- circle
/>
}
footer={
- }
- disabled={!formState.isDirty}
- active
- border
- >
- {t('strings.save_changes')}
-
+
+ }
+ disabled={formState.isDirty}
+ onClick={(): void => {
+ reset();
+ }}
+ />
+ }
+ disabled={!formState.isDirty}
+ onClick={onSubmit}
+ active
+ border
+ >
+ {t('strings.save_changes')}
+
+
}
>
{
>