Update Hashicon & messages provisioning

This commit is contained in:
Sacha Weatherstone
2022-02-08 16:45:13 +11:00
parent 83cb8badd1
commit 0245a95fa9
8 changed files with 127 additions and 137 deletions
+12
View File
@@ -8,6 +8,11 @@ export interface MessageWithAck {
received: Date;
}
export interface Chat {
id: number; //Channel or user id (for dm's)
messages: MessageWithAck[];
}
export interface ChannelData {
channel: Protobuf.Channel;
lastChatInterraction: Date;
@@ -54,6 +59,7 @@ interface MeshtasticState {
radio: Radio;
hostOverrideEnabled: boolean;
hostOverride: string;
chats: Chat[];
}
const initialState: MeshtasticState = {
@@ -71,6 +77,7 @@ const initialState: MeshtasticState = {
hostOverrideEnabled:
localStorage.getItem('hostOverrideEnabled') === 'true' ?? false,
hostOverride: localStorage.getItem('hostOverride') ?? '',
chats: [],
};
export const meshtasticSlice = createSlice({
@@ -262,6 +269,11 @@ export const meshtasticSlice = createSlice({
// connection.disconnect();
}
},
addChat: (state, action: PayloadAction<Chat>) => {
if (state.chats.findIndex((chat) => chat.id === action.payload.id)) {
state.chats.push(action.payload);
}
},
resetState: (state) => {
state.deviceStatus = Types.DeviceStatusEnum.DEVICE_DISCONNECTED;
state.nodes = [];
+1 -5
View File
@@ -4,11 +4,7 @@ import { m } from 'framer-motion';
import JSONPretty from 'react-json-pretty';
import { useAppSelector } from '@app/hooks/useAppSelector.js';
// eslint-disable-next-line import/no-unresolved
import skypack_hashicon from '@skypack/@emeraldpay/hashicon-react';
const Hashicon = skypack_hashicon.Hashicon;
// import { Hashicon } from '@emeraldpay/hashicon-react';
import { Hashicon } from '@emeraldpay/hashicon-react';
export const Info = (): JSX.Element => {
const hardwareInfo = useAppSelector(
+1 -4
View File
@@ -1,11 +1,8 @@
import type React from 'react';
import type { Node } from '@app/core/slices/meshtasticSlice';
import { Hashicon } from '@emeraldpay/hashicon-react';
import { Tooltip } from '@meshtastic/components';
// eslint-disable-next-line import/no-unresolved
import skypack_hashicon from '@skypack/@emeraldpay/hashicon-react';
const Hashicon = skypack_hashicon.Hashicon;
export interface MessageProps {
lastMsgSameUser: boolean;
+1 -4
View File
@@ -7,17 +7,14 @@ import TimeAgo from 'timeago-react';
import { Layout } from '@app/components/layout';
import { SidebarItem } from '@components/layout/Sidebar/SidebarItem';
import { Hashicon } from '@emeraldpay/hashicon-react';
import { useAppSelector } from '@hooks/useAppSelector';
import { IconButton, Tooltip } from '@meshtastic/components';
import { Protobuf } from '@meshtastic/meshtasticjs';
// eslint-disable-next-line import/no-unresolved
import skypack_hashicon from '@skypack/@emeraldpay/hashicon-react';
import { Message } from './Message';
import { MessageBar } from './MessageBar';
const Hashicon = skypack_hashicon.Hashicon;
export const Messages = (): JSX.Element => {
const nodes = useAppSelector((state) => state.meshtastic.nodes);
const channels = useAppSelector(
+1 -4
View File
@@ -17,12 +17,9 @@ import { SidebarOverlay } from '@app/components/layout/Sidebar/sections/SidebarO
import { SidebarItem } from '@app/components/layout/Sidebar/SidebarItem';
import { CopyButton } from '@app/components/menu/buttons/CopyButton';
import type { Node } from '@core/slices/meshtasticSlice';
import { Hashicon } from '@emeraldpay/hashicon-react';
import { useMapbox } from '@hooks/useMapbox';
import { IconButton } from '@meshtastic/components';
// eslint-disable-next-line import/no-unresolved
import skypack_hashicon from '@skypack/@emeraldpay/hashicon-react';
const Hashicon = skypack_hashicon.Hashicon;
type PositionConfidence = 'high' | 'low' | 'none';
+1 -4
View File
@@ -8,11 +8,8 @@ import { RiMindMap } from 'react-icons/ri';
import { Layout } from '@app/components/layout';
import { SidebarItem } from '@app/components/layout/Sidebar/SidebarItem';
import { useAppSelector } from '@app/hooks/useAppSelector';
import { Hashicon } from '@emeraldpay/hashicon-react';
import { IconButton } from '@meshtastic/components';
// eslint-disable-next-line import/no-unresolved
import skypack_hashicon from '@skypack/@emeraldpay/hashicon-react';
const Hashicon = skypack_hashicon.Hashicon;
export const Nodes = (): JSX.Element => {
const [graphNodes, setGraphNodes] = React.useState<Node[]>([]);