Skip to content
Open
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
61 changes: 61 additions & 0 deletions components/ui/murphy/Txn-Feedback/txn-explorer-link.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"use client";

import type React from "react";
import { ExternalLink } from "lucide-react";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";

interface TxnExplorerLinkProps {
signature: string;
cluster?: "mainnet-beta" | "testnet" | "devnet";
children?: React.ReactNode;
className?: string;
variant?:
| "default"
| "destructive"
| "outline"
| "secondary"
| "ghost"
| "link";
size?: "default" | "sm" | "lg" | "icon";
showIcon?: boolean;
}

export function TxnExplorerLink({
signature,
cluster = "mainnet-beta",
children,
className,
variant = "outline",
size = "sm",
showIcon = true,
}: TxnExplorerLinkProps) {
const getExplorerUrl = () => {
const baseUrl = "https://explorer.solana.com/tx";
const clusterParam =
cluster !== "mainnet-beta" ? `?cluster=${cluster}` : "";
return `${baseUrl}/${signature}${clusterParam}`;
};

const handleClick = () => {
window.open(getExplorerUrl(), "_blank", "noopener,noreferrer");
};

return (
<Button
onClick={handleClick}
variant={variant}
size={size}
className={cn("cursor-pointer hover:underline", className)}
>
{children || (
<>
View on Explorer
{showIcon && (
<ExternalLink className="w-4 h-4 ml-2 text-muted-foreground" />
)}
</>
)}
</Button>
);
}
6 changes: 4 additions & 2 deletions components/ui/murphy/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import CandyMachineForm from "./candy-machine-form";
import CoreCandyMachineForm from "./core-candy-machine-form";
import BubblegumLegacyForm from "./bubblegum-legacy-form";
import ImprovedCNFTManager from "./improved-cnft-manager";
import CompressedNFTViewer from "./compressed-nft-viewer"
import CompressedNFTViewer from "./compressed-nft-viewer";
import { CreateMerkleTree } from "./create-merkleTree-form";
import { TokenList } from "./token-list";
import { StakeForm } from "./stake-token-form";
Expand All @@ -37,6 +37,7 @@ import { CoreAssetLaunchpad } from "./core-asset-launchpad";
import { HydraFanoutForm } from "./hydra-fanout-form";
import { MPLHybridForm } from "./mpl-hybrid-form";
import { TokenMetadataViewer } from "./token-metadata-viewer";
import { TxnExplorerLink } from "./Txn-Feedback/txn-explorer-link";

export {
ConnectWalletButton,
Expand Down Expand Up @@ -78,5 +79,6 @@ export {
TMLaunchpadForm,
HydraFanoutForm,
MPLHybridForm,
TokenMetadataViewer
TokenMetadataViewer,
TxnExplorerLink,
};
Loading