From 3b245e16db3f2f1dcf7be529e92bd45dde99f792 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Thu, 7 Apr 2022 11:34:48 +0100 Subject: [PATCH] more multi account UI work --- nym-wallet/package.json | 1 + .../src/components/Accounts.stories.tsx | 5 +- nym-wallet/src/components/Accounts.tsx | 64 +++++++++++++++---- 3 files changed, 55 insertions(+), 15 deletions(-) diff --git a/nym-wallet/package.json b/nym-wallet/package.json index 7d055fb77e..d550b3d3e0 100644 --- a/nym-wallet/package.json +++ b/nym-wallet/package.json @@ -42,6 +42,7 @@ "react-hook-form": "^7.14.2", "react-router-dom": "^5.2.0", "semver": "^6.3.0", + "string-to-color": "^2.2.2", "use-clipboard-copy": "^0.2.0", "yup": "^0.32.9" }, diff --git a/nym-wallet/src/components/Accounts.stories.tsx b/nym-wallet/src/components/Accounts.stories.tsx index c753f18d89..fd34e2a97b 100644 --- a/nym-wallet/src/components/Accounts.stories.tsx +++ b/nym-wallet/src/components/Accounts.stories.tsx @@ -1,3 +1,4 @@ +import React from 'react'; import { Box } from '@mui/material'; import { ComponentMeta, ComponentStory } from '@storybook/react'; import { Accounts } from 'src/components/Accounts'; @@ -16,7 +17,7 @@ const Template: ComponentStory = (args) => ( export const Default = Template.bind({}); Default.args = { accounts: [ - { name: 'Account 1', address: 'abcdefg' }, - { name: 'Account 2', address: 'tuvwxyz' }, + { name: 'Account 1', address: 'abcd1234uvw987xyz' }, + { name: 'Account 2', address: 'cd102034u087xyz' }, ], }; diff --git a/nym-wallet/src/components/Accounts.tsx b/nym-wallet/src/components/Accounts.tsx index 4e30a6c6b0..c1c4c6c30b 100644 --- a/nym-wallet/src/components/Accounts.tsx +++ b/nym-wallet/src/components/Accounts.tsx @@ -1,12 +1,55 @@ import React, { useState } from 'react'; -import { Button, Dialog, DialogContent, DialogTitle } from '@mui/material'; -import { Circle } from '@mui/icons-material'; +import { Box, Button, Dialog, DialogActions, DialogContent, DialogTitle, IconButton, Typography } from '@mui/material'; +import stc from 'string-to-color'; +import { Add, Circle, Close, Edit } from '@mui/icons-material'; +import { NymCard } from './NymCard'; export type TAccount = { name: string; address: string; }; +const AccountColor = ({ address }: { address: string }) => ; + +const AccountItem = ({ name, address }: { name: string; address: string }) => ( + + + + } + /> +); + +const AccountModal = ({ show, addresses, onClose }: { show: boolean; addresses: TAccount[]; onClose: () => void }) => ( + + + + Account + + + + + + Switch between accounts + + + + {addresses.map(({ name, address }) => ( + + ))} + + + + + +); + export const Accounts = ({ accounts }: { accounts: TAccount[] }) => { const [addresses, setAddresses] = useState(accounts); const [selectedAddress, setSelectedAddress] = useState(accounts[0]); @@ -14,19 +57,14 @@ export const Accounts = ({ accounts }: { accounts: TAccount[] }) => { return ( <> - - setShowDialog(false)} /> + setShowDialog(false)} addresses={addresses} /> ); }; - -const AccountModal = ({ show, onClose }: { show: boolean; onClose: () => void }) => { - return ( - - Yo - Content - - ); -};