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

web-wallet: Add Link to Block Explorer on Wallet #2883

Merged
merged 1 commit into from
Nov 13, 2024
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
2 changes: 2 additions & 0 deletions web-wallet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Added gas settings validation on Unstake / Widthdraw Rewards flows [#2000]
- Add temporary link to the block explorer on the dashboard [#2882]

### Changed

Expand Down Expand Up @@ -333,6 +334,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#2878]: https://github.com/dusk-network/rusk/issues/2878
[#2879]: https://github.com/dusk-network/rusk/issues/2879
[#2880]: https://github.com/dusk-network/rusk/issues/2880
[#2882]: https://github.com/dusk-network/rusk/issues/2882
[#2888]: https://github.com/dusk-network/rusk/issues/2888
[#2920]: https://github.com/dusk-network/rusk/issues/2920

Expand Down
41 changes: 39 additions & 2 deletions web-wallet/src/routes/(app)/dashboard/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@
mdiArrowTopRight,
mdiContain,
mdiDatabaseOutline,
mdiListBoxOutline,
mdiSwapHorizontal,
mdiSwapVertical,
mdiSync,
} from "@mdi/js";
import { Icon } from "$lib/dusk/components";
import { AnchorButton, Icon } from "$lib/dusk/components";
import { DashboardNav, Transactions } from "$lib/components";
import { settingsStore, walletStore } from "$lib/stores";
import { networkStore, settingsStore, walletStore } from "$lib/stores";
import { contractDescriptors } from "$lib/contracts";
import IconHeadingCard from "$lib/containers/Cards/IconHeadingCard.svelte";
import { page } from "$app/stores";

const { dashboardTransactionLimit, language } = $settingsStore;
const { networkName } = $networkStore;

/** @param {string} contract */
function getIconsForContract(contract) {
Expand Down Expand Up @@ -48,6 +52,20 @@
return icons;
}

function getExplorerPath() {
const isStaging = $page.url.href.includes("staging");
const baseUrl = isStaging ? "https://apps.staging" : "https://apps";

switch (networkName) {
case "devnet":
return `${baseUrl}.devnet.dusk.network/explorer`;
case "testnet":
return `${baseUrl}.testnet.dusk.network/explorer`;
default:
return `${baseUrl}.dusk.network/explorer`;
}
}

/** @type {ContractDescriptor[]} */
const enabledContracts = contractDescriptors.filter(
(contract) => contract.enabled === true
Expand Down Expand Up @@ -93,6 +111,25 @@
isSyncing={syncStatus.isInProgress}
syncError={syncStatus.error}
/>
{:else}
<IconHeadingCard
gap="medium"
icons={[mdiListBoxOutline]}
heading="Transactions"
>
<p>
Transaction history will be available in an upcoming release. Meanwhile,
you can check the status of your transactions on the Dusk Block Explorer.
</p>

<AnchorButton
variant="tertiary"
href={getExplorerPath()}
text="Block Explorer"
rel="noopener noreferrer"
target="_blank"
/>
</IconHeadingCard>
{/if}

<style lang="postcss">
Expand Down
Loading