From 723fe9d254063c48700eb9b66a4a06d3ad8cf5ac Mon Sep 17 00:00:00 2001 From: Shannon Tenner Date: Tue, 10 Dec 2024 16:49:59 +0200 Subject: [PATCH 1/3] wip: add dialog + translations --- public/locales/af/common.json | 4 ++- public/locales/af/wallet.json | 4 +++ public/locales/cn/common.json | 4 ++- public/locales/cn/wallet.json | 4 +++ public/locales/de/common.json | 4 ++- public/locales/de/wallet.json | 4 +++ public/locales/en/common.json | 4 ++- public/locales/en/wallet.json | 4 +++ public/locales/fr/common.json | 4 ++- public/locales/fr/wallet.json | 4 +++ public/locales/hi/common.json | 4 ++- public/locales/hi/wallet.json | 4 +++ public/locales/id/common.json | 4 ++- public/locales/id/wallet.json | 4 +++ public/locales/ja/common.json | 4 ++- public/locales/ja/wallet.json | 4 +++ public/locales/ko/common.json | 4 ++- public/locales/ko/wallet.json | 4 +++ public/locales/pl/common.json | 4 ++- public/locales/pl/wallet.json | 4 +++ public/locales/ru/common.json | 4 ++- public/locales/ru/wallet.json | 4 +++ public/locales/tr/common.json | 4 ++- public/locales/tr/wallet.json | 4 +++ src-tauri/src/app_config.rs | 13 +++++++- src-tauri/src/credential_manager.rs | 7 +++- .../elements/buttons/button.types.ts | 2 +- src/components/elements/styled.ts | 13 ++++++-- src/containers/floating/FloatingElements.tsx | 2 ++ .../KeyringAccessDialog.styles.ts | 19 +++++++++++ .../KeyringAccess/KeyringAccessDialog.tsx | 33 +++++++++++++++++++ src/store/useAppConfigStore.ts | 6 ++++ src/store/useUIStore.ts | 2 +- src/theme/components.ts | 1 + src/types/app-status.ts | 2 ++ 35 files changed, 178 insertions(+), 18 deletions(-) create mode 100644 public/locales/af/wallet.json create mode 100644 public/locales/cn/wallet.json create mode 100644 public/locales/de/wallet.json create mode 100644 public/locales/en/wallet.json create mode 100644 public/locales/fr/wallet.json create mode 100644 public/locales/hi/wallet.json create mode 100644 public/locales/id/wallet.json create mode 100644 public/locales/ja/wallet.json create mode 100644 public/locales/ko/wallet.json create mode 100644 public/locales/pl/wallet.json create mode 100644 public/locales/ru/wallet.json create mode 100644 public/locales/tr/wallet.json create mode 100644 src/containers/floating/KeyringAccess/KeyringAccessDialog.styles.ts create mode 100644 src/containers/floating/KeyringAccess/KeyringAccessDialog.tsx diff --git a/public/locales/af/common.json b/public/locales/af/common.json index 8c5b3bc82..bd8cffd7e 100644 --- a/public/locales/af/common.json +++ b/public/locales/af/common.json @@ -7,6 +7,7 @@ "critical-error": "Kritieke fout", "day": "Dag", "disconnect": "Ontkoppel", + "dismiss": "Dismiss", "hashrate": "Hashtempo", "installation-problem": "Installation problem", "max-temperature": "Maksimum temperatuur", @@ -28,5 +29,6 @@ "utilization": "Benutting", "version": "Weergawe", "versions": "Weergawes", - "webgl-not-supported": "WebGL word nie ondersteun nie. Visuele modus gedeaktiveer." + "webgl-not-supported": "WebGL word nie ondersteun nie. Visuele modus gedeaktiveer.", + "yes": "Yes" } \ No newline at end of file diff --git a/public/locales/af/wallet.json b/public/locales/af/wallet.json new file mode 100644 index 000000000..14daba8a5 --- /dev/null +++ b/public/locales/af/wallet.json @@ -0,0 +1,4 @@ +{ + "keychain-access": "Keychain Access", + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" +} \ No newline at end of file diff --git a/public/locales/cn/common.json b/public/locales/cn/common.json index 1d08840b0..82be7e62c 100644 --- a/public/locales/cn/common.json +++ b/public/locales/cn/common.json @@ -7,6 +7,7 @@ "critical-error": "严重错误", "day": "天", "disconnect": "断开连接", + "dismiss": "Dismiss", "hashrate": "哈希率", "installation-problem": "Installation problem", "max-temperature": "最高温度", @@ -28,5 +29,6 @@ "utilization": "利用率", "version": "版本", "versions": "版本", - "webgl-not-supported": "不支持 WebGL。已禁用视觉模式。" + "webgl-not-supported": "不支持 WebGL。已禁用视觉模式。", + "yes": "Yes" } \ No newline at end of file diff --git a/public/locales/cn/wallet.json b/public/locales/cn/wallet.json new file mode 100644 index 000000000..14daba8a5 --- /dev/null +++ b/public/locales/cn/wallet.json @@ -0,0 +1,4 @@ +{ + "keychain-access": "Keychain Access", + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" +} \ No newline at end of file diff --git a/public/locales/de/common.json b/public/locales/de/common.json index 071a7bb07..f5e8107db 100644 --- a/public/locales/de/common.json +++ b/public/locales/de/common.json @@ -7,6 +7,7 @@ "critical-error": "Kritischer Fehler", "day": "Tag", "disconnect": "Trennen", + "dismiss": "Dismiss", "hashrate": "Hashrate", "installation-problem": "Installation problem", "max-temperature": "Maximaltemperatur", @@ -28,5 +29,6 @@ "utilization": "Auslastung", "version": "Version", "versions": "Versionen", - "webgl-not-supported": "WebGL wird nicht unterstützt. Visueller Modus deaktiviert." + "webgl-not-supported": "WebGL wird nicht unterstützt. Visueller Modus deaktiviert.", + "yes": "Yes" } \ No newline at end of file diff --git a/public/locales/de/wallet.json b/public/locales/de/wallet.json new file mode 100644 index 000000000..14daba8a5 --- /dev/null +++ b/public/locales/de/wallet.json @@ -0,0 +1,4 @@ +{ + "keychain-access": "Keychain Access", + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" +} \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index ec8890c57..45614d5fa 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -7,6 +7,7 @@ "critical-error": "Critical error", "day": "Day", "disconnect": "Disconnect", + "dismiss": "Dismiss", "hashrate": "Hashrate", "installation-problem": "Installation problem", "max-temperature": "Max temperature", @@ -28,5 +29,6 @@ "utilization": "Utilization", "version": "Version", "versions": "Versions", - "webgl-not-supported": "WebGL not supported. Disabled visual mode." + "webgl-not-supported": "WebGL not supported. Disabled visual mode.", + "yes": "Yes" } \ No newline at end of file diff --git a/public/locales/en/wallet.json b/public/locales/en/wallet.json new file mode 100644 index 000000000..14daba8a5 --- /dev/null +++ b/public/locales/en/wallet.json @@ -0,0 +1,4 @@ +{ + "keychain-access": "Keychain Access", + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" +} \ No newline at end of file diff --git a/public/locales/fr/common.json b/public/locales/fr/common.json index 939002009..221303d46 100644 --- a/public/locales/fr/common.json +++ b/public/locales/fr/common.json @@ -7,6 +7,7 @@ "critical-error": "Erreur critique", "day": "Jour", "disconnect": "Déconnecter", + "dismiss": "Dismiss", "hashrate": "Taux de hachage", "installation-problem": "Installation problem", "max-temperature": "Température maximale", @@ -28,5 +29,6 @@ "utilization": "Utilisation", "version": "Version", "versions": "Versions", - "webgl-not-supported": "WebGL non pris en charge. Mode visuel désactivé." + "webgl-not-supported": "WebGL non pris en charge. Mode visuel désactivé.", + "yes": "Yes" } \ No newline at end of file diff --git a/public/locales/fr/wallet.json b/public/locales/fr/wallet.json new file mode 100644 index 000000000..14daba8a5 --- /dev/null +++ b/public/locales/fr/wallet.json @@ -0,0 +1,4 @@ +{ + "keychain-access": "Keychain Access", + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" +} \ No newline at end of file diff --git a/public/locales/hi/common.json b/public/locales/hi/common.json index 496edb6aa..2fded7c09 100644 --- a/public/locales/hi/common.json +++ b/public/locales/hi/common.json @@ -7,6 +7,7 @@ "critical-error": "गंभीर त्रुटि", "day": "दिन", "disconnect": "डिस्कनेक्ट करें", + "dismiss": "Dismiss", "hashrate": "हैश दर", "installation-problem": "Installation problem", "max-temperature": "अधिकतम तापमान", @@ -28,5 +29,6 @@ "utilization": "उपयोग", "version": "संस्करण", "versions": "संस्करण", - "webgl-not-supported": "WebGL समर्थित नहीं है। दृश्य मोड अक्षम किया गया।" + "webgl-not-supported": "WebGL समर्थित नहीं है। दृश्य मोड अक्षम किया गया।", + "yes": "Yes" } \ No newline at end of file diff --git a/public/locales/hi/wallet.json b/public/locales/hi/wallet.json new file mode 100644 index 000000000..14daba8a5 --- /dev/null +++ b/public/locales/hi/wallet.json @@ -0,0 +1,4 @@ +{ + "keychain-access": "Keychain Access", + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" +} \ No newline at end of file diff --git a/public/locales/id/common.json b/public/locales/id/common.json index b0bed0dfe..1447cb541 100644 --- a/public/locales/id/common.json +++ b/public/locales/id/common.json @@ -7,6 +7,7 @@ "critical-error": "Kesalahan kritis", "day": "Hari", "disconnect": "Putuskan Koneksi", + "dismiss": "Dismiss", "hashrate": "Hashrate", "installation-problem": "Installation problem", "max-temperature": "Suhu maksimum", @@ -28,5 +29,6 @@ "utilization": "Pemanfaatan", "version": "Versi", "versions": "Versi", - "webgl-not-supported": "WebGL tidak didukung. Mode visual dinonaktifkan." + "webgl-not-supported": "WebGL tidak didukung. Mode visual dinonaktifkan.", + "yes": "Yes" } \ No newline at end of file diff --git a/public/locales/id/wallet.json b/public/locales/id/wallet.json new file mode 100644 index 000000000..14daba8a5 --- /dev/null +++ b/public/locales/id/wallet.json @@ -0,0 +1,4 @@ +{ + "keychain-access": "Keychain Access", + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" +} \ No newline at end of file diff --git a/public/locales/ja/common.json b/public/locales/ja/common.json index fa9db31df..a064e3a4f 100644 --- a/public/locales/ja/common.json +++ b/public/locales/ja/common.json @@ -7,6 +7,7 @@ "critical-error": "重大なエラー", "day": "日", "disconnect": "切断", + "dismiss": "Dismiss", "hashrate": "ハッシュレート", "installation-problem": "Installation problem", "max-temperature": "最大温度", @@ -28,5 +29,6 @@ "utilization": "利用率", "version": "バージョン", "versions": "バージョン", - "webgl-not-supported": "WebGLがサポートされていません。ビジュアルモードが無効になりました。" + "webgl-not-supported": "WebGLがサポートされていません。ビジュアルモードが無効になりました。", + "yes": "Yes" } \ No newline at end of file diff --git a/public/locales/ja/wallet.json b/public/locales/ja/wallet.json new file mode 100644 index 000000000..14daba8a5 --- /dev/null +++ b/public/locales/ja/wallet.json @@ -0,0 +1,4 @@ +{ + "keychain-access": "Keychain Access", + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" +} \ No newline at end of file diff --git a/public/locales/ko/common.json b/public/locales/ko/common.json index 0c929b243..3be890e11 100644 --- a/public/locales/ko/common.json +++ b/public/locales/ko/common.json @@ -7,6 +7,7 @@ "critical-error": "치명적 오류", "day": "일", "disconnect": "연결 해제", + "dismiss": "Dismiss", "hashrate": "해시레이트", "installation-problem": "Installation problem", "max-temperature": "최대 온도", @@ -28,5 +29,6 @@ "utilization": "활용도", "version": "버전", "versions": "버전", - "webgl-not-supported": "WebGL이 지원되지 않습니다. 시각 모드가 비활성화되었습니다." + "webgl-not-supported": "WebGL이 지원되지 않습니다. 시각 모드가 비활성화되었습니다.", + "yes": "Yes" } \ No newline at end of file diff --git a/public/locales/ko/wallet.json b/public/locales/ko/wallet.json new file mode 100644 index 000000000..14daba8a5 --- /dev/null +++ b/public/locales/ko/wallet.json @@ -0,0 +1,4 @@ +{ + "keychain-access": "Keychain Access", + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" +} \ No newline at end of file diff --git a/public/locales/pl/common.json b/public/locales/pl/common.json index bbdc2e7ae..a2526d849 100644 --- a/public/locales/pl/common.json +++ b/public/locales/pl/common.json @@ -7,6 +7,7 @@ "critical-error": "Krytyczny błąd", "day": "Dzień", "disconnect": "Odłącz", + "dismiss": "Dismiss", "hashrate": "Prędkość ( hashrate )", "installation-problem": "Installation problem", "max-temperature": "Maksymalna temperatura", @@ -28,5 +29,6 @@ "utilization": "Wykorzystanie", "version": "Wersja", "versions": "Wersje", - "webgl-not-supported": "WebGL nie jest obsługiwany. Tryb wizualny wyłączony." + "webgl-not-supported": "WebGL nie jest obsługiwany. Tryb wizualny wyłączony.", + "yes": "Yes" } \ No newline at end of file diff --git a/public/locales/pl/wallet.json b/public/locales/pl/wallet.json new file mode 100644 index 000000000..14daba8a5 --- /dev/null +++ b/public/locales/pl/wallet.json @@ -0,0 +1,4 @@ +{ + "keychain-access": "Keychain Access", + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" +} \ No newline at end of file diff --git a/public/locales/ru/common.json b/public/locales/ru/common.json index 086772191..185325d8a 100644 --- a/public/locales/ru/common.json +++ b/public/locales/ru/common.json @@ -7,6 +7,7 @@ "critical-error": "Критическая ошибка", "day": "День", "disconnect": "Отключить", + "dismiss": "Dismiss", "hashrate": "Хэшрейт", "installation-problem": "Installation problem", "max-temperature": "Максимальная температура", @@ -28,5 +29,6 @@ "utilization": "Использование", "version": "Версия", "versions": "Версии", - "webgl-not-supported": "WebGL не поддерживается. Визуальный режим отключен." + "webgl-not-supported": "WebGL не поддерживается. Визуальный режим отключен.", + "yes": "Yes" } \ No newline at end of file diff --git a/public/locales/ru/wallet.json b/public/locales/ru/wallet.json new file mode 100644 index 000000000..14daba8a5 --- /dev/null +++ b/public/locales/ru/wallet.json @@ -0,0 +1,4 @@ +{ + "keychain-access": "Keychain Access", + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" +} \ No newline at end of file diff --git a/public/locales/tr/common.json b/public/locales/tr/common.json index 907809255..ec3704f93 100644 --- a/public/locales/tr/common.json +++ b/public/locales/tr/common.json @@ -7,6 +7,7 @@ "critical-error": "Kritik Hata", "day": "Gün", "disconnect": "Bağlantıyı Kes", + "dismiss": "Dismiss", "hashrate": "Hashrate", "installation-problem": "Installation problem", "max-temperature": "Maks. Sıcaklık", @@ -28,5 +29,6 @@ "utilization": "Fayda", "version": "Versiyon", "versions": "Versiyon", - "webgl-not-supported": "WebGL desteklenmiyor. Görsel mod devre dışı bırakıldı." + "webgl-not-supported": "WebGL desteklenmiyor. Görsel mod devre dışı bırakıldı.", + "yes": "Yes" } \ No newline at end of file diff --git a/public/locales/tr/wallet.json b/public/locales/tr/wallet.json new file mode 100644 index 000000000..14daba8a5 --- /dev/null +++ b/public/locales/tr/wallet.json @@ -0,0 +1,4 @@ +{ + "keychain-access": "Keychain Access", + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" +} \ No newline at end of file diff --git a/src-tauri/src/app_config.rs b/src-tauri/src/app_config.rs index 8ca20cde9..77fe9c6e1 100644 --- a/src-tauri/src/app_config.rs +++ b/src-tauri/src/app_config.rs @@ -20,7 +20,7 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use crate::credential_manager::{Credential, KEYRING_ACCESSED}; +use crate::credential_manager::{Credential, KEYRING_ACCESSED, USING_FALLBACK}; use std::{path::PathBuf, time::SystemTime}; use sys_locale::get_locale; @@ -98,6 +98,8 @@ pub struct AppConfigFromFile { auto_update: bool, #[serde(default = "default_false")] keyring_accessed: bool, + #[serde(default = "default_false")] + keyring_fallback: bool, #[serde(default = "default_true")] custom_power_levels_enabled: bool, #[serde(default = "default_true")] @@ -143,6 +145,7 @@ impl Default for AppConfigFromFile { mmproxy_monero_nodes: vec!["https://xmr-01.tari.com".to_string()], mmproxy_use_monero_fail: false, keyring_accessed: false, + keyring_fallback: false, auto_update: true, reset_earnings: false, custom_power_levels_enabled: true, @@ -257,6 +260,7 @@ pub(crate) struct AppConfig { custom_max_gpu_usage: Vec, auto_update: bool, keyring_accessed: bool, + keyring_fallback: bool, custom_power_levels_enabled: bool, sharing_enabled: bool, visual_mode: bool, @@ -306,6 +310,7 @@ impl AppConfig { window_settings: default_window_settings(), show_experimental_settings: false, keyring_accessed: false, + keyring_fallback: false, p2pool_stats_server_port: default_p2pool_stats_server_port(), } } @@ -388,6 +393,11 @@ impl AppConfig { config.keyring_accessed, std::sync::atomic::Ordering::Relaxed, ); + + USING_FALLBACK.store( + config.keyring_fallback, + std::sync::atomic::Ordering::Relaxed, + ); } Err(e) => { warn!(target: LOG_TARGET, "Failed to parse app config: {}", e.to_string()); @@ -763,6 +773,7 @@ impl AppConfig { mmproxy_monero_nodes: self.mmproxy_monero_nodes.clone(), mmproxy_use_monero_fail: self.mmproxy_use_monero_fail, keyring_accessed: KEYRING_ACCESSED.load(std::sync::atomic::Ordering::Relaxed), + keyring_fallback: USING_FALLBACK.load(std::sync::atomic::Ordering::Relaxed), auto_update: self.auto_update, custom_power_levels_enabled: self.custom_power_levels_enabled, sharing_enabled: self.sharing_enabled, diff --git a/src-tauri/src/credential_manager.rs b/src-tauri/src/credential_manager.rs index 1f9968ae5..0f8f4176c 100644 --- a/src-tauri/src/credential_manager.rs +++ b/src-tauri/src/credential_manager.rs @@ -60,6 +60,7 @@ const KEYCHAIN_USERNAME_LEGACY: &str = "internal_wallet"; const KEYCHAIN_USERNAME: &str = "inner_wallet_credentials"; pub static KEYRING_ACCESSED: AtomicBool = AtomicBool::new(false); +pub static USING_FALLBACK: AtomicBool = AtomicBool::new(false); pub struct CredentialManager { service_name: String, @@ -130,7 +131,11 @@ impl CredentialManager { } fn use_fallback(&self) -> bool { - self.fallback_mode.load(Ordering::SeqCst) || self.fallback_file().exists() + let use_fallback = + self.fallback_mode.load(Ordering::SeqCst) || self.fallback_file().exists(); + USING_FALLBACK.store(use_fallback, Ordering::SeqCst); + + use_fallback } fn set_fallback_mode(&self) -> bool { diff --git a/src/components/elements/buttons/button.types.ts b/src/components/elements/buttons/button.types.ts index bbee20e15..ccba57f64 100644 --- a/src/components/elements/buttons/button.types.ts +++ b/src/components/elements/buttons/button.types.ts @@ -3,7 +3,7 @@ import { ThemeColourGroup } from '@app/theme/palettes/colors.ts'; export type ButtonVariant = 'primary' | 'secondary' | 'outlined' | 'gradient'; export type ButtonSize = 'xs' | 'small' | 'medium' | 'large'; -export type ButtonColor = 'transparent' | 'primary' | 'secondary' | 'gradient' | 'error' | 'warning' | 'info'; +export type ButtonColor = 'transparent' | 'error' | 'warning' | 'info' | ThemeColourGroup; export type IconPosition = 'end' | 'start' | 'hug'; diff --git a/src/components/elements/styled.ts b/src/components/elements/styled.ts index cc52e3ccb..af2109dc4 100644 --- a/src/components/elements/styled.ts +++ b/src/components/elements/styled.ts @@ -1,6 +1,6 @@ import { createElement, CSSProperties, ReactNode } from 'react'; -import styled from 'styled-components'; +import styled, { css } from 'styled-components'; import { TagVariants } from '@app/components/elements/Typography.tsx'; interface TypographyProps { @@ -13,11 +13,20 @@ export const DynamicTypography = styled(({ variant = 'span', children, ...props createElement(variant, props, children) )` font-family: ${({ fontFamily }) => fontFamily}; - font-size: ${({ theme, variant }) => (variant === 'span' ? 'inherit' : theme.typography[variant].fontSize)}; + font-size: ${({ theme, variant }) => theme.typography[variant].fontSize}; line-height: ${({ theme, variant }) => theme.typography[variant].lineHeight}; letter-spacing: ${({ theme, variant }) => theme.typography[variant].letterSpacing}; font-weight: ${({ theme, variant }) => theme.typography[variant].fontWeight || 'inherit'}; margin: 0; color: inherit; text-align: inherit; + + ${({ variant }) => + variant === 'span' && + css` + font-size: inherit; + line-height: inherit; + letter-spacing: inherit; + font-weight: inherit; + `} `; diff --git a/src/containers/floating/FloatingElements.tsx b/src/containers/floating/FloatingElements.tsx index f7fc7963a..6efe5915b 100644 --- a/src/containers/floating/FloatingElements.tsx +++ b/src/containers/floating/FloatingElements.tsx @@ -11,6 +11,7 @@ import AdminUI from '@app/components/AdminUI/AdminUI.tsx'; import { ToastStack } from '@app/components/ToastStack/ToastStack.tsx'; import { CriticalProblemDialog } from './CriticalProblemDialog/CriticalProblemDialog.tsx'; import ShellOfSecrets from '../main/ShellOfSecrets/ShellOfSecrets.tsx'; +import { KeyringAccessDialog } from './KeyringAccess/KeyringAccessDialog.tsx'; const environment = import.meta.env.MODE; @@ -20,6 +21,7 @@ export default function FloatingElements() { + diff --git a/src/containers/floating/KeyringAccess/KeyringAccessDialog.styles.ts b/src/containers/floating/KeyringAccess/KeyringAccessDialog.styles.ts new file mode 100644 index 000000000..294c8509c --- /dev/null +++ b/src/containers/floating/KeyringAccess/KeyringAccessDialog.styles.ts @@ -0,0 +1,19 @@ +import styled from 'styled-components'; + +export const Wrapper = styled.div` + display: flex; + flex-direction: column; + align-items: center; + width: 620px; + text-align: center; + gap: 16px; + white-space: pre-wrap; + padding: 16px; + font-size: 14px; + line-height: 1.3; +`; + +export const ButtonWrapper = styled.div` + display: flex; + gap: 8px; +`; diff --git a/src/containers/floating/KeyringAccess/KeyringAccessDialog.tsx b/src/containers/floating/KeyringAccess/KeyringAccessDialog.tsx new file mode 100644 index 000000000..677729351 --- /dev/null +++ b/src/containers/floating/KeyringAccess/KeyringAccessDialog.tsx @@ -0,0 +1,33 @@ +import { Dialog, DialogContent } from '@app/components/elements/dialog/Dialog.tsx'; +import { useUIStore } from '@app/store/useUIStore.ts'; +import { ButtonWrapper, Wrapper } from './KeyringAccessDialog.styles.ts'; +import { Typography } from '@app/components/elements/Typography.tsx'; +import { Button } from '@app/components/elements/buttons/Button.tsx'; +import { useTranslation } from 'react-i18next'; + +export const KeyringAccessDialog = () => { + const { t } = useTranslation(['wallet', 'common']); + const dialogToShow = useUIStore((s) => s.dialogToShow); + const setDialogToShow = useUIStore((s) => s.setDialogToShow); + + function handleClose() { + setDialogToShow(null); + } + return ( + + + + {t('keychain-access')} + {t('keychain-access-copy')} + + + + + + + + + ); +}; diff --git a/src/store/useAppConfigStore.ts b/src/store/useAppConfigStore.ts index ece45bcec..ab0372bf6 100644 --- a/src/store/useAppConfigStore.ts +++ b/src/store/useAppConfigStore.ts @@ -71,6 +71,12 @@ export const useAppConfigStore = create()((set, getState) = try { const appConfig = await invoke('get_app_config'); set(appConfig); + const noKeychain = appConfig.keyring_fallback || !appConfig.keyring_accessed; + + if (noKeychain) { + const setDialogToShow = useUIStore.getState().setDialogToShow; + setDialogToShow('keyring'); + } const configTheme = appConfig.display_mode?.toLowerCase(); const canvasElement = document.getElementById('canvas'); if (canvasElement && !appConfig.visual_mode) { diff --git a/src/store/useUIStore.ts b/src/store/useUIStore.ts index d009c181c..c618a1c1e 100644 --- a/src/store/useUIStore.ts +++ b/src/store/useUIStore.ts @@ -4,7 +4,7 @@ import { Theme } from '@app/theme/types.ts'; import { animationDarkBg, animationLightBg, setAnimationProperties } from '@app/visuals.ts'; import { useAppConfigStore } from './useAppConfigStore.ts'; -export const DIALOG_TYPES = ['logs', 'restart', 'autoUpdate'] as const; +export const DIALOG_TYPES = ['logs', 'restart', 'autoUpdate', 'keyring'] as const; type DialogTypeTuple = typeof DIALOG_TYPES; export type DialogType = DialogTypeTuple[number]; diff --git a/src/theme/components.ts b/src/theme/components.ts index ffdeeca0a..5526b45ae 100644 --- a/src/theme/components.ts +++ b/src/theme/components.ts @@ -16,6 +16,7 @@ export const componentSettings = { lineHeight: 1.1, letterSpacing: '-0.1px', fontWeight: 'inherit', + fontSize: '16px', }, p: { fontSize: '12px', diff --git a/src/types/app-status.ts b/src/types/app-status.ts index e6f336e78..4f74b65d4 100644 --- a/src/types/app-status.ts +++ b/src/types/app-status.ts @@ -46,6 +46,8 @@ export interface AppConfig { show_experimental_settings: boolean; monero_address_is_generated?: boolean; created_at: string; + keyring_fallback: boolean; + keyring_accessed: boolean; p2pool_stats_server_port: number | null; } From 4f55c7e584cfbd6badc960075a95cc9a0157e102 Mon Sep 17 00:00:00 2001 From: Shannon Tenner Date: Tue, 10 Dec 2024 17:25:51 +0200 Subject: [PATCH 2/3] add undismissable banner in settings --- public/locales/af/wallet.json | 2 +- public/locales/cn/wallet.json | 2 +- public/locales/de/wallet.json | 2 +- public/locales/en/wallet.json | 2 +- public/locales/fr/wallet.json | 2 +- public/locales/hi/wallet.json | 2 +- public/locales/id/wallet.json | 2 +- public/locales/ja/wallet.json | 2 +- public/locales/ko/wallet.json | 2 +- public/locales/pl/wallet.json | 2 +- public/locales/ru/wallet.json | 2 +- public/locales/tr/wallet.json | 2 +- .../KeyringAccess/KeyringAccessDialog.tsx | 21 ++++++-- .../sections/wallet/WalletAddressMarkup.tsx | 2 +- .../sections/wallet/WalletSettings.tsx | 3 ++ .../wallet/components/KeychainWarning.tsx | 48 +++++++++++++++++++ 16 files changed, 82 insertions(+), 16 deletions(-) create mode 100644 src/containers/floating/Settings/sections/wallet/components/KeychainWarning.tsx diff --git a/public/locales/af/wallet.json b/public/locales/af/wallet.json index 14daba8a5..1427f3266 100644 --- a/public/locales/af/wallet.json +++ b/public/locales/af/wallet.json @@ -1,4 +1,4 @@ { "keychain-access": "Keychain Access", - "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" } \ No newline at end of file diff --git a/public/locales/cn/wallet.json b/public/locales/cn/wallet.json index 14daba8a5..1427f3266 100644 --- a/public/locales/cn/wallet.json +++ b/public/locales/cn/wallet.json @@ -1,4 +1,4 @@ { "keychain-access": "Keychain Access", - "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" } \ No newline at end of file diff --git a/public/locales/de/wallet.json b/public/locales/de/wallet.json index 14daba8a5..1427f3266 100644 --- a/public/locales/de/wallet.json +++ b/public/locales/de/wallet.json @@ -1,4 +1,4 @@ { "keychain-access": "Keychain Access", - "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" } \ No newline at end of file diff --git a/public/locales/en/wallet.json b/public/locales/en/wallet.json index 14daba8a5..1427f3266 100644 --- a/public/locales/en/wallet.json +++ b/public/locales/en/wallet.json @@ -1,4 +1,4 @@ { "keychain-access": "Keychain Access", - "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" } \ No newline at end of file diff --git a/public/locales/fr/wallet.json b/public/locales/fr/wallet.json index 14daba8a5..1427f3266 100644 --- a/public/locales/fr/wallet.json +++ b/public/locales/fr/wallet.json @@ -1,4 +1,4 @@ { "keychain-access": "Keychain Access", - "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" } \ No newline at end of file diff --git a/public/locales/hi/wallet.json b/public/locales/hi/wallet.json index 14daba8a5..1427f3266 100644 --- a/public/locales/hi/wallet.json +++ b/public/locales/hi/wallet.json @@ -1,4 +1,4 @@ { "keychain-access": "Keychain Access", - "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" } \ No newline at end of file diff --git a/public/locales/id/wallet.json b/public/locales/id/wallet.json index 14daba8a5..1427f3266 100644 --- a/public/locales/id/wallet.json +++ b/public/locales/id/wallet.json @@ -1,4 +1,4 @@ { "keychain-access": "Keychain Access", - "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" } \ No newline at end of file diff --git a/public/locales/ja/wallet.json b/public/locales/ja/wallet.json index 14daba8a5..1427f3266 100644 --- a/public/locales/ja/wallet.json +++ b/public/locales/ja/wallet.json @@ -1,4 +1,4 @@ { "keychain-access": "Keychain Access", - "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" } \ No newline at end of file diff --git a/public/locales/ko/wallet.json b/public/locales/ko/wallet.json index 14daba8a5..1427f3266 100644 --- a/public/locales/ko/wallet.json +++ b/public/locales/ko/wallet.json @@ -1,4 +1,4 @@ { "keychain-access": "Keychain Access", - "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" } \ No newline at end of file diff --git a/public/locales/pl/wallet.json b/public/locales/pl/wallet.json index 14daba8a5..1427f3266 100644 --- a/public/locales/pl/wallet.json +++ b/public/locales/pl/wallet.json @@ -1,4 +1,4 @@ { "keychain-access": "Keychain Access", - "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" } \ No newline at end of file diff --git a/public/locales/ru/wallet.json b/public/locales/ru/wallet.json index 14daba8a5..1427f3266 100644 --- a/public/locales/ru/wallet.json +++ b/public/locales/ru/wallet.json @@ -1,4 +1,4 @@ { "keychain-access": "Keychain Access", - "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" } \ No newline at end of file diff --git a/public/locales/tr/wallet.json b/public/locales/tr/wallet.json index 14daba8a5..1427f3266 100644 --- a/public/locales/tr/wallet.json +++ b/public/locales/tr/wallet.json @@ -1,4 +1,4 @@ { "keychain-access": "Keychain Access", - "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" + "keychain-access-copy": "Your seed words are vulnerable because they are stored locally on disk.\nDo you want to move them to the keychain?" } \ No newline at end of file diff --git a/src/containers/floating/KeyringAccess/KeyringAccessDialog.tsx b/src/containers/floating/KeyringAccess/KeyringAccessDialog.tsx index 677729351..49c25150d 100644 --- a/src/containers/floating/KeyringAccess/KeyringAccessDialog.tsx +++ b/src/containers/floating/KeyringAccess/KeyringAccessDialog.tsx @@ -3,7 +3,8 @@ import { useUIStore } from '@app/store/useUIStore.ts'; import { ButtonWrapper, Wrapper } from './KeyringAccessDialog.styles.ts'; import { Typography } from '@app/components/elements/Typography.tsx'; import { Button } from '@app/components/elements/buttons/Button.tsx'; -import { useTranslation } from 'react-i18next'; +import { Trans, useTranslation } from 'react-i18next'; +import { addToast } from '@app/components/ToastStack/useToastStore.tsx'; export const KeyringAccessDialog = () => { const { t } = useTranslation(['wallet', 'common']); @@ -13,18 +14,32 @@ export const KeyringAccessDialog = () => { function handleClose() { setDialogToShow(null); } + + function handleKeychain() { + addToast({ + title: 'Add to keychain', + text: 'BE stuff should happen now', + }); + } return ( {t('keychain-access')} - {t('keychain-access-copy')} + + , + }} + /> + - + diff --git a/src/containers/floating/Settings/sections/wallet/WalletAddressMarkup.tsx b/src/containers/floating/Settings/sections/wallet/WalletAddressMarkup.tsx index b1203da0b..495bc8cbd 100644 --- a/src/containers/floating/Settings/sections/wallet/WalletAddressMarkup.tsx +++ b/src/containers/floating/Settings/sections/wallet/WalletAddressMarkup.tsx @@ -33,7 +33,6 @@ const DotContainer = styled.div` const AddressContainer = styled.div` overflow-x: auto; font-size: 12px; - letter-spacing: 1px; line-height: 1.3; width: 100%; height: 40px; @@ -121,6 +120,7 @@ const WalletAddressMarkup = () => { { const monero_address_is_generated = useAppConfigStore((s) => s.monero_address_is_generated); + const seedword_not_in_keychain = useAppConfigStore((s) => s.keyring_fallback || !s.keyring_accessed); return ( <> + {seedword_not_in_keychain && } diff --git a/src/containers/floating/Settings/sections/wallet/components/KeychainWarning.tsx b/src/containers/floating/Settings/sections/wallet/components/KeychainWarning.tsx new file mode 100644 index 000000000..89b2a8f45 --- /dev/null +++ b/src/containers/floating/Settings/sections/wallet/components/KeychainWarning.tsx @@ -0,0 +1,48 @@ +import styled from 'styled-components'; +import { Trans } from 'react-i18next'; +import { PiWarning } from 'react-icons/pi'; +import { Typography } from '@app/components/elements/Typography.tsx'; +import { addToast } from '@app/components/ToastStack/useToastStore.tsx'; + +const Wrapper = styled.div` + border-radius: ${({ theme }) => theme.shape.borderRadius.app}; + background-color: ${({ theme }) => theme.palette.warning.light}; + color: ${({ theme }) => theme.palette.warning.dark}; + padding: 8px 14px; + display: flex; + flex-direction: row; + white-space: pre-wrap; + align-items: center; + gap: 10px; + margin-bottom: 20px; + h6 { + line-height: 1.3; + } + + span { + font-weight: 700; + cursor: pointer; + } +`; + +export const KeychainWarning = () => { + function handleKeychain() { + addToast({ + title: 'Add to keychain', + text: 'BE stuff should happen now', + }); + } + return ( + + + + , + }} + /> + + + ); +}; From 9b8398c789092fd8830c116a4fb51e59cba5f417 Mon Sep 17 00:00:00 2001 From: Shannon Tenner Date: Tue, 10 Dec 2024 17:45:40 +0200 Subject: [PATCH 3/3] fix button prop --- .../ExternalDependenciesDialog/ExternalDependencyCard.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/containers/floating/ExternalDependenciesDialog/ExternalDependencyCard.tsx b/src/containers/floating/ExternalDependenciesDialog/ExternalDependencyCard.tsx index 6c3c60383..28baa605d 100644 --- a/src/containers/floating/ExternalDependenciesDialog/ExternalDependencyCard.tsx +++ b/src/containers/floating/ExternalDependenciesDialog/ExternalDependencyCard.tsx @@ -73,7 +73,6 @@ export const ExternalDependencyCard = ({ {status === ExternalDependencyStatus.NotInstalled && (