From 545545ac2513b83004ff9823f9e70ee722a5c0a8 Mon Sep 17 00:00:00 2001 From: Ilias Trichopoulos Date: Wed, 28 Jun 2023 11:44:52 +0100 Subject: [PATCH] Show disclaimer in lang other than English Closes #545 --- locales/en-US/translation.json | 4 +- .../Inputs/InlineLabelValueInput.tsx | 41 ++++++------------- .../SettingsModal/GeneralSettingsSection.tsx | 35 ++++++++++++++-- 3 files changed, 47 insertions(+), 33 deletions(-) diff --git a/locales/en-US/translation.json b/locales/en-US/translation.json index e4de7c7e0..0b326fe2b 100644 --- a/locales/en-US/translation.json +++ b/locales/en-US/translation.json @@ -434,5 +434,7 @@ "Your Wallet": "Your Wallet", "{{ amount }} words entered": "{{ amount }} words entered", "{{ number }} selected": "{{ number }} selected", - "No NFTs found.": "No NFTs found." + "No NFTs found.": "No NFTs found.", + "Disclaimer": "Disclaimer", + "The wallet is developed in English.
Translations in other languages are provided by the Alephium community.
In case of doubt, always refer to the English version.": "The wallet is developed in English.
Translations in other languages are provided by the Alephium community.
In case of doubt, always refer to the English version." } diff --git a/src/components/Inputs/InlineLabelValueInput.tsx b/src/components/Inputs/InlineLabelValueInput.tsx index b00746a95..4b4ba55f0 100644 --- a/src/components/Inputs/InlineLabelValueInput.tsx +++ b/src/components/Inputs/InlineLabelValueInput.tsx @@ -16,19 +16,14 @@ You should have received a copy of the GNU Lesser General Public License along with the library. If not, see . */ -import { Info } from 'lucide-react' import { ReactNode } from 'react' -import { useTranslation } from 'react-i18next' import styled from 'styled-components' -import ActionLink from '@/components/ActionLink' -import { openInWebBrowser } from '@/utils/misc' - interface InlineLabelValueInputProps { label: ReactNode InputComponent: ReactNode description?: string - moreInfoLink?: string + children?: ReactNode className?: string } @@ -36,26 +31,18 @@ const InlineLabelValueInput = ({ label, InputComponent, description, - moreInfoLink, + children, className -}: InlineLabelValueInputProps) => { - const { t } = useTranslation() - - return ( - - - - {description && {description}} - {moreInfoLink && ( - openInWebBrowser(moreInfoLink)}> - {t('More info')} - - )} - - {InputComponent} - - ) -} +}: InlineLabelValueInputProps) => ( + + + + {description && {description}} + {children} + + {InputComponent} + +) export default InlineLabelValueInput @@ -88,7 +75,3 @@ const InputContainer = styled.div` justify-content: flex-end; flex: 1; ` - -const ActionLinkStyled = styled(ActionLink)` - gap: 0.3em; -` diff --git a/src/modals/SettingsModal/GeneralSettingsSection.tsx b/src/modals/SettingsModal/GeneralSettingsSection.tsx index 9ce45aa56..d9692b9bb 100644 --- a/src/modals/SettingsModal/GeneralSettingsSection.tsx +++ b/src/modals/SettingsModal/GeneralSettingsSection.tsx @@ -16,10 +16,13 @@ You should have received a copy of the GNU Lesser General Public License along with the library. If not, see . */ +import { AlertTriangle, Info } from 'lucide-react' import { usePostHog } from 'posthog-js/react' import { useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' +import styled from 'styled-components' +import ActionLink from '@/components/ActionLink' import Box from '@/components/Box' import HorizontalDivider from '@/components/Dividers/HorizontalDivider' import KeyValueInput from '@/components/Inputs/InlineLabelValueInput' @@ -41,6 +44,7 @@ import { import { switchTheme } from '@/storage/settings/settingsStorageUtils' import { Currency, Language, ThemeSettings } from '@/types/settings' import { links } from '@/utils/links' +import { openInWebBrowser } from '@/utils/misc' import { fiatCurrencyOptions, languageOptions, locktimeInMinutes } from '@/utils/settings' interface GeneralSettingsSectionProps { @@ -201,7 +205,18 @@ const GeneralSettingsSection = ({ className }: GeneralSettingsSectionProps) => { heightSize="small" /> } - /> + > + {language !== 'en-US' && ( + Translations in other languages are provided by the Alephium community.
In case of doubt, always refer to the English version.' + )} + data-tooltip-id="default" + > + {t('Disclaimer')} +
+ )} + { } - /> + > + openInWebBrowser(links.analytics)}> + {t('More info')} + + {isPasswordModelOpen && ( setIsPasswordModalOpen(false)} focusMode skipFocusOnMount> @@ -241,3 +259,14 @@ const GeneralSettingsSection = ({ className }: GeneralSettingsSectionProps) => { } export default GeneralSettingsSection + +const ActionLinkStyled = styled(ActionLink)` + gap: 0.3em; +` + +const Disclaimer = styled.div` + display: flex; + align-items: center; + gap: 0.3em; + color: ${({ theme }) => theme.global.highlight}; +`