From 247886ce856c63099d90c89697180a85c2e720e1 Mon Sep 17 00:00:00 2001 From: Nicola Benaglia Date: Wed, 23 Apr 2025 08:55:50 +0200 Subject: [PATCH 1/6] Simplify selector with a unique icon --- src/App.tsx | 2 +- src/ExtStates/NotAuthenticated.tsx | 2 +- src/components/Apps/AppsHomeDesktop.tsx | 2 +- src/components/DesktopSideBar.tsx | 2 +- src/components/Theme/ThemeSelector.tsx | 76 +++++-------------------- 5 files changed, 17 insertions(+), 67 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 7d3a7c7..7ce75de 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3681,7 +3681,7 @@ function App() { /> )} - + ); } diff --git a/src/ExtStates/NotAuthenticated.tsx b/src/ExtStates/NotAuthenticated.tsx index a892414..017e7ae 100644 --- a/src/ExtStates/NotAuthenticated.tsx +++ b/src/ExtStates/NotAuthenticated.tsx @@ -1058,7 +1058,7 @@ export const NotAuthenticated = ({ /> - + ); }; diff --git a/src/components/Apps/AppsHomeDesktop.tsx b/src/components/Apps/AppsHomeDesktop.tsx index d9ad291..d525c26 100644 --- a/src/components/Apps/AppsHomeDesktop.tsx +++ b/src/components/Apps/AppsHomeDesktop.tsx @@ -157,7 +157,7 @@ export const AppsHomeDesktop = ({ /> - + ); }; diff --git a/src/components/DesktopSideBar.tsx b/src/components/DesktopSideBar.tsx index d1c8a7a..2244334 100644 --- a/src/components/DesktopSideBar.tsx +++ b/src/components/DesktopSideBar.tsx @@ -139,7 +139,7 @@ export const DesktopSideBar = ({ )} - + ); }; diff --git a/src/components/Theme/ThemeSelector.tsx b/src/components/Theme/ThemeSelector.tsx index dbf9d90..b82c072 100644 --- a/src/components/Theme/ThemeSelector.tsx +++ b/src/components/Theme/ThemeSelector.tsx @@ -1,75 +1,25 @@ import { useThemeContext } from './ThemeContext'; -import { styled, Switch } from '@mui/material'; +import { IconButton, Tooltip } from '@mui/material'; +import LightModeIcon from '@mui/icons-material/LightMode'; +import DarkModeIcon from '@mui/icons-material/DarkMode'; -const ThemeSwitch = styled(Switch)(({ theme }) => ({ - width: 62, - height: 34, - padding: 7, - '& .MuiSwitch-switchBase': { - margin: 1, - padding: 0, - transform: 'translateX(6px)', - '&.Mui-checked': { - color: '#fff', - transform: 'translateX(22px)', - '& .MuiSwitch-thumb:before': { - backgroundImage: `url('data:image/svg+xml;utf8,')`, - }, - '& + .MuiSwitch-track': { - opacity: 1, - backgroundColor: '#aab4be', - ...theme.applyStyles('dark', { - backgroundColor: '#8796A5', - }), - }, - }, - }, - '& .MuiSwitch-thumb': { - backgroundColor: '#fde402', - width: 32, - height: 32, - '&::before': { - content: "''", - position: 'absolute', - width: '100%', - height: '100%', - left: 0, - top: 0, - backgroundRepeat: 'no-repeat', - backgroundPosition: 'center', - backgroundImage: `url('data:image/svg+xml;utf8,')`, - }, - ...theme.applyStyles('dark', { - backgroundColor: '#003892', - }), - }, - '& .MuiSwitch-track': { - opacity: 1, - backgroundColor: '#aab4be', - borderRadius: 20 / 2, - ...theme.applyStyles('dark', { - backgroundColor: '#8796A5', - }), - }, -})); - -const ThemeSelector = ({ style }) => { +const ThemeSelector = () => { const { themeMode, toggleTheme } = useThemeContext(); + return (
- + + + {themeMode === 'dark' ? : } + +
); }; From 104c4822bf2556532a18740f61d4edf28f3e5b9d Mon Sep 17 00:00:00 2001 From: Nicola Benaglia Date: Wed, 23 Apr 2025 09:05:07 +0200 Subject: [PATCH 2/6] Refactor icon position --- src/components/DesktopSideBar.tsx | 2 +- src/components/Theme/ThemeSelector.tsx | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/DesktopSideBar.tsx b/src/components/DesktopSideBar.tsx index 2244334..b25d206 100644 --- a/src/components/DesktopSideBar.tsx +++ b/src/components/DesktopSideBar.tsx @@ -118,7 +118,7 @@ export const DesktopSideBar = ({ - {/* */} + {isEnabledDevMode && ( { diff --git a/src/components/Theme/ThemeSelector.tsx b/src/components/Theme/ThemeSelector.tsx index b82c072..238ca00 100644 --- a/src/components/Theme/ThemeSelector.tsx +++ b/src/components/Theme/ThemeSelector.tsx @@ -9,10 +9,11 @@ const ThemeSelector = () => { return (
From a9854c55d75c2fbf6e162bf75527b0b3f2fadfc8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 25 Apr 2025 17:09:45 +0000 Subject: [PATCH 3/6] Bump vitest from 1.6.0 to 1.6.1 Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 1.6.0 to 1.6.1. - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Commits](https://github.com/vitest-dev/vitest/commits/v1.6.1/packages/vitest) --- updated-dependencies: - dependency-name: vitest dependency-version: 1.6.1 dependency-type: direct:development ... Signed-off-by: dependabot[bot] --- package-lock.json | 101 +++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 52 insertions(+), 51 deletions(-) diff --git a/package-lock.json b/package-lock.json index 071586f..bd1bebf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -115,7 +115,7 @@ "rename-cli": "^6.2.1", "typescript": "^5.2.2", "vite": "^5.1.6", - "vitest": "^1.6.0" + "vitest": "^1.6.1" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -3631,9 +3631,10 @@ } }, "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "license": "MIT" }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.25", @@ -5925,14 +5926,14 @@ } }, "node_modules/@vitest/expect": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.6.0.tgz", - "integrity": "sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.6.1.tgz", + "integrity": "sha512-jXL+9+ZNIJKruofqXuuTClf44eSpcHlgj3CiuNihUF3Ioujtmc0zIa3UJOW5RjDK1YLBJZnWBlPuqhYycLioog==", "devOptional": true, "license": "MIT", "dependencies": { - "@vitest/spy": "1.6.0", - "@vitest/utils": "1.6.0", + "@vitest/spy": "1.6.1", + "@vitest/utils": "1.6.1", "chai": "^4.3.10" }, "funding": { @@ -5940,13 +5941,13 @@ } }, "node_modules/@vitest/runner": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.6.0.tgz", - "integrity": "sha512-P4xgwPjwesuBiHisAVz/LSSZtDjOTPYZVmNAnpHHSR6ONrf8eCJOFRvUwdHn30F5M1fxhqtl7QZQUk2dprIXAg==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.6.1.tgz", + "integrity": "sha512-3nSnYXkVkf3mXFfE7vVyPmi3Sazhb/2cfZGGs0JRzFsPFvAMBEcrweV1V1GsrstdXeKCTXlJbvnQwGWgEIHmOA==", "devOptional": true, "license": "MIT", "dependencies": { - "@vitest/utils": "1.6.0", + "@vitest/utils": "1.6.1", "p-limit": "^5.0.0", "pathe": "^1.1.1" }, @@ -5971,9 +5972,9 @@ } }, "node_modules/@vitest/runner/node_modules/yocto-queue": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.1.1.tgz", - "integrity": "sha512-b4JR1PFR10y1mKjhHY9LaGo6tmrgjit7hxVIeAmyMw3jegXR4dhYqLaQF5zMXZxY7tLpMyJeLjr1C4rLmkVe8g==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.2.1.tgz", + "integrity": "sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg==", "devOptional": true, "license": "MIT", "engines": { @@ -5984,9 +5985,9 @@ } }, "node_modules/@vitest/snapshot": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.6.0.tgz", - "integrity": "sha512-+Hx43f8Chus+DCmygqqfetcAZrDJwvTj0ymqjQq4CvmpKFSTVteEOBzCusu1x2tt4OJcvBflyHUE0DZSLgEMtQ==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.6.1.tgz", + "integrity": "sha512-WvidQuWAzU2p95u8GAKlRMqMyN1yOJkGHnx3M1PL9Raf7AQ1kwLKg04ADlCa3+OXUZE7BceOhVZiuWAbzCKcUQ==", "devOptional": true, "license": "MIT", "dependencies": { @@ -5999,9 +6000,9 @@ } }, "node_modules/@vitest/spy": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.6.0.tgz", - "integrity": "sha512-leUTap6B/cqi/bQkXUu6bQV5TZPx7pmMBKBQiI0rJA8c3pB56ZsaTbREnF7CJfmvAS4V2cXIBAh/3rVwrrCYgw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.6.1.tgz", + "integrity": "sha512-MGcMmpGkZebsMZhbQKkAf9CX5zGvjkBTqf8Zx3ApYWXr3wG+QvEu2eXWfnIIWYSJExIp4V9FCKDEeygzkYrXMw==", "devOptional": true, "license": "MIT", "dependencies": { @@ -6012,9 +6013,9 @@ } }, "node_modules/@vitest/utils": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.6.0.tgz", - "integrity": "sha512-21cPiuGMoMZwiOHa2i4LXkMkMkCGzA+MVFV70jRwHo95dL4x/ts5GZhML1QWuy7yfp3WzK3lRvZi3JnXTYqrBw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.6.1.tgz", + "integrity": "sha512-jOrrUvXM4Av9ZWiG1EajNto0u96kWAhJ1LmPmJhXXQx/32MecEKd10pOLYgS2BQx1TgkGhloPU1ArDW2vvaY6g==", "devOptional": true, "license": "MIT", "dependencies": { @@ -7296,9 +7297,9 @@ } }, "node_modules/chai": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.4.1.tgz", - "integrity": "sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.5.0.tgz", + "integrity": "sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==", "devOptional": true, "license": "MIT", "dependencies": { @@ -7308,7 +7309,7 @@ "get-func-name": "^2.0.2", "loupe": "^2.3.6", "pathval": "^1.1.1", - "type-detect": "^4.0.8" + "type-detect": "^4.1.0" }, "engines": { "node": ">=4" @@ -12369,13 +12370,13 @@ } }, "node_modules/magic-string": { - "version": "0.30.10", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.10.tgz", - "integrity": "sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==", + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", "devOptional": true, "license": "MIT", "dependencies": { - "@jridgewell/sourcemap-codec": "^1.4.15" + "@jridgewell/sourcemap-codec": "^1.5.0" } }, "node_modules/make-fetch-happen": { @@ -18975,9 +18976,9 @@ } }, "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.1.0.tgz", + "integrity": "sha512-Acylog8/luQ8L7il+geoSxhEkazvkslg7PSNKOX59mbB9cOveP5aq9h74Y7YU8yDpJwetzQQrfIwtf4Wp4LKcw==", "devOptional": true, "license": "MIT", "engines": { @@ -19470,9 +19471,9 @@ } }, "node_modules/vite-node": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.6.0.tgz", - "integrity": "sha512-de6HJgzC+TFzOu0NTC4RAIsyf/DY/ibWDYQUcuEA84EMHhcefTUGkjFHKKEJhQN4A+6I0u++kr3l36ZF2d7XRw==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.6.1.tgz", + "integrity": "sha512-YAXkfvGtuTzwWbDSACdJSg4A4DZiAqckWe90Zapc/sEX3XvHcw1NdurM/6od8J207tSDqNbSsgdCacBgvJKFuA==", "devOptional": true, "license": "MIT", "dependencies": { @@ -19543,17 +19544,17 @@ } }, "node_modules/vitest": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.6.0.tgz", - "integrity": "sha512-H5r/dN06swuFnzNFhq/dnz37bPXnq8xB2xB5JOVk8K09rUtoeNN+LHWkoQ0A/i3hvbUKKcCei9KpbxqHMLhLLA==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.6.1.tgz", + "integrity": "sha512-Ljb1cnSJSivGN0LqXd/zmDbWEM0RNNg2t1QW/XUhYl/qPqyu7CsqeWtqQXHVaJsecLPuDoak2oJcZN2QoRIOag==", "devOptional": true, "license": "MIT", "dependencies": { - "@vitest/expect": "1.6.0", - "@vitest/runner": "1.6.0", - "@vitest/snapshot": "1.6.0", - "@vitest/spy": "1.6.0", - "@vitest/utils": "1.6.0", + "@vitest/expect": "1.6.1", + "@vitest/runner": "1.6.1", + "@vitest/snapshot": "1.6.1", + "@vitest/spy": "1.6.1", + "@vitest/utils": "1.6.1", "acorn-walk": "^8.3.2", "chai": "^4.3.10", "debug": "^4.3.4", @@ -19567,7 +19568,7 @@ "tinybench": "^2.5.1", "tinypool": "^0.8.3", "vite": "^5.0.0", - "vite-node": "1.6.0", + "vite-node": "1.6.1", "why-is-node-running": "^2.2.2" }, "bin": { @@ -19582,8 +19583,8 @@ "peerDependencies": { "@edge-runtime/vm": "*", "@types/node": "^18.0.0 || >=20.0.0", - "@vitest/browser": "1.6.0", - "@vitest/ui": "1.6.0", + "@vitest/browser": "1.6.1", + "@vitest/ui": "1.6.1", "happy-dom": "*", "jsdom": "*" }, diff --git a/package.json b/package.json index 0060144..3c92ad4 100644 --- a/package.json +++ b/package.json @@ -120,6 +120,6 @@ "rename-cli": "^6.2.1", "typescript": "^5.2.2", "vite": "^5.1.6", - "vitest": "^1.6.0" + "vitest": "^1.6.1" } } From 4e8eb3b2c31665584a4242d70d890e8fb6d69a6c Mon Sep 17 00:00:00 2001 From: PhilReact Date: Sat, 26 Apr 2025 10:34:15 +0300 Subject: [PATCH 4/6] added the option to change the wallet's password --- public/locales/de/auth.json | 8 +- public/locales/en/auth.json | 8 +- public/locales/es/auth.json | 8 +- public/locales/fr/auth.json | 8 +- public/locales/it/auth.json | 8 +- public/locales/ru/auth.json | 8 +- src/App.tsx | 136 +------------- src/ExtStates/NotAuthenticated.tsx | 2 +- src/components/Auth/DownloadWallet.tsx | 248 +++++++++++++++++++++++++ src/components/Explore/Explore.tsx | 2 +- 10 files changed, 302 insertions(+), 134 deletions(-) create mode 100644 src/components/Auth/DownloadWallet.tsx diff --git a/public/locales/de/auth.json b/public/locales/de/auth.json index fc83d42..5b14183 100644 --- a/public/locales/de/auth.json +++ b/public/locales/de/auth.json @@ -31,7 +31,13 @@ "return_to_list": "zurück zur Liste", "wallet": { "password_confirmation": "Wallet-Passwort bestätigen", - "password": "Wallet-Passwort" + "password": "Wallet-Passwort", + "keep_password": "aktuelles Passwort beibehalten", + "new_password": "neues Passwort", + "error": { + "missing_new_password": "bitte neues Passwort eingeben", + "missing_password": "bitte Passwort eingeben" + } }, "welcome": "willkommen bei" } diff --git a/public/locales/en/auth.json b/public/locales/en/auth.json index 26cab11..2ee037e 100644 --- a/public/locales/en/auth.json +++ b/public/locales/en/auth.json @@ -31,7 +31,13 @@ "return_to_list": "return to list", "wallet": { "password_confirmation": "confirm wallet password", - "password": "wallet password" + "password": "wallet password", + "keep_password": "keep current password", + "new_password": "new password", + "error": { + "missing_new_password": "please enter a new password", + "missing_password": "please enter your password" + } }, "welcome": "welcome to" } diff --git a/public/locales/es/auth.json b/public/locales/es/auth.json index 3c62c24..5d4b8b6 100644 --- a/public/locales/es/auth.json +++ b/public/locales/es/auth.json @@ -31,7 +31,13 @@ "return_to_list": "volver a la lista", "wallet": { "password_confirmation": "confirmar contraseña del monedero", - "password": "contraseña del monedero" + "password": "contraseña del monedero", + "keep_password": "mantener la contraseña actual", + "new_password": "nueva contraseña", + "error": { + "missing_new_password": "por favor ingresa una nueva contraseña", + "missing_password": "por favor ingresa tu contraseña" + } }, "welcome": "bienvenido a" } diff --git a/public/locales/fr/auth.json b/public/locales/fr/auth.json index 06d08d5..f314d3e 100644 --- a/public/locales/fr/auth.json +++ b/public/locales/fr/auth.json @@ -31,7 +31,13 @@ "return_to_list": "retour à la liste", "wallet": { "password_confirmation": "confirmer le mot de passe du portefeuille", - "password": "mot de passe du portefeuille" + "password": "mot de passe du portefeuille", + "keep_password": "garder le mot de passe actuel", + "new_password": "nouveau mot de passe", + "error": { + "missing_new_password": "veuillez entrer un nouveau mot de passe", + "missing_password": "veuillez entrer votre mot de passe" + } }, "welcome": "bienvenue sur" } diff --git a/public/locales/it/auth.json b/public/locales/it/auth.json index 345c154..ad00833 100644 --- a/public/locales/it/auth.json +++ b/public/locales/it/auth.json @@ -30,7 +30,13 @@ "password": "password", "wallet": { "password_confirmation": "conferma la password del wallet", - "password": "password del wallet" + "password": "password del wallet", + "keep_password": "mantieni la password attuale", + "new_password": "nuova password", + "error": { + "missing_new_password": "per favore inserisci una nuova password", + "missing_password": "per favore inserisci la tua password" + } }, "return_to_list": "ritorna alla lista", "welcome": "benvenuto in" diff --git a/public/locales/ru/auth.json b/public/locales/ru/auth.json index 3ae2327..797220b 100644 --- a/public/locales/ru/auth.json +++ b/public/locales/ru/auth.json @@ -31,7 +31,13 @@ "return_to_list": "вернуться к списку", "wallet": { "password_confirmation": "подтвердите пароль кошелька", - "password": "пароль кошелька" + "password": "пароль кошелька", + "keep_password": "сохранить текущий пароль", + "new_password": "новый пароль", + "error": { + "missing_new_password": "пожалуйста, введите новый пароль", + "missing_password": "пожалуйста, введите ваш пароль" + } }, "welcome": "добро пожаловать в" } diff --git a/src/App.tsx b/src/App.tsx index ba57d99..7c66d9d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -137,6 +137,7 @@ import { GeneralNotifications } from './components/GeneralNotifications'; import { PdfViewer } from './common/PdfViewer'; import ThemeSelector from './components/Theme/ThemeSelector.tsx'; import { useTranslation } from 'react-i18next'; +import { DownloadWallet } from './components/Auth/DownloadWallet.tsx'; type extStates = | 'not-authenticated' @@ -919,27 +920,6 @@ function App() { } }, [authenticatedMode]); - const confirmPasswordToDownload = async () => { - try { - setWalletToBeDownloadedError(''); - if (!walletToBeDownloadedPassword) { - setSendPaymentError('Please enter your password'); - return; - } - setIsLoading(true); - await new Promise((res) => { - setTimeout(() => { - res(); - }, 250); - }); - const res = await saveWalletFunc(walletToBeDownloadedPassword); - } catch (error: any) { - setWalletToBeDownloadedError(error?.message); - } finally { - setIsLoading(false); - } - }; - const saveFileToDiskFunc = async () => { try { await saveFileToDisk( @@ -1676,7 +1656,7 @@ function App() { textTransform: 'uppercase', }} > - {t('core:wallet_other')} + {t('core:wallet.wallet_other')} } placement="left" @@ -2692,110 +2672,14 @@ function App() { )} {extState === 'download-wallet' && ( - <> - - - - - - - -
- -
- - - - - - {t('auth:download_account', { postProcess: 'capitalize' })} - - - - - - {!walletToBeDownloaded && ( - <> - - {t('auth:wallet.password_confirmation', { - postProcess: 'capitalize', - })} - - - - - - setWalletToBeDownloadedPassword(e.target.value) - } - /> - - - - - {t('auth:password_confirmation', { - postProcess: 'capitalize', - })} - - {walletToBeDownloadedError} - - )} - - {walletToBeDownloaded && ( - <> - { - await saveFileToDiskFunc(); - await showInfo({ - message: t('auth:keep_secure', { - postProcess: 'capitalize', - }), - }); - }} - > - {t('auth:download_account', { - postProcess: 'capitalize', - })} - - - )} - + )} {extState === 'create-wallet' && ( <> diff --git a/src/ExtStates/NotAuthenticated.tsx b/src/ExtStates/NotAuthenticated.tsx index 28892a9..3c8afd9 100644 --- a/src/ExtStates/NotAuthenticated.tsx +++ b/src/ExtStates/NotAuthenticated.tsx @@ -703,7 +703,7 @@ export const NotAuthenticated = ({ visibility: importedApiKey ? 'visible' : 'hidden', }} > - {t('auth:apikey.key', { postProcess: 'capitalize' })}: $ + {t('auth:apikey.key', { postProcess: 'capitalize' })}:{' '} {importedApiKey} diff --git a/src/components/Auth/DownloadWallet.tsx b/src/components/Auth/DownloadWallet.tsx new file mode 100644 index 0000000..12b46f4 --- /dev/null +++ b/src/components/Auth/DownloadWallet.tsx @@ -0,0 +1,248 @@ +import { Box, Checkbox, FormControlLabel, Typography } from '@mui/material'; +import { Spacer } from '../../common/Spacer'; +import { Return } from '../../assets/Icons/Return'; +import { CustomButton, CustomLabel, TextP } from '../../styles/App-styles'; +import { PasswordField } from '../PasswordField/PasswordField'; +import { ErrorText } from '../ErrorText/ErrorText'; +import Logo1Dark from '../../assets/svgs/Logo1Dark.svg'; +import { useTranslation } from 'react-i18next'; +import { saveFileToDisk } from '../../utils/generateWallet/generateWallet'; +import { useState } from 'react'; +import { decryptStoredWallet } from '../../utils/decryptWallet'; +import PhraseWallet from '../../utils/generateWallet/phrase-wallet'; +import { crypto, walletVersion } from '../../constants/decryptWallet'; + +export const DownloadWallet = ({ + returnToMain, + setIsLoading, + showInfo, + rawWallet, + setWalletToBeDownloaded, + walletToBeDownloaded, +}) => { + const [walletToBeDownloadedPassword, setWalletToBeDownloadedPassword] = + useState(''); + const [newPassword, setNewPassword] = useState(''); + const [keepCurrentPassword, setKeepCurrentPassword] = useState(true); + + const [walletToBeDownloadedError, setWalletToBeDownloadedError] = + useState(''); + + const { t } = useTranslation(['auth']); + + const saveFileToDiskFunc = async () => { + try { + await saveFileToDisk( + walletToBeDownloaded.wallet, + walletToBeDownloaded.qortAddress + ); + } catch (error: any) { + setWalletToBeDownloadedError(error?.message); + } + }; + + const saveWalletFunc = async (password: string, newPassword) => { + let wallet = structuredClone(rawWallet); + + const res = await decryptStoredWallet(password, wallet); + const wallet2 = new PhraseWallet(res, wallet?.version || walletVersion); + const passwordToUse = newPassword || password; + wallet = await wallet2.generateSaveWalletData( + passwordToUse, + crypto.kdfThreads, + () => {} + ); + + setWalletToBeDownloaded({ + wallet, + qortAddress: rawWallet.address0, + }); + return { + wallet, + qortAddress: rawWallet.address0, + }; + }; + + const confirmPasswordToDownload = async () => { + try { + setWalletToBeDownloadedError(''); + if (!keepCurrentPassword && !newPassword) { + setWalletToBeDownloadedError( + t('auth:wallet.error.missing_new_password', { + postProcess: 'capitalize', + }) + ); + return; + } + if (!walletToBeDownloadedPassword) { + setWalletToBeDownloadedError( + t('auth:wallet.error.missing_password', { postProcess: 'capitalize' }) + ); + return; + } + setIsLoading(true); + await new Promise((res) => { + setTimeout(() => { + res(); + }, 250); + }); + const newPasswordForWallet = !keepCurrentPassword ? newPassword : null; + const res = await saveWalletFunc( + walletToBeDownloadedPassword, + newPasswordForWallet + ); + } catch (error: any) { + setWalletToBeDownloadedError(error?.message); + } finally { + setIsLoading(false); + } + }; + + return ( + <> + + + + + + + +
+ +
+ + + + + + {t('auth:download_account', { postProcess: 'capitalize' })} + + + + + + {!walletToBeDownloaded && ( + <> + + {t('auth:wallet.password_confirmation', { + postProcess: 'capitalize', + })} + + + + + setWalletToBeDownloadedPassword(e.target.value)} + /> + + + + setKeepCurrentPassword(e.target.checked)} + checked={keepCurrentPassword} + edge="start" + tabIndex={-1} + disableRipple + /> + } + label={ + + + {t('auth:wallet.keep_password', { + postProcess: 'capitalize', + })} + + + } + /> + + {!keepCurrentPassword && ( + <> + + {t('auth:wallet.new_password', { + postProcess: 'capitalize', + })} + + + + setNewPassword(e.target.value)} + /> + + + )} + + + {t('auth:password_confirmation', { + postProcess: 'capitalize', + })} + + + {walletToBeDownloadedError} + + )} + + {walletToBeDownloaded && ( + <> + { + await saveFileToDiskFunc(); + await showInfo({ + message: t('auth:keep_secure', { + postProcess: 'capitalize', + }), + }); + }} + > + {t('auth:download_account', { + postProcess: 'capitalize', + })} + + + )} + + ); +}; diff --git a/src/components/Explore/Explore.tsx b/src/components/Explore/Explore.tsx index ae1988e..266fdd5 100644 --- a/src/components/Explore/Explore.tsx +++ b/src/components/Explore/Explore.tsx @@ -124,7 +124,7 @@ export const Explore = ({ setDesktopViewMode }) => { fontSize: '1rem', }} > - {t('core:wallet_other', { postProcess: 'capitalize' })} + {t('core:wallet.wallet_other', { postProcess: 'capitalize' })} From 3c242a688c907ce85161b346e540ec58aa18f8a3 Mon Sep 17 00:00:00 2001 From: PhilReact Date: Sat, 26 Apr 2025 12:33:55 +0300 Subject: [PATCH 5/6] remove full screen on double click --- src/App.tsx | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index ba57d99..2b3eee5 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -102,7 +102,6 @@ import { useRecoilState, useResetRecoilState, useSetRecoilState } from 'recoil'; import { canSaveSettingToQdnAtom, enabledDevModeAtom, - fullScreenAtom, groupsPropertiesAtom, hasSettingsChangedAtom, isDisabledEditorEnterAtom, @@ -115,7 +114,6 @@ import { settingsQDNLastUpdatedAtom, sortablePinnedAppsAtom, } from './atoms/global'; -import { useAppFullScreen } from './useAppFullscreen'; import { NotAuthenticated } from './ExtStates/NotAuthenticated'; import { handleGetFileFromIndexedDB } from './utils/indexedDB'; import { Wallets } from './Wallets'; @@ -407,12 +405,10 @@ function App() { const qortalRequestCheckbox1Ref = useRef(null); useRetrieveDataLocalStorage(userInfo?.address); useQortalGetSaveSettings(userInfo?.name, extState === 'authenticated'); - const [fullScreen, setFullScreen] = useRecoilState(fullScreenAtom); const [isEnabledDevMode, setIsEnabledDevMode] = useRecoilState(enabledDevModeAtom); const setIsDisabledEditorEnter = useSetRecoilState(isDisabledEditorEnterAtom); const [isOpenMinting, setIsOpenMinting] = useState(false); - const { toggleFullScreen } = useAppFullScreen(setFullScreen); const generatorRef = useRef(null); const exportSeedphrase = () => { @@ -456,24 +452,6 @@ function App() { } }, [extState, walletToBeDownloaded, shownTutorialsInitiated]); - useEffect(() => { - // Attach a global event listener for double-click - const handleDoubleClick = () => { - toggleFullScreen(); - }; - - // Add the event listener to the root HTML document - document.documentElement.addEventListener('dblclick', handleDoubleClick); - - // Clean up the event listener on unmount - return () => { - document.documentElement.removeEventListener( - 'dblclick', - handleDoubleClick - ); - }; - }, [toggleFullScreen]); - //resets for recoil const resetAtomSortablePinnedAppsAtom = useResetRecoilState( sortablePinnedAppsAtom From 9f0f6e96775dfc8662e14651efae42510eb4ec0d Mon Sep 17 00:00:00 2001 From: PhilReact Date: Sat, 26 Apr 2025 12:44:52 +0300 Subject: [PATCH 6/6] save theme to localstorage for persistance --- src/components/Theme/ThemeContext.tsx | 38 +++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/src/components/Theme/ThemeContext.tsx b/src/components/Theme/ThemeContext.tsx index 5a5abb8..d2e7048 100644 --- a/src/components/Theme/ThemeContext.tsx +++ b/src/components/Theme/ThemeContext.tsx @@ -1,4 +1,11 @@ -import { createContext, useContext, useState, useMemo } from 'react'; +import { + createContext, + useContext, + useState, + useMemo, + useEffect, + useCallback, +} from 'react'; import { ThemeProvider as MuiThemeProvider } from '@mui/material/styles'; import { darkTheme } from '../../styles/theme-dark'; import { lightTheme } from '../../styles/theme-light'; @@ -17,9 +24,36 @@ export const ThemeProvider = ({ children }: { children: React.ReactNode }) => { ); const toggleTheme = () => { - setThemeMode((prevMode) => (prevMode === 'light' ? 'dark' : 'light')); + setThemeMode((prevMode) => { + const newMode = prevMode === 'light' ? 'dark' : 'light'; + + const themeProperties = { + mode: newMode, + }; + + localStorage.setItem('saved_ui_theme', JSON.stringify(themeProperties)); + + return newMode; + }); }; + const getSavedTheme = useCallback(async () => { + try { + const themeProperties = JSON.parse( + localStorage.getItem(`saved_ui_theme`) || '{}' + ); + + const theme = themeProperties?.mode || 'light'; + setThemeMode(theme); + } catch (error) { + console.log('error', error); + } + }, []); + + useEffect(() => { + getSavedTheme(); + }, [getSavedTheme]); + return ( {children}