-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: handle pairing expiry for wallet connect pairing flow (#2641)
* cleanup confirmConnection drawer * init supported namespace if not persisted * show selections on edit click * update namespace on selection change * cleanup types * improve buttons on confirm connection * disable back * skip connectionrequest drawer * update type * cleanup confirmation buttons * add expiry time banner * add locale * refactor and use expiration component on connection request draw also * fix: double button --------- Co-authored-by: Nicole O'Brien <[email protected]>
- Loading branch information
1 parent
c33ee91
commit 0b99994
Showing
6 changed files
with
98 additions
and
31 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
...op/views/dashboard/drawers/dapp-config/components/ConnectionRequestExpirationAlert.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<script lang="ts"> | ||
import { Text } from '@bloomwalletio/ui' | ||
import { time } from '@core/app/stores' | ||
import { MILLISECONDS_PER_SECOND, SECONDS_PER_MINUTE } from '@core/utils/constants' | ||
import { localize } from '@core/i18n' | ||
import { getTimeDifference } from '@core/utils' | ||
export let expiryTimestamp: number | undefined | ||
const localeKey = 'views.dashboard.drawers.dapps.confirmConnection' | ||
const expiryTimeDiff = (expiryTimestamp ?? 0) - $time.getTime() / MILLISECONDS_PER_SECOND | ||
</script> | ||
|
||
{#if expiryTimeDiff <= 0} | ||
<div class="w-full flex gap-4 px-6 py-1 bg-danger/10"> | ||
<Text type="sm" textColor="danger" class="flex items-center">{localize(`${localeKey}.expired`)}</Text> | ||
</div> | ||
{:else} | ||
<div | ||
class=" | ||
w-full flex justify-between gap-4 px-6 py-1 | ||
{expiryTimeDiff < SECONDS_PER_MINUTE ? 'bg-warning/10' : 'bg-neutral/10'} | ||
" | ||
> | ||
<Text | ||
type="sm" | ||
class="flex items-center" | ||
textColor={expiryTimeDiff < SECONDS_PER_MINUTE ? 'warning' : 'primary'} | ||
> | ||
{localize(`${localeKey}.expiresIn`)} | ||
{getTimeDifference(new Date((expiryTimestamp ?? 0) * MILLISECONDS_PER_SECOND), $time, true)} | ||
</Text> | ||
</div> | ||
{/if} |
1 change: 1 addition & 0 deletions
1
packages/desktop/views/dashboard/drawers/dapp-config/components/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters