Skip to content

Commit

Permalink
Merge branch 'develop' into fix/fix-ledger-popup-on-send
Browse files Browse the repository at this point in the history
  • Loading branch information
Tuditi authored Feb 21, 2024
2 parents f53a048 + 084f750 commit 964d8dd
Show file tree
Hide file tree
Showing 38 changed files with 658 additions and 265 deletions.
24 changes: 7 additions & 17 deletions packages/desktop/components/ProposalCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
import { EventStatus } from '@iota/sdk/out/types'
import { ProposalStatusInfo } from '@views/governance'
import { Text } from '@ui'
import { FontWeight } from '@ui/enums'
import { TooltipIcon, IconName } from '@bloomwalletio/ui'
import { Text, TooltipIcon, IconName } from '@bloomwalletio/ui'
import { darkMode } from '@core/app/stores'
import { localize } from '@core/i18n'
import { GovernanceRoute, governanceRouter } from '@core/router'
Expand Down Expand Up @@ -37,34 +34,27 @@
<proposal-card
on:click={onProposalClick}
on:keydown={(e) => e.key === 'Enter' && onProposalClick()}
class:dark={$darkMode}
class:ended={proposal?.status === EventStatus.Ended}
class="flex flex-col p-6 border border-solid border-gray-200 dark:border-transparent rounded-xl cursor-pointer h-fit shadow-elevation-1 focus:shadow-inner
{proposal?.status === EventStatus.Ended ? 'bg-transparent dark:bg-gray-900' : 'bg-white dark:bg-gray-800'}"
{proposal?.status === EventStatus.Ended
? 'bg-surface-1 dark:bg-surface-1-dark'
: 'bg-surface-0 dark:bg-surface-0-dark'}"
>
<div class="flex items-center gap-1.5 mb-4">
{#if proposal.organization}
<TooltipIcon icon={proposal.organization.icon} tooltip={proposal.organization.name} size="sm" />
{/if}
<Text fontWeight={FontWeight.semibold} fontSize="14" classes="truncate" lineHeight="5">{proposal.title}</Text>
<Text truncate>{proposal.title}</Text>
</div>
<div class="flex justify-between items-center">
<ProposalStatusInfo {proposal} />
{#if hasVoted}
<!-- TODO: Add correct icon once we have designs -->
<TooltipIcon
tooltip={localize('views.governance.proposals.voted')}
icon={IconName.Bank}
icon={IconName.PackageCheck}
size="sm"
placement="left"
textColor="brand"
/>
{/if}
</div>
</proposal-card>

<style lang="scss">
proposal-card.ended,
proposal-card.dark.ended {
@apply bg-transparent;
}
</style>
3 changes: 0 additions & 3 deletions packages/desktop/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export * from './drawers'
export * from './filter'
export * from './menus'
export * from './modals'
export * from './panes'
export * from './popup'

export { default as AccountSwitcher } from './AccountSwitcher.svelte'
Expand All @@ -16,11 +15,9 @@ export { default as FormattedBalance } from './FormattedBalance.svelte'
export { default as NavbarContainer } from './NavbarContainer.svelte'
export { default as NetworkCard } from './NetworkCard.svelte'
export { default as NodeListTable } from './NodeListTable.svelte'
export { default as Proposals } from './Proposals.svelte'
export { default as ProposalAnswer } from './ProposalAnswer.svelte'
export { default as ProposalCard } from './ProposalCard.svelte'
export { default as ProposalsDetails } from './ProposalsDetails.svelte'
export { default as ProposalQuestion } from './ProposalQuestion.svelte'
export { default as SidebarTab } from './SidebarTab.svelte'
export { default as StatusTile, type StatusTileProps } from './StatusTile.svelte'
export { default as TitleBar } from './TitleBar.svelte'
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop/components/menus/ProposalDetailsMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@
function setItems(proposal: IProposal, isVotingForProposal: boolean): void {
items = [
{
icon: IconName.SettingsSliders,
title: localize('actions.changeNode'),
icon: IconName.LinkHorizontal,
title: localize('actions.changeNodeUrl'),
onClick: onChangeNodeClick,
},
{
Expand Down
1 change: 0 additions & 1 deletion packages/desktop/components/panes/index.ts

This file was deleted.

4 changes: 4 additions & 0 deletions packages/desktop/components/popup/Popup.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
import ManageVotingPowerPopup from './popups/ManageVotingPowerPopup.svelte'
import MintNativeTokenConfirmationPopup from './popups/MintNativeTokenConfirmationPopup.svelte'
import MintNativeTokenFormPopup from './popups/MintNativeTokenFormPopup.svelte'
import MintNftCollectionConfirmationPopup from './popups/MintNftCollectionConfirmationPopup.svelte'
import MintNftCollectionFormPopup from './popups/MintNftCollectionFormPopup.svelte'
import MintNftConfirmationPopup from './popups/MintNftConfirmationPopup.svelte'
import MintNftFormPopup from './popups/MintNftFormPopup.svelte'
import NodeAuthRequiredPopup from './popups/NodeAuthRequiredPopup.svelte'
Expand Down Expand Up @@ -119,6 +121,8 @@
[PopupId.MintNativeTokenForm]: MintNativeTokenFormPopup,
[PopupId.MintNftConfirmation]: MintNftConfirmationPopup,
[PopupId.MintNftForm]: MintNftFormPopup,
[PopupId.MintNftCollectionForm]: MintNftCollectionFormPopup,
[PopupId.MintNftCollectionConfirmation]: MintNftCollectionConfirmationPopup,
[PopupId.NodeAuthRequired]: NodeAuthRequiredPopup,
[PopupId.NodeInfo]: NodeInfoPopup,
[PopupId.ReceiveAddress]: ReceiveAddressPopup,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
<script lang="ts">
import { Table, Avatar, Tabs } from '@bloomwalletio/ui'
import { selectedAccount } from '@core/account/stores'
import { handleError } from '@core/error/handlers/handleError'
import { localize } from '@core/i18n'
import { CURRENT_IRC27_VERSION } from '@core/nfts'
import { getClient } from '@core/profile-manager'
import { checkActiveProfileAuthAsync, getBaseToken } from '@core/profile/actions'
import { formatTokenAmountPrecise } from '@core/token'
import { buildNftOutputBuilderParams, mintNftCollection, mintNftCollectionDetails } from '@core/wallet'
import { PopupId, closePopup, openPopup } from '@desktop/auxiliary/popup'
import { MediaIcon, PopupTab, getTabItems } from '@ui'
import { onMount } from 'svelte'
import PopupTemplate from '../PopupTemplate.svelte'
const TABS = getTabItems([PopupTab.Transaction, PopupTab.Nft, PopupTab.NftMetadata])
let selectedTab = TABS[0]
let storageDeposit: number = 0
const { standard, type, uri, name, issuerName, description, attributes } = $mintNftCollectionDetails || {}
$: irc27Metadata = {
standard,
version: CURRENT_IRC27_VERSION,
name,
type,
uri,
...(issuerName && { issuerName }),
...(description && { description }),
...(attributes && { attributes }),
}
async function setStorageDeposit(): Promise<void> {
try {
const outputData = buildNftOutputBuilderParams(irc27Metadata, $selectedAccount.depositAddress)
const client = await getClient()
const preparedOutput = await client.buildNftOutput(outputData)
storageDeposit = Number(preparedOutput.amount) ?? 0
} catch (err) {
handleError(err)
}
}
function onBackClick(): void {
closePopup()
openPopup({
id: PopupId.MintNftCollectionForm,
overflow: true,
confirmClickOutside: true,
})
}
async function onConfirmClick(): Promise<void> {
try {
await checkActiveProfileAuthAsync()
} catch (err) {
return
}
try {
await mintNftCollection(irc27Metadata)
closePopup()
} catch (err) {
handleError(err)
}
}
onMount(() => {
try {
void setStorageDeposit()
} catch (err) {
handleError(err)
}
})
</script>

<PopupTemplate
title={localize('popups.mintNftForm.title')}
backButton={{
text: localize('actions.back'),
disabled: $selectedAccount?.isTransferring,
onClick: onBackClick,
}}
continueButton={{
text: localize('actions.confirm'),
disabled: $selectedAccount?.isTransferring,
onClick: onConfirmClick,
}}
busy={$selectedAccount?.isTransferring}
>
<div class="max-h-100 scrollable-y flex-1">
<nft-details class="flex flex-col justify-center items-center space-y-5">
<Avatar size="lg" shape="square" surface={2}>
<MediaIcon {type} size="base" surface={2} />
</Avatar>
<activity-details class="w-full h-full space-y-2 flex flex-auto flex-col shrink-0">
<Tabs bind:selectedTab tabs={TABS} />
{#if selectedTab.key === PopupTab.Transaction}
<Table
items={[
{
key: localize('general.storageDeposit'),
value: formatTokenAmountPrecise(storageDeposit, getBaseToken()),
},
{
key: localize('general.immutableIssuer'),
value: $selectedAccount?.depositAddress,
truncate: true,
},
]}
/>
{:else if selectedTab.key === PopupTab.Nft}
<Table
items={[
{
key: localize('general.name'),
value: name,
},
{
key: localize('general.description'),
value: description ? description : undefined,
},
{
key: localize('general.uri'),
value: uri,
},
{
key: localize('general.issuerName'),
value: issuerName ? issuerName : undefined,
},
]}
/>
{:else if selectedTab.key === PopupTab.NftMetadata}
<Table
items={[
{
key: localize('general.metadata'),
value: irc27Metadata,
copyable: true,
},
]}
/>
{/if}
</activity-details>
</nft-details>
</div>
</PopupTemplate>
Loading

0 comments on commit 964d8dd

Please sign in to comment.