Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor integrations #1

Merged
merged 2 commits into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/containers/PaperWalletModal/PaperWalletModal.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import GreenModal from '@app/components/GreenModal/GreenModal';
import { AnimatePresence } from 'framer-motion';
import { useEffect, useState } from 'react';
import { useCallback, useEffect, useState } from 'react';
import ConnectSection from './sections/ConnectSection/ConnectSection';
import QRCodeSection from './sections/QRCodeSection/QRCodeSection';
import { usePaperWalletStore } from '@app/store/usePaperWalletStore';
import { invoke } from '@tauri-apps/api/tauri';

export type PaperWalletModalSectionType = 'Connect' | 'QRCode';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ import {
Wrapper,
} from './styles';
import qrMainImage from '../../images/qr-main.png';
import { useEffect, useState } from 'react';
import { useCallback, useEffect, useState } from 'react';
import ShowIcon from '../../icons/ShowIcon';
import HideIcon from '../../icons/HideIcon';
import { useTranslation } from 'react-i18next';
import { invoke } from '@tauri-apps/api/tauri';
import { CircularProgress } from '@app/components/elements/CircularProgress';
import QRCode from 'react-qr-code';

interface Props {
onDoneClick: () => void;
Expand All @@ -31,10 +34,31 @@ export default function QRCodeSection({ onDoneClick }: Props) {
const [showCode, setShowCode] = useState(false);
const [copied, setCopied] = useState(false);

const identificationCode = '123456';
const [qrCodeValue, setValue] = useState('');
const [identificationCode, setIdentificationCode] = useState('');
const [isLoading, setIsLoading] = useState(false);

const load = useCallback(async () => {
setIsLoading(true);
const r = await invoke('get_paper_wallet_details');

if (r) {
const url = r.qr_link;
const password = r.password;

setValue(url);
setIdentificationCode(password);
}
setIsLoading(false);
}, []);

useEffect(() => {
load();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

const handleTextButtonClick = () => {
console.log('Help');
// TODO add help link
};

const handleVisibleToggleClick = () => {
Expand All @@ -54,11 +78,22 @@ export default function QRCodeSection({ onDoneClick }: Props) {
}
}, [copied]);

if (isLoading)
return (
<Wrapper>
<CircularProgress />
</Wrapper>
);

return (
<Wrapper>
<CodeWrapper>
<QRCodeWrapper>
<QRCodeImage src={qrMainImage} alt="" />
<QRCode
size={200}
style={{ height: 'auto', maxWidth: '100%', width: '100%' }}
value={qrCodeValue}
/>
</QRCodeWrapper>

<QRContentWrapper>
Expand Down Expand Up @@ -90,7 +125,9 @@ export default function QRCodeSection({ onDoneClick }: Props) {
<span>{t('qrcode.blackButton')}</span>
</BlackButton>

<TextButton onClick={handleTextButtonClick}>{t('qrcode.textButton')}</TextButton>
{
// <TextButton onClick={handleTextButtonClick}>{t('qrcode.textButton')}</TextButton>
}
</ButtonWrapper>
</Wrapper>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export const ButtonWrapper = styled('div')`
export const QRCodeWrapper = styled('div')`
border-radius: 15px;
background: #000;
padding: 20px;
padding: 10px;
min-width: 200px;
`;

export const QRCodeImage = styled('img')`
Expand Down Expand Up @@ -92,7 +93,7 @@ export const InputField = styled('input')`
padding: 18px 18px 0 18px;

color: #000;
font-size: 32px;
font-size: 18px;
font-weight: 600;
text-align: center;

Expand Down
2 changes: 0 additions & 2 deletions src/containers/Settings/WalletSettings.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import WalletAddressMarkup from './sections/wallet/WalletAddressMarkup.tsx';
import MoneroAddressMarkup from './sections/wallet/MoneroAddressMarkup';
import SeedWordsMarkup from './sections/wallet/SeedWordsMarkup/SeedWordsMarkup.tsx';
import PaperWallet from '@app/containers/Settings/sections/wallet/PaperWallet.tsx';

export const WalletSettings = () => {
return (
<>
<WalletAddressMarkup />
<SeedWordsMarkup />
<MoneroAddressMarkup />
<PaperWallet />
</>
);
};
108 changes: 0 additions & 108 deletions src/containers/Settings/sections/wallet/PaperWallet.tsx

This file was deleted.