Skip to content

Commit e78549a

Browse files
committed
feat(entropy-explorer): implement some feedback items
1 parent 0ce6061 commit e78549a

33 files changed

+1708
-681
lines changed

apps/entropy-explorer/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"fix:format": "prettier --write .",
1212
"fix:lint:eslint": "eslint --fix .",
1313
"fix:lint:stylelint": "stylelint --fix 'src/**/*.scss'",
14-
"pull:env": "[ $CI ] || VERCEL_ORG_ID=team_BKQrg3JJFLxZyTqpuYtIY0rj VERCEL_PROJECT_ID=prj_TBkf9EyQjQF37gs4Vk0sQKJj97kE vercel env pull",
14+
"pull:env": "[ $CI ] || VERCEL_ORG_ID=team_BKQrg3JJFLxZyTqpuYtIY0rj VERCEL_PROJECT_ID=prj_34F8THr7mZ3eAOQoCLdo8xWj9fdT vercel env pull",
1515
"start:dev": "next dev --port 3006",
1616
"start:prod": "next start --port 3006",
1717
"test:format": "prettier --check .",
@@ -29,6 +29,7 @@
2929
"react": "catalog:",
3030
"react-aria": "catalog:",
3131
"react-dom": "catalog:",
32+
"react-timeago": "catalog:",
3233
"viem": "catalog:",
3334
"wagmi": "catalog:",
3435
"zod": "catalog:"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
@use "@pythnetwork/component-library/theme";
2+
3+
.address {
4+
display: flex;
5+
flex-flow: row nowrap;
6+
gap: theme.spacing(2);
7+
font-size: theme.font-size("sm");
8+
9+
.full {
10+
display: none;
11+
}
12+
13+
&:not([data-always-truncate]) {
14+
@include theme.breakpoint("xl") {
15+
.truncated {
16+
display: none;
17+
}
18+
19+
.full {
20+
display: unset;
21+
}
22+
}
23+
}
24+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import { CopyButton } from "@pythnetwork/component-library/CopyButton";
2+
import { Link } from "@pythnetwork/component-library/Link";
3+
import { useMemo } from "react";
4+
5+
import styles from "./index.module.scss";
6+
import { EntropyDeployments } from "../../entropy-deployments";
7+
import { truncate } from "../../truncate";
8+
9+
type Props = {
10+
value: string;
11+
chain: keyof typeof EntropyDeployments;
12+
alwaysTruncate?: boolean | undefined;
13+
};
14+
15+
export const Address = ({ value, chain, alwaysTruncate }: Props) => {
16+
const { explorer } = EntropyDeployments[chain];
17+
const truncatedValue = useMemo(() => truncate(value), [value]);
18+
return (
19+
<div
20+
data-always-truncate={alwaysTruncate ? "" : undefined}
21+
className={styles.address}
22+
>
23+
<Link
24+
href={explorer.replace("$ADDRESS", value)}
25+
target="_blank"
26+
rel="noreferrer"
27+
>
28+
<code className={styles.truncated}>{truncatedValue}</code>
29+
<code className={styles.full}>{value}</code>
30+
</Link>
31+
<CopyButton text={value} iconOnly />
32+
</div>
33+
);
34+
};

apps/entropy-explorer/src/components/Home/chain-select.tsx

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ export const ChainSelect = (
3131
</Suspense>
3232
);
3333

34-
type Deployment = ReturnType<typeof entropyDeploymentsByNetwork>[number];
34+
type Deployment =
35+
| ReturnType<typeof entropyDeploymentsByNetwork>[number]
36+
| { id: "all" };
3537

3638
const ResolvedChainSelect = (
3739
props: ConstrainedOmit<
@@ -49,6 +51,11 @@ const useResolvedProps = () => {
4951
const { chain, setChain } = useQuery();
5052
const chains = useMemo(
5153
() => [
54+
{
55+
name: "ALL",
56+
options: [{ id: "all" as const }],
57+
hideLabel: true,
58+
},
5259
{
5360
name: "MAINNET",
5461
options: entropyDeploymentsByNetwork("mainnet", collator),
@@ -62,30 +69,42 @@ const useResolvedProps = () => {
6269
);
6370

6471
const showChain = useCallback(
65-
(chain: Deployment) => (
66-
<div className={styles.chainSelectItem}>
67-
<ChainIcon id={chain.chainId} />
68-
{chain.name}
69-
</div>
70-
),
72+
(chain: Deployment) =>
73+
chain.id === "all" ? (
74+
"All"
75+
) : (
76+
<div className={styles.chainSelectItem}>
77+
<ChainIcon id={chain.chainId} />
78+
{chain.name}
79+
</div>
80+
),
7181
[],
7282
);
7383

74-
const chainTextValue = useCallback((chain: Deployment) => chain.name, []);
84+
const chainTextValue = useCallback(
85+
(chain: Deployment) => (chain.id === "all" ? "All" : chain.name),
86+
[],
87+
);
88+
// eslint-disable-next-line import/namespace
89+
const viemChain = chain ? viemChains[chain] : undefined;
7590

7691
return {
77-
selectedKey: chain ?? undefined,
92+
selectedKey: chain ?? ("all" as const),
7893
onSelectionChange: setChain,
7994
optionGroups: chains,
8095
show: showChain,
8196
textValue: chainTextValue,
97+
buttonLabel: viemChain?.name ?? "Chain",
98+
...(viemChain && {
99+
icon: () => <ChainIcon id={viemChain.id} />,
100+
}),
82101
};
83102
};
84103

85104
const defaultProps = {
86105
label: "Chain",
87106
hideLabel: true,
88-
defaultButtonLabel: "Select Chain",
107+
defaultButtonLabel: "Chain",
89108
} as const;
90109

91110
const entropyDeploymentsByNetwork = (

apps/entropy-explorer/src/components/Home/index.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ChainSelect } from "./chain-select";
55
import styles from "./index.module.scss";
66
import { Results } from "./results";
77
import { SearchBar } from "./search-bar";
8+
import { StatusSelect } from "./status-select";
89

910
export const Home = () => (
1011
<div className={styles.home}>
@@ -16,6 +17,11 @@ export const Home = () => (
1617
toolbar={
1718
<>
1819
<ChainSelect variant="outline" size="sm" placement="bottom right" />
20+
<StatusSelect
21+
variant="outline"
22+
size="sm"
23+
placement="bottom right"
24+
/>
1925
<SearchBar className={styles.searchBar ?? ""} />
2026
</>
2127
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
@use "@pythnetwork/component-library/theme";
2+
3+
.requestDrawer {
4+
gap: theme.spacing(8);
5+
padding-bottom: theme.spacing(8);
6+
7+
.cards {
8+
display: grid;
9+
gap: theme.spacing(4);
10+
grid-template-columns: repeat(2, 1fr);
11+
padding-left: theme.spacing(4);
12+
padding-right: theme.spacing(4);
13+
}
14+
15+
.details {
16+
width: 100%;
17+
overflow: auto;
18+
19+
.field {
20+
@include theme.text("sm", "normal");
21+
22+
color: theme.color("muted");
23+
}
24+
25+
.gasMeter {
26+
margin-right: 5%;
27+
28+
.gasMeterLabel {
29+
@include theme.text("xs", "medium");
30+
}
31+
}
32+
}
33+
34+
.message {
35+
margin-left: theme.spacing(4);
36+
margin-right: theme.spacing(4);
37+
position: relative;
38+
39+
p {
40+
margin: 0;
41+
42+
&.details {
43+
margin-top: theme.spacing(2);
44+
}
45+
}
46+
47+
.code {
48+
border-radius: theme.border-radius("lg");
49+
font-size: theme.font-size("sm");
50+
line-height: 125%;
51+
}
52+
53+
.copyButton {
54+
position: absolute;
55+
top: theme.spacing(2);
56+
right: calc(theme.spacing(2) + 0.25em);
57+
}
58+
}
59+
}

0 commit comments

Comments
 (0)