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

Release v2.1.0 #30

Merged
merged 4 commits into from
Dec 10, 2023
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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "realtoken-dashboard-v2",
"version": "2.0.2",
"version": "2.1.0",
"scripts": {
"dev": "next dev",
"build": "next build",
Expand Down
11 changes: 8 additions & 3 deletions src/components/assetPage/assetPageTransfersTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import {
RealTokenTransfer,
TransferOrigin,
} from 'src/repositories/transferts.repository'
import { selectAddressList } from 'src/store/features/settings/settingsSelector'
import {
selectAllUserAddressList,
selectUserAddressList,
} from 'src/store/features/settings/settingsSelector'
import { UserRealtoken } from 'src/store/features/wallets/walletsSelector'

function getTransferTitle(item: RealTokenTransfer) {
Expand Down Expand Up @@ -80,15 +83,17 @@ const TransferRow: FC<{ item: RealTokenTransfer }> = ({ item }) => {
export const AssetPageTransfersTab: FC<{ data: UserRealtoken }> = ({
data,
}) => {
const addressList = useSelector(selectAddressList)
const addressList = useSelector(selectUserAddressList)
const allAddressList = useSelector(selectAllUserAddressList)
const [transfers, setTransfers] = useState<RealTokenTransfer[]>([])

useEffect(() => {
GetRealTokenTransfers({
addressList: addressList,
allAddressList: allAddressList,
realtokenList: [data],
}).then((item) => setTransfers(item))
}, [data, addressList])
}, [data, addressList, allAddressList])

return (
<table style={{ width: '100%' }}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/layouts/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { MediaQuery, createStyles } from '@mantine/core'
import { useModals } from '@mantine/modals'

import {
selectCleanedAddressList,
selectIsInitialized,
selectUserAddressList,
} from 'src/store/features/settings/settingsSelector'

import { Footer } from './Footer'
Expand Down Expand Up @@ -43,7 +43,7 @@ export const MainLayout: FC<MainLayoutProps> = ({ children }) => {
const { classes } = useStyles()

const isInitialized = useSelector(selectIsInitialized)
const addressList = useSelector(selectCleanedAddressList)
const addressList = useSelector(selectUserAddressList)
const modals = useModals()

useEffect(() => {
Expand Down
64 changes: 56 additions & 8 deletions src/components/layouts/WalletMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ import {
selectIsInitialized,
selectUser,
} from 'src/store/features/settings/settingsSelector'
import { setUserAddress } from 'src/store/features/settings/settingsSlice'
import { User, setUserAddress } from 'src/store/features/settings/settingsSlice'

import { IntegerField, StringField } from '../commons'

interface WalletItemProps {
address: string
isVisible?: boolean
}

const useStyles = createStyles({
address: {
span: { fontFamily: 'monospace', fontSize: '12px' },
span: { fontFamily: 'monospace', fontSize: '11px' },
},
})

Expand All @@ -45,21 +46,64 @@ const WalletItem: FC<WalletItemProps> = (props) => {
variant={'dot'}
fullWidth={true}
className={classes.address}
style={{ textTransform: 'none', justifyContent: 'space-between' }}
style={{
textTransform: 'none',
justifyContent: 'space-between',
opacity: props.isVisible ? 0.5 : 1,
}}
>
{EthersUtils.getAddress(props.address)}
</Badge>
)
}
WalletItem.displayName = 'WalletItem'

const WalletItemList: FC<{ addressList: string[] }> = (props) => {
const AddWalletButton: FC<{ onClick?: () => void }> = (props) => {
const modals = useModals()
const { t } = useTranslation('common', { keyPrefix: 'manageWalletModal' })

function openModal() {
props.onClick?.()
modals.openContextModal('manageWalletModal', {
innerProps: {},
closeOnClickOutside: false,
closeOnEscape: false,
})
}

return (
<>
<Button
onClick={openModal}
size={'xs'}
compact={true}
variant={'outline'}
>
{t('open')}
</Button>
</>
)
}
AddWalletButton.displayName = 'AddWalletButton'

const WalletItemList: FC<{ user: User }> = (props) => {
const addresses = [
...(props.user?.addressList ?? []),
...(props.user?.customAddressList ?? []),
]

const hiddenAddressList = props.user?.hiddenAddressList ?? []

return (
<Flex direction={'column'} gap={'xs'}>
{props.addressList
{addresses
.filter((item) => item)
.map((address) => (
<WalletItem key={address} address={address} />
.map((item) => (
<WalletItem
key={item}
address={item}
isVisible={hiddenAddressList.includes(item)}
/>
))}
</Flex>
)
Expand Down Expand Up @@ -140,7 +184,11 @@ export const WalletMenu: FC = () => {

<Menu.Divider my={'xs'} />

<WalletItemList addressList={user.addressList} />
<WalletItemList user={user} />

<Box ta={'center'} mb={'xs'} mt={'sm'}>
<AddWalletButton onClick={handlers.close} />
</Box>

<Menu.Divider mt={'xs'} />
</>
Expand Down
Loading