Skip to content
This repository was archived by the owner on Dec 10, 2025. It is now read-only.

Commit 4b92d57

Browse files
committed
fix some detaikls
1 parent 6c46152 commit 4b92d57

File tree

3 files changed

+36
-9
lines changed

3 files changed

+36
-9
lines changed

frontend/src/components/elevator/block-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ const BlockModal: preact.FunctionComponent<BlockModalProps> = ({
256256
}}
257257
className={`${buttonColor} ${buttonHover} text-white font-bold py-2 px-4 rounded-lg focus:outline-none focus:shadow-outline`}
258258
>
259-
Share this Block
259+
Replay the Block
260260
</button>
261261
<a
262262
href={createBlockLink(

frontend/src/components/replay/header.tsx

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { FunctionalComponent } from "preact";
22
import { useAtomValue } from "jotai";
33
import { chainThemeAtom, ChainTheme } from "../../states/atoms";
4+
import { useState } from "preact/hooks";
45

56
export interface ReplayHeaderProp {
67
blockHash: string;
@@ -13,6 +14,29 @@ export const ReplayHeader: FunctionalComponent<ReplayHeaderProp> = ({
1314
chainTheme === ChainTheme.mainnet
1415
? "text-brand-mainnet"
1516
: "text-brand-testnet";
17+
const [copyNotification, setCopyNotification] = useState<string | null>(
18+
null,
19+
);
20+
21+
const handleCopyClick = () => {
22+
const link = `${window.location.origin}/replay/${blockHash}`;
23+
navigator.clipboard
24+
.writeText(link)
25+
.then(() => {
26+
setCopyNotification("Link copied!");
27+
setTimeout(() => {
28+
setCopyNotification(null);
29+
}, 2000); // Clear notification after 2 seconds
30+
})
31+
.catch((err) => {
32+
console.error("Failed to copy: ", err);
33+
setCopyNotification("Failed to copy link."); //Optional, error message.
34+
setTimeout(() => {
35+
setCopyNotification(null);
36+
}, 2000);
37+
});
38+
};
39+
1640
return (
1741
<div>
1842
<div
@@ -22,14 +46,17 @@ export const ReplayHeader: FunctionalComponent<ReplayHeaderProp> = ({
2246
>
2347
<h1>Elevator Block Replay </h1>
2448
<div>
25-
<a
26-
className={`${textColor}`}
27-
href="http://"
28-
target="_blank"
29-
rel="noopener noreferrer"
49+
<button
50+
className={`${textColor} border border-black rounded-md px-4 py-2`}
51+
onClick={handleCopyClick}
3052
>
31-
Copy the Share Link
32-
</a>
53+
Share this block with your friends!
54+
</button>
55+
{copyNotification && (
56+
<div className="text-text-secondary text-sm italic">
57+
{copyNotification}
58+
</div>
59+
)}
3360
</div>
3461
</div>
3562
</div>

frontend/src/layouts/navbar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const Navbar: FunctionalComponent = () => {
2424
{
2525
label: "Github",
2626
selected: false,
27-
url: "https://github.com/cryptape",
27+
url: "https://github.com/cryptape/ckb-tx-elevator",
2828
newTab: true,
2929
icon: "/assets/icons/github.svg",
3030
},

0 commit comments

Comments
 (0)