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

chore: use popupid everywhere #5930

Merged
merged 2 commits into from Feb 21, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/desktop/App.svelte
Expand Up @@ -27,7 +27,7 @@
setPlatform,
} from '@core/app'
import { showAppNotification } from '@auxiliary/notification'
import { closePopup, openPopup, popupState } from '@auxiliary/popup'
import { closePopup, openPopup, PopupId, popupState } from '@auxiliary/popup'
import { initialiseOnboardingFlow } from '@contexts/onboarding'
import { NetworkProtocol, NetworkType } from '@core/network'
import { getLocalisedMenuItems } from './lib/helpers'
Expand Down Expand Up @@ -127,17 +127,17 @@
})
Platform.onEvent('menu-check-for-update', () => {
openPopup({
id: 'version',
id: PopupId.Version,
props: {
currentVersion: $appVersionDetails.currentVersion,
},
})
})
Platform.onEvent('menu-error-log', () => {
openPopup({ id: 'errorLog' })
openPopup({ id: PopupId.ErrorLog })
})
Platform.onEvent('menu-diagnostics', () => {
openPopup({ id: 'diagnostics' })
openPopup({ id: PopupId.Diagnostics })
})
Platform.onEvent('menu-create-developer-profile', () => {
void initialiseOnboardingFlow({
Expand Down
Expand Up @@ -8,7 +8,7 @@
import { activeProfile, visibleActiveAccounts } from '@core/profile'
import { formatTokenAmountBestMatch } from '@core/wallet'
import { Icon as IconEnum } from '@auxiliary/icon'
import { openPopup } from '@auxiliary/popup'
import { openPopup, PopupId } from '@auxiliary/popup'

export let modal: Modal = undefined

Expand All @@ -22,7 +22,7 @@

function handleCreateAccountClick(): void {
modal?.close()
openPopup({ id: 'createAccount' })
openPopup({ id: PopupId.CreateAccount })
}
</script>

Expand Down
Expand Up @@ -27,7 +27,7 @@
import { activeProfile, checkActiveProfileAuth } from '@core/profile'
import { setClipboard } from '@core/utils'
import { truncateString } from '@core/utils'
import { closePopup, openPopup } from '@auxiliary/popup'
import { closePopup, openPopup, PopupId } from '@auxiliary/popup'
import { onMount } from 'svelte'
import { ExplorerEndpoint } from '@core/network'

Expand Down Expand Up @@ -96,7 +96,7 @@
async function claim(): Promise<void> {
await claimActivity(activity)
openPopup({
id: 'activityDetails',
id: PopupId.ActivityDetails,
props: { activityId },
})
}
Expand All @@ -107,7 +107,7 @@

function reject(): void {
openPopup({
id: 'confirmation',
id: PopupId.Confirmation,
props: {
title: localize('actions.confirmRejection.title'),
description: localize('actions.confirmRejection.description'),
Expand All @@ -121,7 +121,7 @@
},
onCancel: () =>
openPopup({
id: 'activityDetails',
id: PopupId.ActivityDetails,
props: { activityId },
}),
},
Expand Down
3 changes: 2 additions & 1 deletion packages/desktop/components/popups/AddProposalPopup.svelte
Expand Up @@ -11,6 +11,7 @@
import { registeredProposalsForSelectedAccount } from '@contexts/governance'
import { activeAccounts } from '@core/profile'
import { selectedAccount } from '@core/account'
import { PopupId } from '@auxiliary/popup'

export let eventId: string
export let nodeUrl: string
Expand Down Expand Up @@ -64,7 +65,7 @@

function openNodeAuthRequiredPopup(): void {
openPopup({
id: 'nodeAuthRequired',
id: PopupId.NodeAuthRequired,
props: { onSubmit: registerParticipationWrapper },
})
}
Expand Down
@@ -1,7 +1,7 @@
<script lang="ts">
import { Button, Text, TextHint, FontWeight, TextType, ButtonVariant, KeyValueBox } from 'shared/components'
import { localize } from '@core/i18n'
import { closePopup, openPopup } from '@auxiliary/popup'
import { closePopup, openPopup, PopupId } from '@auxiliary/popup'
import { burnAsset, formatTokenAmountBestMatch, IAsset } from '@core/wallet'
import { checkActiveProfileAuth } from '@core/profile'
import { handleError } from '@core/error/handlers'
Expand All @@ -16,7 +16,7 @@

function onBack(): void {
openPopup({
id: 'burnNativeTokens',
id: PopupId.BurnNativeTokens,
props: { asset, rawAmount },
})
}
Expand Down
@@ -1,7 +1,7 @@
<script lang="ts">
import { Button, Text, TextHint, FontWeight, TextType, AssetAmountInput } from 'shared/components'
import { localize } from '@core/i18n'
import { closePopup, openPopup } from '@auxiliary/popup'
import { closePopup, openPopup, PopupId } from '@auxiliary/popup'
import { IAsset } from '@core/wallet'

export let asset: IAsset
Expand All @@ -13,7 +13,7 @@
try {
await assetAmountInput.validate()
openPopup({
id: 'burnNativeTokensConfirm',
id: PopupId.BurnNativeTokensConfirmation,
props: { asset, rawAmount },
})
} catch (err) {
Expand Down
Expand Up @@ -13,6 +13,7 @@
import { onMount } from 'svelte'
import { modifyPopupState } from '@auxiliary/popup/helpers'
import { isSelectedAccountVoting } from '@contexts/governance/utils'
import { PopupId } from '@auxiliary/popup'

export let _onMount: (..._: any[]) => Promise<void> = async () => {}
export let newVotingPower: string = undefined
Expand Down Expand Up @@ -48,7 +49,7 @@

const isVoting = isSelectedAccountVoting()
if (amount === '0' && isVoting) {
openPopup({ id: 'votingPowerToZero' })
openPopup({ id: PopupId.VotingPowerToZero })
return
}

Expand Down
Expand Up @@ -9,7 +9,7 @@
formatTokenAmountPrecise,
IIrc30Metadata,
} from '@core/wallet'
import { closePopup, openPopup } from '@auxiliary/popup'
import { closePopup, openPopup, PopupId } from '@auxiliary/popup'
import { Button, KeyValueBox, Text, FontWeight } from 'shared/components'
import { onMount } from 'svelte'
import { selectedAccount } from '@core/account'
Expand Down Expand Up @@ -93,7 +93,7 @@
function handleBack(): void {
closePopup()
openPopup({
id: 'mintNativeTokenForm',
id: PopupId.MintNativeTokenForm,
overflow: true,
})
}
Expand Down
Expand Up @@ -2,7 +2,7 @@
import { BaseError } from '@core/error'
import { localize } from '@core/i18n'
import { setMintTokenDetails, mintTokenDetails } from '@core/wallet'
import { closePopup, openPopup } from '@auxiliary/popup'
import { closePopup, openPopup, PopupId } from '@auxiliary/popup'
import {
Button,
Error,
Expand Down Expand Up @@ -65,7 +65,7 @@
aliasId,
})
openPopup({
id: 'mintNativeTokenConfirmation',
id: PopupId.MintNativeTokenConfirmation,
overflow: true,
})
}
Expand Down
Expand Up @@ -6,7 +6,7 @@
import { buildNftOutputData, formatTokenAmountPrecise, mintNft, mintNftDetails } from '@core/wallet'
import { activeProfile, checkActiveProfileAuth } from '@core/profile'
import { handleError } from '@core/error/handlers/handleError'
import { closePopup, openPopup } from '@auxiliary/popup'
import { closePopup, openPopup, PopupId } from '@auxiliary/popup'
import { CURRENT_IRC27_VERSION } from '@core/nfts'
import { BASE_TOKEN } from '@core/network'

Expand Down Expand Up @@ -70,7 +70,7 @@
function handleBack(): void {
closePopup()
openPopup({
id: 'mintNftForm',
id: PopupId.MintNftForm,
overflow: true,
})
}
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop/components/popups/MintNftFormPopup.svelte
Expand Up @@ -11,7 +11,7 @@
NumberInput,
TooltipIcon,
} from 'shared/components'
import { closePopup, openPopup } from '@auxiliary/popup'
import { closePopup, openPopup, PopupId } from '@auxiliary/popup'
import { BaseError } from '@core/error/classes'
import { handleError } from '@core/error/handlers/handleError'
import { localize } from '@core/i18n'
Expand Down Expand Up @@ -64,7 +64,7 @@
if (valid) {
setMintNftDetails(convertInputsToMetadataType(optionalInputs))
openPopup({
id: 'mintNftConfirmation',
id: PopupId.MintNftConfirmation,
overflow: true,
})
}
Expand Down
Expand Up @@ -11,7 +11,7 @@
VerifiedStatus,
NewTransactionType,
} from '@core/wallet'
import { openPopup, updatePopupProps } from '@auxiliary/popup'
import { openPopup, PopupId, updatePopupProps } from '@auxiliary/popup'
import { AssetIcon, Button, Text, TextHint, AssetActionsButton, KeyValueBox, FontWeight } from 'shared/components'

export let asset: IAsset
Expand All @@ -21,7 +21,7 @@
unverifyAsset(asset.id, NotVerifiedStatus.Skipped)
if (activityId) {
openPopup({
id: 'activityDetails',
id: PopupId.ActivityDetails,
props: { activityId },
})
} else {
Expand All @@ -35,7 +35,7 @@
verifyAsset(asset.id, VerifiedStatus.SelfVerified)
if (activityId) {
openPopup({
id: 'activityDetails',
id: PopupId.ActivityDetails,
props: { activityId },
})
} else {
Expand All @@ -53,7 +53,7 @@
disableAssetSelection: true,
})
openPopup({
id: 'sendForm',
id: PopupId.SendForm,
overflow: true,
})
}
Expand Down
Expand Up @@ -9,6 +9,7 @@
import { checkActiveProfileAuth } from '@core/profile/actions'
import { closePopup, openPopup } from '@auxiliary/popup/actions'
import { popupState } from '@auxiliary/popup/stores'
import { PopupId } from '@auxiliary/popup'

const ZERO_VOTING_POWER = '0'

Expand All @@ -25,7 +26,7 @@

await checkActiveProfileAuth(async () => {
openPopup({
id: 'manageVotingPower',
id: PopupId.ManageVotingPower,
props: { newVotingPower: ZERO_VOTING_POWER },
})
await setVotingPower(ZERO_VOTING_POWER, true)
Expand Down
8 changes: 4 additions & 4 deletions packages/desktop/components/popups/WalletFinderPopup.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
import { onDestroy } from 'svelte'
import { Button, KeyValueBox, Text, TextHint, FontWeight } from 'shared/components'
import { closePopup, openPopup } from '@auxiliary/popup'
import { closePopup, openPopup, PopupId } from '@auxiliary/popup'
import { showAppNotification } from '@auxiliary/notification'
import { displayNotificationForLedgerProfile, ledgerNanoStatus } from '@core/ledger'
import { sumBalanceForAccounts } from '@core/account'
Expand Down Expand Up @@ -45,17 +45,17 @@
async function handleFindBalances(): Promise<void> {
if ($isSoftwareProfile && $isStrongholdLocked) {
openPopup({
id: 'unlockStronghold',
id: PopupId.UnlockStronghold,
props: {
onSuccess: function () {
openPopup({
id: 'walletFinder',
id: PopupId.WalletFinder,
props: { searchForBalancesOnLoad: true },
})
},
onCancelled: function () {
openPopup({
id: 'walletFinder',
id: PopupId.WalletFinder,
})
},
},
Expand Down
Expand Up @@ -36,7 +36,7 @@
getAssetById,
ActivityAction,
} from '@core/wallet'
import { closePopup, openPopup } from '@auxiliary/popup'
import { closePopup, openPopup, PopupId } from '@auxiliary/popup'
import { ledgerPreparedOutput } from '@core/ledger'
import { getStorageDepositFromOutput } from '@core/wallet/utils/generateActivity/helper'
import { handleError } from '@core/error/handlers/handleError'
Expand Down Expand Up @@ -191,7 +191,7 @@
function onBack(): void {
closePopup()
openPopup({
id: 'sendForm',
id: PopupId.SendForm,
overflow: true,
})
}
Expand Down
4 changes: 2 additions & 2 deletions packages/desktop/components/popups/send/SendFormPopup.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
import { closePopup, openPopup } from '@auxiliary/popup'
import { closePopup, openPopup, PopupId } from '@auxiliary/popup'
import { localize } from '@core/i18n'
import { isLayer1Destination } from '@core/layer-2'
import { selectedAccountNfts } from '@core/nfts'
Expand Down Expand Up @@ -148,7 +148,7 @@
if (valid) {
setTransactionDetails()
openPopup({
id: 'sendConfirmation',
id: PopupId.SendConfirmation,
overflow: true,
})
}
Expand Down
Expand Up @@ -32,6 +32,7 @@
OUTPUT_TYPE_NFT,
} from '@core/wallet'
import { NewTransactionType, selectedAccountActivities, setNewTransactionDetails } from '@core/wallet/stores'
import { PopupId } from '@auxiliary/popup'

let modal: Modal
let error: string
Expand Down Expand Up @@ -126,7 +127,7 @@
disableAssetSelection: true,
})
openPopup({
id: 'sendForm',
id: PopupId.SendForm,
overflow: true,
})
}
Expand Down
Expand Up @@ -43,6 +43,7 @@
clearParticipationEventStatusPoll,
pollParticipationEventStatus,
} from '@contexts/governance/actions/pollParticipationEventStatus'
import { PopupId } from '@auxiliary/popup'

const { metadata } = $visibleSelectedAccountAssets?.baseCoin

Expand Down Expand Up @@ -164,7 +165,7 @@

function onStopVotingClick(): void {
openPopup({
id: 'stopVoting',
id: PopupId.StopVoting,
})
}

Expand All @@ -173,7 +174,7 @@
answerValue === undefined ? ABSTAIN_VOTE_VALUE : answerValue
)
openPopup({
id: 'voteForProposal',
id: PopupId.VoteForProposal,
props: { selectedAnswerValues: chosenAnswerValues },
})
}
Expand Down
@@ -1,10 +1,10 @@
<script lang="ts">
import { Button, Text, ButtonSize } from 'shared/components'
import { localize } from '@core/i18n'
import { openPopup } from '@auxiliary/popup'
import { openPopup, PopupId } from '@auxiliary/popup'

function handleDiagnosticsClick(): void {
openPopup({ id: 'diagnostics' })
openPopup({ id: PopupId.Diagnostics })
}
</script>

Expand Down