Fix merge
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
|||||||
setMyNodeInfo,
|
setMyNodeInfo,
|
||||||
setPreferences,
|
setPreferences,
|
||||||
setReady,
|
setReady,
|
||||||
|
setUser,
|
||||||
} from '@core/slices/meshtasticSlice';
|
} from '@core/slices/meshtasticSlice';
|
||||||
import { Protobuf, SettingsManager, Types } from '@meshtastic/meshtasticjs';
|
import { Protobuf, SettingsManager, Types } from '@meshtastic/meshtasticjs';
|
||||||
import { About } from '@pages/About';
|
import { About } from '@pages/About';
|
||||||
@@ -70,6 +71,10 @@ const App = (): JSX.Element => {
|
|||||||
dispatch(setMyNodeInfo(nodeInfo));
|
dispatch(setMyNodeInfo(nodeInfo));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connection.onUserDataPacket.subscribe((user) => {
|
||||||
|
dispatch(setUser(user));
|
||||||
|
});
|
||||||
|
|
||||||
connection.onNodeInfoPacket.subscribe((nodeInfoPacket) =>
|
connection.onNodeInfoPacket.subscribe((nodeInfoPacket) =>
|
||||||
dispatch(addNode(nodeInfoPacket.data)),
|
dispatch(addNode(nodeInfoPacket.data)),
|
||||||
);
|
);
|
||||||
@@ -117,6 +122,7 @@ const App = (): JSX.Element => {
|
|||||||
return (): void => {
|
return (): void => {
|
||||||
connection.onDeviceStatus.cancelAll();
|
connection.onDeviceStatus.cancelAll();
|
||||||
connection.onMyNodeInfo.cancelAll();
|
connection.onMyNodeInfo.cancelAll();
|
||||||
|
connection.onUserDataPacket.cancelAll();
|
||||||
connection.onNodeInfoPacket.cancelAll();
|
connection.onNodeInfoPacket.cancelAll();
|
||||||
connection.onAdminPacket.cancelAll();
|
connection.onAdminPacket.cancelAll();
|
||||||
connection.onMeshHeartbeat.cancelAll();
|
connection.onMeshHeartbeat.cancelAll();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const MessageBar = (): JSX.Element => {
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
<div className="flex w-full p-4 mx-auto space-x-2 text-gray-500 bg-gray-50 dark:bg-transparent dark:text-gray-400">
|
<div className="flex w-full p-4 mx-auto space-x-2 text-gray-500 bg-gray-50 dark:bg-transparent dark:text-gray-400">
|
||||||
<div className="flex w-full max-w-4xl">
|
<div className="flex w-full max-w-4xl mx-auto">
|
||||||
<div className="flex">
|
<div className="flex">
|
||||||
<Button icon={<EmojiHappyIcon className="w-5 h-5" />} circle />
|
<Button icon={<EmojiHappyIcon className="w-5 h-5" />} circle />
|
||||||
<Button icon={<PaperClipIcon className="w-5 h-5" />} circle />
|
<Button icon={<PaperClipIcon className="w-5 h-5" />} circle />
|
||||||
|
|||||||
@@ -32,8 +32,9 @@ export const PrimaryTemplate = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-auto flex-grow p-6 md:p-10">{children}</div>
|
<div className="flex-auto flex-grow p-6 bg-white md:p-10 dark:bg-secondaryDark">
|
||||||
|
{children}
|
||||||
|
</div>
|
||||||
{footer && (
|
{footer && (
|
||||||
<div className="flex p-6 bg-white border-t md:flex-row flex-0 md:items-center md:justify-between md:py-8 md:px-10 dark:border-gray-600 dark:bg-secondaryDark">
|
<div className="flex p-6 bg-white border-t md:flex-row flex-0 md:items-center md:justify-between md:py-8 md:px-10 dark:border-gray-600 dark:bg-secondaryDark">
|
||||||
{button && <div className="pr-2 m-auto md:hidden">{button}</div>}
|
{button && <div className="pr-2 m-auto md:hidden">{button}</div>}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ interface AppState {
|
|||||||
lastMeshInterraction: number;
|
lastMeshInterraction: number;
|
||||||
ready: boolean;
|
ready: boolean;
|
||||||
myNodeInfo: Protobuf.MyNodeInfo;
|
myNodeInfo: Protobuf.MyNodeInfo;
|
||||||
|
user: Protobuf.User;
|
||||||
positionPackets: Types.PositionPacket[];
|
positionPackets: Types.PositionPacket[];
|
||||||
nodes: Protobuf.NodeInfo[];
|
nodes: Protobuf.NodeInfo[];
|
||||||
channels: Protobuf.Channel[];
|
channels: Protobuf.Channel[];
|
||||||
@@ -30,6 +31,7 @@ const initialState: AppState = {
|
|||||||
lastMeshInterraction: 0,
|
lastMeshInterraction: 0,
|
||||||
ready: false,
|
ready: false,
|
||||||
myNodeInfo: Protobuf.MyNodeInfo.create(),
|
myNodeInfo: Protobuf.MyNodeInfo.create(),
|
||||||
|
user: Protobuf.User.create(),
|
||||||
positionPackets: [],
|
positionPackets: [],
|
||||||
nodes: [],
|
nodes: [],
|
||||||
channels: [],
|
channels: [],
|
||||||
@@ -56,6 +58,9 @@ export const meshtasticSlice = createSlice({
|
|||||||
setMyNodeInfo: (state, action: PayloadAction<Protobuf.MyNodeInfo>) => {
|
setMyNodeInfo: (state, action: PayloadAction<Protobuf.MyNodeInfo>) => {
|
||||||
state.myNodeInfo = action.payload;
|
state.myNodeInfo = action.payload;
|
||||||
},
|
},
|
||||||
|
setUser: (state, action: PayloadAction<Protobuf.User>) => {
|
||||||
|
state.user = action.payload;
|
||||||
|
},
|
||||||
addPositionPacket: (state, action: PayloadAction<Types.PositionPacket>) => {
|
addPositionPacket: (state, action: PayloadAction<Types.PositionPacket>) => {
|
||||||
state.positionPackets.push(action.payload);
|
state.positionPackets.push(action.payload);
|
||||||
},
|
},
|
||||||
@@ -124,6 +129,7 @@ export const {
|
|||||||
setLastMeshInterraction,
|
setLastMeshInterraction,
|
||||||
setReady,
|
setReady,
|
||||||
setMyNodeInfo,
|
setMyNodeInfo,
|
||||||
|
setUser,
|
||||||
addPositionPacket,
|
addPositionPacket,
|
||||||
addNode,
|
addNode,
|
||||||
addChannel,
|
addChannel,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { Drawer } from '@components/generic/Drawer';
|
|||||||
import { SidebarItem } from '@components/generic/SidebarItem';
|
import { SidebarItem } from '@components/generic/SidebarItem';
|
||||||
import { Tab } from '@headlessui/react';
|
import { Tab } from '@headlessui/react';
|
||||||
import { XCircleIcon } from '@heroicons/react/outline';
|
import { XCircleIcon } from '@heroicons/react/outline';
|
||||||
|
import { Protobuf } from '@meshtastic/meshtasticjs';
|
||||||
|
|
||||||
import { Node } from './Node';
|
import { Node } from './Node';
|
||||||
|
|
||||||
@@ -55,7 +56,11 @@ export const Nodes = (): JSX.Element => {
|
|||||||
{({ selected }): JSX.Element => (
|
{({ selected }): JSX.Element => (
|
||||||
<SidebarItem
|
<SidebarItem
|
||||||
title={node.user?.longName ?? node.num.toString()}
|
title={node.user?.longName ?? node.num.toString()}
|
||||||
description="Node info"
|
description={
|
||||||
|
node.user?.hwModel
|
||||||
|
? Protobuf.HardwareModel[node.user.hwModel]
|
||||||
|
: 'Unknown Hardware'
|
||||||
|
}
|
||||||
selected={selected}
|
selected={selected}
|
||||||
icon={
|
icon={
|
||||||
<Avatar
|
<Avatar
|
||||||
|
|||||||
@@ -18,15 +18,14 @@ export interface DeviceProps {
|
|||||||
|
|
||||||
export const Device = ({ navOpen, setNavOpen }: DeviceProps): JSX.Element => {
|
export const Device = ({ navOpen, setNavOpen }: DeviceProps): JSX.Element => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const radioConfig = useAppSelector((state) => state.meshtastic.preferences);
|
const user = useAppSelector((state) => state.meshtastic.user);
|
||||||
|
|
||||||
const { register, handleSubmit, formState } =
|
const { register, handleSubmit, formState } = useForm<Protobuf.User>({
|
||||||
useForm<Protobuf.RadioConfig_UserPreferences>({
|
defaultValues: user,
|
||||||
defaultValues: radioConfig,
|
});
|
||||||
});
|
|
||||||
|
|
||||||
const onSubmit = handleSubmit((data) => {
|
const onSubmit = handleSubmit((data) => {
|
||||||
void connection.setPreferences(data);
|
void connection.setOwner(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -54,14 +53,9 @@ export const Device = ({ navOpen, setNavOpen }: DeviceProps): JSX.Element => {
|
|||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div className="w-full max-w-3xl space-y-2 md:max-w-xl">
|
<div className="w-full max-w-3xl md:max-w-xl">
|
||||||
<form onSubmit={onSubmit}>
|
<form className="space-y-2" onSubmit={onSubmit}>
|
||||||
<Input label={t('strings.wifi_ssid')} {...register('wifiSsid')} />
|
<Input label={'Device Name'} {...register('longName')} />
|
||||||
<Input
|
|
||||||
type="password"
|
|
||||||
label={t('strings.wifi_psk')}
|
|
||||||
{...register('wifiPassword')}
|
|
||||||
/>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</PrimaryTemplate>
|
</PrimaryTemplate>
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
|
import { useForm } from 'react-hook-form';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
import { connection } from '@app/core/connection';
|
||||||
|
import { useAppSelector } from '@app/hooks/redux';
|
||||||
import { Button } from '@components/generic/Button';
|
import { Button } from '@components/generic/Button';
|
||||||
import { Input } from '@components/generic/Input';
|
import { Input } from '@components/generic/Input';
|
||||||
import { PrimaryTemplate } from '@components/templates/PrimaryTemplate';
|
import { PrimaryTemplate } from '@components/templates/PrimaryTemplate';
|
||||||
import { MenuIcon, SaveIcon } from '@heroicons/react/outline';
|
import { MenuIcon, SaveIcon } from '@heroicons/react/outline';
|
||||||
|
import type { Protobuf } from '@meshtastic/meshtasticjs';
|
||||||
|
|
||||||
export interface RadioProps {
|
export interface RadioProps {
|
||||||
navOpen: boolean;
|
navOpen: boolean;
|
||||||
@@ -14,7 +18,16 @@ export interface RadioProps {
|
|||||||
|
|
||||||
export const Radio = ({ navOpen, setNavOpen }: RadioProps): JSX.Element => {
|
export const Radio = ({ navOpen, setNavOpen }: RadioProps): JSX.Element => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const radioConfig = useAppSelector((state) => state.meshtastic.preferences);
|
||||||
|
|
||||||
|
const { register, handleSubmit, formState } =
|
||||||
|
useForm<Protobuf.RadioConfig_UserPreferences>({
|
||||||
|
defaultValues: radioConfig,
|
||||||
|
});
|
||||||
|
|
||||||
|
const onSubmit = handleSubmit((data) => {
|
||||||
|
void connection.setPreferences(data);
|
||||||
|
});
|
||||||
return (
|
return (
|
||||||
<PrimaryTemplate
|
<PrimaryTemplate
|
||||||
title="Radio"
|
title="Radio"
|
||||||
@@ -32,6 +45,7 @@ export const Radio = ({ navOpen, setNavOpen }: RadioProps): JSX.Element => {
|
|||||||
<Button
|
<Button
|
||||||
className="px-10 ml-auto"
|
className="px-10 ml-auto"
|
||||||
icon={<SaveIcon className="w-5 h-5" />}
|
icon={<SaveIcon className="w-5 h-5" />}
|
||||||
|
disabled={!formState.isDirty}
|
||||||
active
|
active
|
||||||
border
|
border
|
||||||
>
|
>
|
||||||
@@ -39,8 +53,15 @@ export const Radio = ({ navOpen, setNavOpen }: RadioProps): JSX.Element => {
|
|||||||
</Button>
|
</Button>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div className="w-full max-w-3xl space-y-2 md:max-w-xl">
|
<div className="w-full max-w-3xl md:max-w-xl">
|
||||||
<Input label="test" />
|
<form className="space-y-2" onSubmit={onSubmit}>
|
||||||
|
<Input label={t('strings.wifi_ssid')} {...register('wifiSsid')} />
|
||||||
|
<Input
|
||||||
|
type="password"
|
||||||
|
label={t('strings.wifi_psk')}
|
||||||
|
{...register('wifiPassword')}
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</PrimaryTemplate>
|
</PrimaryTemplate>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -267,11 +267,11 @@
|
|||||||
integrity sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w==
|
integrity sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w==
|
||||||
|
|
||||||
"@meshtastic/meshtasticjs@^0.6.16":
|
"@meshtastic/meshtasticjs@^0.6.16":
|
||||||
version "0.6.16"
|
version "0.6.17"
|
||||||
resolved "https://registry.yarnpkg.com/@meshtastic/meshtasticjs/-/meshtasticjs-0.6.16.tgz#aa2fe3808af90b4c4aa43d2e2223dbf420977c65"
|
resolved "https://registry.yarnpkg.com/@meshtastic/meshtasticjs/-/meshtasticjs-0.6.17.tgz#e53dc051a9f8fa94162658dc53c8c4fad80fa627"
|
||||||
integrity sha512-nozIJJYdxouDBCWTJtF3oKPqkuJbL8lA9xTuzpSCVz4MRzlNPiSxc0O4C4lwwBrDEi9uymn+DJbub/lWv8m+wA==
|
integrity sha512-//1Opyv8IM9FiONGJ52w2TLvv6Gs3d0zaInqw73SzFZl9eRv8ZqiVhZA91wqleVilwPmsudyT+XAljKrrTn9VQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@protobuf-ts/runtime" "^1.0.13"
|
"@protobuf-ts/runtime" "^2.0.1"
|
||||||
sub-events "^1.8.9"
|
sub-events "^1.8.9"
|
||||||
|
|
||||||
"@nodelib/fs.scandir@2.1.5":
|
"@nodelib/fs.scandir@2.1.5":
|
||||||
@@ -417,10 +417,10 @@
|
|||||||
node-gyp "^7.1.0"
|
node-gyp "^7.1.0"
|
||||||
read-package-json-fast "^2.0.1"
|
read-package-json-fast "^2.0.1"
|
||||||
|
|
||||||
"@protobuf-ts/runtime@^1.0.13":
|
"@protobuf-ts/runtime@^2.0.1":
|
||||||
version "1.0.13"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/@protobuf-ts/runtime/-/runtime-1.0.13.tgz#42d6d84ea6f0ded68d6642ab64ca49f7c17f6e71"
|
resolved "https://registry.yarnpkg.com/@protobuf-ts/runtime/-/runtime-2.0.1.tgz#850ed3b66873a9d503be2f835ee43e8937939fe0"
|
||||||
integrity sha512-uvYYBUtG4eCYMxo+mzxN8SHvpL/l7PbHEmOpXEnDCwBj/wJ+Ezj8+TlEFjjRWpnFidka+SMdDOXPWSyJv2iNAw==
|
integrity sha512-iYsRGdr35Bta2ZxgyLyL7YWVnzn/gYZ4cv+CxIZnfz27XJ9hxOsx8e/4kQjcAopyw/lGzI9uGJXocXIUVhDK5Q==
|
||||||
|
|
||||||
"@reduxjs/toolkit@^1.6.0":
|
"@reduxjs/toolkit@^1.6.0":
|
||||||
version "1.6.1"
|
version "1.6.1"
|
||||||
|
|||||||
Reference in New Issue
Block a user