Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into chore/add-iota-evm
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuditi committed Apr 30, 2024
2 parents 0e2ffe2 + 4f5d520 commit 37760f6
Show file tree
Hide file tree
Showing 118 changed files with 1,139 additions and 794 deletions.
4 changes: 2 additions & 2 deletions packages/desktop/components/NetworkCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { openUrlInBrowser } from '@core/app'
import { handleError } from '@core/error/handlers'
import { localize } from '@core/i18n'
import { generateAndStoreEvmAddressForAccounts, pollL2BalanceForAccount } from '@core/layer-2/actions'
import { generateAndStoreEvmAddressForAccounts, pollEvmBalancesForAccount } from '@core/layer-2/actions'
import { LedgerAppName } from '@core/ledger'
import { ExplorerEndpoint, Network, NetworkNamespace, getDefaultExplorerUrl, setSelectedChain } from '@core/network'
import { ProfileType } from '@core/profile'
Expand Down Expand Up @@ -67,7 +67,7 @@
network.coinType,
$selectedAccount as IAccountState
)
pollL2BalanceForAccount($activeProfile.id, $selectedAccount as IAccountState)
pollEvmBalancesForAccount($activeProfile.id, $selectedAccount as IAccountState)
if ($activeProfile.type === ProfileType.Ledger) {
$networkConfigRouter.goTo(NetworkConfigRoute.ConfirmLedgerEvmAddress)
}
Expand Down
8 changes: 4 additions & 4 deletions packages/desktop/components/menus/TokenActionsMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@
}
function onUnverifyClick(): void {
unverifyToken(token.id, NotVerifiedStatus.Skipped)
unverifyToken(token, NotVerifiedStatus.Skipped)
updatePopupProps({
token: { ...token, verification: { verified: false, status: NotVerifiedStatus.Skipped } },
})
menu?.close()
}
function onVerifyClick(): void {
verifyToken(token.id, VerifiedStatus.SelfVerified)
verifyToken(token, VerifiedStatus.SelfVerified)
updatePopupProps({
token: { ...token, verification: { verified: true, status: VerifiedStatus.SelfVerified } },
})
menu?.close()
}
function onUnhideClick(): void {
unhideToken(token.id)
unhideToken(token)
hideActivitiesForHiddenTokens()
updatePopupProps({
token: { ...token, hidden: false },
Expand All @@ -48,7 +48,7 @@
}
function onHideClick(): void {
hideToken(token.id)
hideToken(token)
hideActivitiesForHiddenTokens()
updatePopupProps({
token: { ...token, hidden: true },
Expand Down
8 changes: 4 additions & 4 deletions packages/desktop/components/menus/TokenListMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
import { showNotification } from '@auxiliary/notification'
import { IconName, Menu } from '@bloomwalletio/ui'
import { localize } from '@core/i18n'
import { refreshAccountTokensForActiveProfile } from '@core/token/actions'
import { loadTokensForAllAccountBalances } from '@core/token/actions'
import { PopupId, closePopup, openPopup } from '../../lib/auxiliary/popup'
import { fetchL2BalanceForAllAccounts } from '@core/layer-2'
import { fetchEvmBalancesForAllAccounts } from '@core/layer-2'
let menu: Menu | undefined = undefined
function onSyncTokensClick(): void {
fetchL2BalanceForAllAccounts($activeProfileId as string, true)
fetchEvmBalancesForAllAccounts($activeProfileId as string, true)
showNotification({
variant: 'success',
text: localize('notifications.syncTokens.success'),
Expand All @@ -27,7 +27,7 @@
}
function refreshTokenMetadata(): void {
refreshAccountTokensForActiveProfile(true)
loadTokensForAllAccountBalances(true)
showNotification({
variant: 'success',
text: localize('notifications.refreshTokenMetadata.success'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@
import { Error } from '@bloomwalletio/ui'
import { handleError } from '@core/error/handlers/handleError'
import PopupTemplate from '../PopupTemplate.svelte'
import { getBaseToken } from '@core/profile/actions'
let isBusy = false
let error: string | undefined
const network = getL1Network()
async function onConfirmClick(): Promise<void> {
error = undefined
try {
Expand All @@ -33,7 +34,7 @@
<PopupTemplate
title={localize('popups.faucetRequest.title')}
description={localize('popups.faucetRequest.body', {
values: { token: getBaseToken().name, network: getL1Network()?.name },
values: { token: network.baseToken.name, network: network.name },
})}
backButton={{
text: localize('actions.cancel'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import { selectedAccount } from '@core/account/stores'
import { setClipboard } from '@core/utils'
import { getActiveNetworkId, getNetwork, NetworkId, NetworkNamespace } from '@core/network'
import { generateAndStoreEvmAddressForAccounts, pollL2BalanceForAccount } from '@core/layer-2/actions'
import { activeProfile, activeProfileId } from '@core/profile/stores'
import { generateAndStoreEvmAddressForAccounts, pollEvmBalancesForAccount } from '@core/layer-2/actions'
import { activeProfile } from '@core/profile/stores'
import { checkActiveProfileAuth } from '@core/profile/actions'
import { LedgerAppName } from '@core/ledger'
import PopupTemplate from '../PopupTemplate.svelte'
Expand Down Expand Up @@ -42,7 +42,7 @@
try {
await generateAndStoreEvmAddressForAccounts($activeProfile.type, coinType, account)
pollL2BalanceForAccount($activeProfileId as string, account)
pollEvmBalancesForAccount($activeProfile.id, account)
updateNetworkNameAndAddress()
} catch (error) {
handleError(error)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { checkActiveProfileAuth, getBaseToken, loadAccounts } from '@core/profile/actions'
import { activeAccounts, activeProfile, getActiveProfileId, visibleActiveAccounts } from '@core/profile/stores'
import { formatTokenAmountBestMatch } from '@core/token'
import { refreshAccountTokensForActiveProfile } from '@core/token/actions'
import { loadTokensForAllAccountBalances } from '@core/token/actions'
import { closePopup } from '@desktop/auxiliary/popup'
import { onDestroy } from 'svelte'
import PopupTemplate from '../PopupTemplate.svelte'
Expand Down Expand Up @@ -134,7 +134,7 @@
onDestroy(async () => {
if (hasUsedWalletFinder) {
const profileId = getActiveProfileId()
await refreshAccountTokensForActiveProfile()
await loadTokensForAllAccountBalances()
await generateAndStoreActivitiesForAllAccounts(profileId)
loadNftsForActiveProfile()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
import { SendFlowRoute, SendFlowRouter, sendFlowRouter } from '@views/dashboard/send-flow'
import PopupTemplate from '../PopupTemplate.svelte'
export let token: ITokenWithBalance | undefined
export let token: ITokenWithBalance
export let activityId: string | undefined = undefined
$: isNewToken = token?.verification?.status === NotVerifiedStatus.New
$: isNewToken = token.verification?.status === NotVerifiedStatus.New
function onSkipClick(): void {
unverifyToken(token?.id, NotVerifiedStatus.Skipped)
unverifyToken(token, NotVerifiedStatus.Skipped)
if (activityId) {
openPopup({
id: PopupId.ActivityDetails,
Expand All @@ -31,7 +31,7 @@
}
function onVerifyClick(): void {
verifyToken(token?.id, VerifiedStatus.SelfVerified)
verifyToken(token, VerifiedStatus.SelfVerified)
if (activityId) {
openPopup({
id: PopupId.ActivityDetails,
Expand All @@ -45,7 +45,7 @@
}
function onSendClick(): void {
const sendFlowType = token?.id === BASE_TOKEN_ID ? SendFlowType.BaseCoinTransfer : SendFlowType.TokenTransfer
const sendFlowType = token.id === BASE_TOKEN_ID ? SendFlowType.BaseCoinTransfer : SendFlowType.TokenTransfer
setSendFlowParameters({
type: sendFlowType,
[sendFlowType]: {
Expand All @@ -62,7 +62,7 @@
</script>

<PopupTemplate
title={token?.metadata?.name}
title={token.metadata?.name}
backButton={isNewToken
? {
text: localize('actions.skip'),
Expand All @@ -75,7 +75,7 @@
}}
>
<div slot="menu">
{#if token?.standard === TokenStandard.Irc30 || token?.standard === TokenStandard.Erc20}
{#if token.standard === TokenStandard.Irc30 || token.standard === TokenStandard.Erc20}
<TokenActionsMenu {token} />
{/if}
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop/features/network.features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const networkFeatures: INetworkFeatures = {
},
},
evmNetworks: {
enabled: true,
enabled: false,
},
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<script lang="ts">
import { Collection } from '@core/nfts'
import { selectedCollectionId } from '@core/nfts/stores'
import { NftGallery } from '@ui'
import { onDestroy } from 'svelte'
export let collection: Collection
onDestroy(() => {
$selectedCollectionId = undefined
})
</script>

<NftGallery nfts={collection.nfts} />
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<script lang="ts">
import CollectionsGalleryItem from './CollectionsGalleryItem.svelte'
import { Collection, Collections } from '@core/nfts'
import VirtualList from '@sveltejs/svelte-virtual-list'
import { breakpoint } from '@core/app/stores'
export let collections: Collections
$: collectionsArray = Object.entries(collections).map(([id, collection]) => {
return { id, ...collection }
})
const COLLECTIONS_PER_CHUNK_FOR_SCREEN_SIZE = {
sm: 2,
md: 3,
lg: 3,
xl: 4,
'2xl': 5,
}
let rowDivElement: HTMLDivElement
$: rowDivHeight = getRowDivHeight(rowDivElement?.clientHeight)
function getRowDivHeight(clientHeight: number | undefined) {
if (!clientHeight) {
return rowDivHeight
}
if (!rowDivElement) {
return clientHeight
}
if (Math.abs(clientHeight - rowDivHeight) > 200) {
return rowDivHeight
}
return clientHeight
}
let collectionChunks: (Collection | undefined)[][] = []
$: collectionChunks = Array.from(
{ length: Math.ceil(collectionsArray.length / COLLECTIONS_PER_CHUNK_FOR_SCREEN_SIZE[$breakpoint]) },
(_, i) => {
return Array.from(
{ length: COLLECTIONS_PER_CHUNK_FOR_SCREEN_SIZE[$breakpoint] },
(_, j) => collectionsArray[i * COLLECTIONS_PER_CHUNK_FOR_SCREEN_SIZE[$breakpoint] + j]
)
}
)
</script>

<VirtualList items={collectionChunks} let:item itemHeight={rowDivHeight}>
<div
bind:this={rowDivElement}
class="grid sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-3 xl:grid-cols-4 2xl:grid-cols-5 gap-3 2xl:gap-4 pb-3 2xl:pb-4"
>
{#each item as collection}
{#if collection}
<CollectionsGalleryItem {collection} />
{:else}
<div />
{/if}
{/each}
</div>
</VirtualList>
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<script lang="ts">
import { Collection } from '@core/nfts'
import { AssetPillsForNft, MediaPlaceholder, NetworkAvatar, NftMedia } from '@ui'
import { Pill, Text } from '@bloomwalletio/ui'
import { downloadingNftId, selectedCollectionId } from '@core/nfts/stores'
import { localize } from '@core/i18n'
import { CollectiblesRoute, collectiblesRouter } from '@core/router'
export let collection: Collection
function onCollectionClick(): void {
$selectedCollectionId = collection.id
$collectiblesRouter?.goTo(CollectiblesRoute.Details)
$collectiblesRouter?.setBreadcrumb(collection.name)
}
</script>

<button type="button" on:click={onCollectionClick}>
<div class="container">
<div class="flex-1 flex relative bg-surface-2 dark:bg-surface-2-dark rounded-t-[0.9rem] overflow-hidden">
<!-- TODO: change media to collection URI instead of first NFT URI -->
<NftMedia nft={collection.nfts[0]} classes="min-w-full min-h-full object-cover" loop muted>
<MediaPlaceholder
type={collection.nfts[0]?.type}
downloading={$downloadingNftId === collection.nfts[0]?.id}
size="md"
slot="placeholder"
/>
</NftMedia>
</div>
<div class="w-full flex flex-col gap-2 p-3">
<nft-name class="w-full flex flex-row items-center gap-2 overflow-hidden">
<Text type="body2" truncate>{collection.name}</Text>
</nft-name>
<nft-pills class="flex flex-row items-center gap-2">
<NetworkAvatar networkId={collection.nfts[0].networkId} size="sm" showTooltip />
<AssetPillsForNft nft={collection.nfts[0]} />
<Pill compact color="brand">{localize('general.nfts', { count: collection.nfts.length })}</Pill>
</nft-pills>
</div>
</div>
</button>

<style lang="postcss">
.container {
@apply relative w-full flex flex-col mt-4;
@apply divide-y divide-solid divide-stroke dark:divide-stroke-dark;
@apply rounded-2xl border-2 border-solid border-stroke dark:border-stroke-dark;
@apply bg-surface-1 dark:bg-surface-1-dark;
@apply duration-300 z-[2];
transition-property: background-color, border-color, box-shadow;
aspect-ratio: 3 / 4;
&:hover,
&:focus {
@apply shadow-lg dark:shadow-violet-900/25;
@apply border-2 border-brand-500;
@apply bg-surface dark:bg-surface-dark;
}
}
button {
@apply relative;
&::after,
&::before {
@apply content-[''] absolute block left-0 right-0 z-[1];
@apply rounded-2xl border-t-2 border-x-2 border-solid border-stroke dark:border-stroke-dark;
@apply bg-surface-1 dark:bg-surface-1-dark;
aspect-ratio: 3 / 4;
}
&::after {
@apply top-2.5 mx-2;
}
&::before {
@apply top-[0.2rem] mx-4 blur-[1px];
}
}
</style>
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export { default as CollectiblesTabs } from './CollectiblesTabs.svelte'
export { default as CollectionDetails } from './CollectionDetails.svelte'
export { default as CollectionsGallery } from './CollectionsGallery.svelte'
export { default as Erc721CollectibleDetails } from './Erc721CollectibleDetails.svelte'
export { default as Irc27CollectibleDetails } from './Irc27CollectibleDetails.svelte'
Loading

0 comments on commit 37760f6

Please sign in to comment.