Skip to content

Commit 4942cf8

Browse files
authored
Merge pull request #34 from Zondax/muranoa/explorers
Add paseo explorer on resources
1 parent a25de63 commit 4942cf8

7 files changed

Lines changed: 110 additions & 47 deletions

File tree

.github/workflows/ci-playwright.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ concurrency:
1616

1717
jobs:
1818
playwright-tests:
19-
uses: zondax/_workflows/.github/workflows/_checks-playwright.yaml@v3
19+
needs:
20+
- ts-checks-linux
21+
uses: zondax/_workflows/.github/workflows/_checks-playwright.yaml@v4
22+
with:
23+
environment: dev

mise.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[tools]
2+
pnpm = "latest"

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"test:console": "playwright test console-errors",
1818
"test:coverage": "vitest run --coverage",
1919
"test:e2e": "playwright test",
20+
"test:e2e:build": "pnpm build && playwright test",
2021
"test:e2e:debug": "playwright test e2e --debug",
2122
"test:e2e:install": "playwright install",
2223
"test:e2e:report": "playwright show-report",
@@ -50,7 +51,7 @@
5051
"tailwind-merge": "^3.3.1"
5152
},
5253
"devDependencies": {
53-
"@biomejs/biome": "2.1.2",
54+
"@biomejs/biome": "2.3.10",
5455
"@playwright/test": "^1.55.1",
5556
"@tailwindcss/postcss": "^4",
5657
"@types/node": "^20",

pnpm-lock.yaml

Lines changed: 38 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/shared/ResourceDetailsModal.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { CopyButton } from "./CopyButton";
1212

1313
export interface DetailField {
1414
label: string;
15-
value: string | readonly string[];
15+
value?: string | readonly string[];
1616
type?: "text" | "copyable" | "link";
1717
icon?: string;
1818
}
@@ -47,6 +47,18 @@ export function ResourceDetailsModal({
4747
data,
4848
}: ResourceDetailsModalProps) {
4949
const renderField = (field: DetailField) => {
50+
// Handle fields without value (label-only fields)
51+
if (field.value === undefined) {
52+
return (
53+
<div key={field.label}>
54+
<p className="text-sm text-muted-foreground">
55+
{field.icon && `${field.icon} `}
56+
{field.label}
57+
</p>
58+
</div>
59+
);
60+
}
61+
5062
const isArray = Array.isArray(field.value);
5163
const values: string[] = isArray
5264
? [...field.value]

src/constants/resources.ts

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
import type { LucideIcon } from "lucide-react";
2-
import { Blocks, Droplets, FileText, Globe, Rocket } from "lucide-react";
2+
import {
3+
Blocks,
4+
Droplets,
5+
FileText,
6+
Globe,
7+
Rocket,
8+
Search,
9+
} from "lucide-react";
310
import { URLS } from "./urls";
411

512
// Resource modal field structure
6-
interface ModalField {
13+
export interface ModalField {
714
readonly label: string;
8-
readonly value: string | readonly string[];
15+
readonly value?: string | readonly string[];
916
readonly icon: string;
10-
readonly type?: "copyable";
17+
readonly type?: "text" | "copyable" | "link";
1118
}
1219

1320
// Resource modal action structure
@@ -17,15 +24,15 @@ interface ModalAction {
1724
}
1825

1926
// Resource modal data structure
20-
interface ModalData {
27+
export interface ModalData {
2128
readonly sections: readonly {
2229
readonly fields: readonly ModalField[];
2330
}[];
2431
readonly actions: readonly ModalAction[];
2532
}
2633

2734
// Resource item structure
28-
interface Resource {
35+
export interface Resource {
2936
readonly icon: LucideIcon;
3037
readonly title: string;
3138
readonly description: string;
@@ -130,4 +137,35 @@ export const RESOURCES = [
130137
],
131138
},
132139
},
140+
{
141+
icon: Search,
142+
title: "Explorers",
143+
description:
144+
"Browse transactions, blocks, and accounts on Paseo network with blockchain explorers.",
145+
href: undefined,
146+
isExternal: false,
147+
buttonLabel: "View Explorers",
148+
modalData: {
149+
sections: [
150+
{
151+
fields: [
152+
{
153+
label: "Choose a block explorer to get started",
154+
icon: "🔎",
155+
},
156+
],
157+
},
158+
],
159+
actions: [
160+
{
161+
label: "Open Routescan",
162+
url: URLS.explorers.routescan,
163+
},
164+
{
165+
label: "Open Subscan",
166+
url: URLS.explorers.subscan,
167+
},
168+
],
169+
},
170+
},
133171
] as const satisfies readonly Resource[];

src/constants/urls.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ export const URLS = {
6363
"https://paseo-r2.zondax.ch/chain-specs/paseo-collectives.raw.smol.json",
6464
},
6565

66+
// Explorers
67+
explorers: {
68+
routescan: "https://polkadot.testnet.routescan.io/",
69+
subscan: "https://paseo.subscan.io/",
70+
},
71+
6672
// Resources
6773
faucet: "https://faucet.polkadot.io/",
6874
onPop: "https://onpop.io/",

0 commit comments

Comments
 (0)