From 7d220e26833a1cb8d8b5920608a83f888a44b1ba Mon Sep 17 00:00:00 2001 From: Sacha Weatherstone Date: Tue, 15 Jun 2021 08:41:22 +1000 Subject: [PATCH] WIP --- package.json | 34 ++-- src/App.tsx | 28 +-- src/components/Header.tsx | 66 +------ src/index.tsx | 36 ++-- src/translations/TranslationContext.tsx | 56 ++++-- tsconfig.json | 1 + yarn.lock | 243 ++++++++++++------------ 7 files changed, 199 insertions(+), 265 deletions(-) diff --git a/package.json b/package.json index a7c395c5..7bc7b392 100644 --- a/package.json +++ b/package.json @@ -14,40 +14,40 @@ "@headlessui/react": "^1.2.0", "@heroicons/react": "^1.0.1", "@meshtastic/meshtasticjs": "^0.6.13", - "boring-avatars": "^1.5.5", - "observable-hooks": "^4.0.3", - "react": "^0.0.0-experimental-d75105fa9", - "react-dom": "^0.0.0-experimental-d75105fa9", + "boring-avatars": "^1.5.8", + "observable-hooks": "^4.0.5", + "react": "^18.0.0-alpha-dbe3363cc", + "react-dom": "^18.0.0-alpha-dbe3363cc", "react-flags-select": "^2.1.2", - "react-hook-form": "^7.7.1", + "react-hook-form": "^7.8.4", "react-json-pretty": "^2.2.0", "rxjs": "^7.1.0", "yarn": "^1.22.10" }, "devDependencies": { "@snowpack/plugin-dotenv": "^2.0.5", - "@snowpack/plugin-postcss": "^1.4.0", + "@snowpack/plugin-postcss": "^1.4.1", "@snowpack/plugin-react-refresh": "^2.5.0", "@snowpack/plugin-typescript": "^1.2.0", - "@types/eslint": "^7.2.12", - "@types/react": "^17.0.8", - "@types/react-dom": "^17.0.5", - "@types/snowpack-env": "^2.3.2", - "@typescript-eslint/eslint-plugin": "^4.26.0", - "@typescript-eslint/parser": "^4.26.0", + "@types/eslint": "^7.2.13", + "@types/react": "^17.0.11", + "@types/react-dom": "^17.0.7", + "@types/snowpack-env": "^2.3.3", + "@typescript-eslint/eslint-plugin": "^4.27.0", + "@typescript-eslint/parser": "^4.27.0", "autoprefixer": "^10.2.6", - "eslint": "^7.27.0", + "eslint": "^7.28.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-import": "^2.23.4", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-react": "^7.24.0", "eslint-plugin-react-hooks": "^4.2.0", "gzipper": "^4.5.0", - "postcss": "^8.3.0", + "postcss": "^8.3.4", "postcss-cli": "^8.3.1", - "prettier": "^2.3.0", - "snowpack": "^3.5.2", - "tailwindcss": "^2.1.2", + "prettier": "^2.3.1", + "snowpack": "^3.5.7", + "tailwindcss": "^2.1.4", "typescript": "^4.3.2" } } diff --git a/src/App.tsx b/src/App.tsx index f030bf3a..b7306874 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -15,10 +15,6 @@ import { import Header from './components/Header'; import Main from './Main'; import { channelSubject$, nodeSubject$, preferencesSubject$ } from './streams'; -import Translations_English from './translations/en'; -import Translations_Japanese from './translations/jp'; -import Translations_Portuguese from './translations/pt'; -import type { languageTemplate } from './translations/TranslationContext'; import { LanguageEnum } from './translations/TranslationContext'; const App = (): JSX.Element => { @@ -29,8 +25,6 @@ const App = (): JSX.Element => { const [myNodeInfo, setMyNodeInfo] = React.useState( Protobuf.MyNodeInfo.create(), ); - // const [channels, setChannels] = React.useState([] as Protobuf.Channel[]); - const [nodes, setNodes] = React.useState([]); const [connection, setConnection] = React.useState< ISerialConnection | IHTTPConnection | IBLEConnection >(new IHTTPConnection()); @@ -41,27 +35,8 @@ const App = (): JSX.Element => { const [language, setLanguage] = React.useState( LanguageEnum.ENGLISH, ); - const [translations, setTranslations] = - React.useState(Translations_English); const [darkmode, setDarkmode] = React.useState(false); - React.useEffect(() => { - switch (language) { - case LanguageEnum.ENGLISH: - setTranslations(Translations_English); - break; - case LanguageEnum.PORTUGUESE: - setTranslations(Translations_Portuguese); - break; - case LanguageEnum.JAPANESE: - setTranslations(Translations_Japanese); - break; - - default: - break; - } - }, [language]); - React.useEffect(() => { const client = new Client(); const tmpConnection = client.createHTTPConnection(); @@ -126,7 +101,7 @@ const App = (): JSX.Element => { meshHeartbeat?.unsubscribe(); connection.disconnect(); }; - }, [connection, nodes]); + }, [connection]); return (
@@ -135,7 +110,6 @@ const App = (): JSX.Element => { IsReady={isReady} LastMeshInterraction={lastMeshInterraction} connection={connection} - setConnection={setConnection} />
- >; } const Header = (props: HeaderProps): JSX.Element => { - const [activeConnection, setActiveConnection] = - React.useState<'http' | 'serial' | 'ble'>('http'); return (