Skip to content

Commit

Permalink
add undismissable banner in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
shanimal08 committed Dec 10, 2024
1 parent 723fe9d commit 4f55c7e
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 16 deletions.
2 changes: 1 addition & 1 deletion public/locales/af/wallet.json
Original file line number Diff line number Diff line change
@@ -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 <span>move them to the keychain?</span>"
}
2 changes: 1 addition & 1 deletion public/locales/cn/wallet.json
Original file line number Diff line number Diff line change
@@ -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 <span>move them to the keychain?</span>"
}
2 changes: 1 addition & 1 deletion public/locales/de/wallet.json
Original file line number Diff line number Diff line change
@@ -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 <span>move them to the keychain?</span>"
}
2 changes: 1 addition & 1 deletion public/locales/en/wallet.json
Original file line number Diff line number Diff line change
@@ -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 <span>move them to the keychain?</span>"
}
2 changes: 1 addition & 1 deletion public/locales/fr/wallet.json
Original file line number Diff line number Diff line change
@@ -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 <span>move them to the keychain?</span>"
}
2 changes: 1 addition & 1 deletion public/locales/hi/wallet.json
Original file line number Diff line number Diff line change
@@ -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 <span>move them to the keychain?</span>"
}
2 changes: 1 addition & 1 deletion public/locales/id/wallet.json
Original file line number Diff line number Diff line change
@@ -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 <span>move them to the keychain?</span>"
}
2 changes: 1 addition & 1 deletion public/locales/ja/wallet.json
Original file line number Diff line number Diff line change
@@ -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 <span>move them to the keychain?</span>"
}
2 changes: 1 addition & 1 deletion public/locales/ko/wallet.json
Original file line number Diff line number Diff line change
@@ -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 <span>move them to the keychain?</span>"
}
2 changes: 1 addition & 1 deletion public/locales/pl/wallet.json
Original file line number Diff line number Diff line change
@@ -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 <span>move them to the keychain?</span>"
}
2 changes: 1 addition & 1 deletion public/locales/ru/wallet.json
Original file line number Diff line number Diff line change
@@ -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 <span>move them to the keychain?</span>"
}
2 changes: 1 addition & 1 deletion public/locales/tr/wallet.json
Original file line number Diff line number Diff line change
@@ -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 <span>move them to the keychain?</span>"
}
21 changes: 18 additions & 3 deletions src/containers/floating/KeyringAccess/KeyringAccessDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand All @@ -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 (
<Dialog open={dialogToShow === 'keyring'}>
<DialogContent $unPadded>
<Wrapper>
<Typography variant="h2">{t('keychain-access')}</Typography>
<Typography>{t('keychain-access-copy')}</Typography>
<Typography>
<Trans
i18nKey="wallet:keychain-access-copy"
components={{
span: <span />,
}}
/>
</Typography>

<ButtonWrapper>
<Button color="warning" onClick={() => handleClose()}>
{t('common:dismiss')}
</Button>
<Button>{t('common:yes')}</Button>
<Button onClick={() => handleKeychain()}>{t('common:yes')}</Button>
</ButtonWrapper>
</Wrapper>
</DialogContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -121,6 +120,7 @@ const WalletAddressMarkup = () => {
<Typography
style={{
color: '#b6b7c3',
letterSpacing: 1,
display: 'flex',
lineHeight: '1.6',
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import WalletAddressMarkup from './WalletAddressMarkup.tsx';
import MoneroAddressMarkup from './MoneroAddressMarkup';
import SeedWordsMarkup from './SeedWordsMarkup/SeedWordsMarkup.tsx';
import MoneroSeedWordSettings from './MoneroSeedWords/MoneroSeedWordSettings.tsx';
import { KeychainWarning } from '@app/containers/floating/Settings/sections/wallet/components/KeychainWarning.tsx';

export const WalletSettings = () => {
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 && <KeychainWarning />}
<WalletAddressMarkup />
<SeedWordsMarkup />
<MoneroAddressMarkup />
Expand Down
Original file line number Diff line number Diff line change
@@ -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 (
<Wrapper>
<PiWarning size={38} />
<Typography variant="h6">
<Trans
i18nKey="wallet:keychain-access-copy"
components={{
span: <span onClick={handleKeychain} />,
}}
/>
</Typography>
</Wrapper>
);
};

0 comments on commit 4f55c7e

Please sign in to comment.