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

Add link to radix-dashboard to PairInfo #554

Merged
merged 2 commits into from
Aug 11, 2024
Merged
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
20 changes: 20 additions & 0 deletions src/app/components/PriceChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import * as tailwindConfig from "../../../tailwind.config";
import { shortenString } from "../utils";
import { CopyIcon } from "./CopyIcon";
import { TokenInfo } from "state/pairSelectorSlice";
import Link from "next/link";
import { FiExternalLink } from "react-icons/fi";

interface PriceChartProps {
data: OHLCVData[];
Expand Down Expand Up @@ -381,11 +383,17 @@ export function Info() {
label={t("pair_resource")}
address={pairInfo.address}
shortenLength={{ min: 8, max: 20 }}
radixDashboardUrl={`https://${
process.env.NEXT_PUBLIC_NETWORK === "stokenet" ? "stokenet-" : ""
}dashboard.radixdlt.com/component/${pairInfo.address}`}
/>
<LabelAndAddress
label={t("order_receipt_address")}
address={pairInfo.orderReceiptAddress}
shortenLength={{ min: 8, max: 20 }}
radixDashboardUrl={`https://${
process.env.NEXT_PUBLIC_NETWORK === "stokenet" ? "stokenet-" : ""
}dashboard.radixdlt.com/resource/${pairInfo.orderReceiptAddress}`}
/>
</div>

Expand All @@ -403,12 +411,14 @@ interface LabelAndAddressProps {
label: string;
address: string;
shortenLength?: { min: number; max: number };
radixDashboardUrl: string;
}

function LabelAndAddress({
label,
address,
shortenLength,
radixDashboardUrl,
}: LabelAndAddressProps) {
const minLength = shortenLength?.min || 8;
const maxLength = shortenLength?.max || 20;
Expand All @@ -424,6 +434,13 @@ function LabelAndAddress({
{shortenString(address, minLength, maxLength, "...")}
</span>
<CopyIcon textToCopy={address} />
<Link
className="pl-1 cursor-pointer"
href={radixDashboardUrl}
target="_blank"
>
<FiExternalLink />
</Link>
</div>
</div>
</>
Expand All @@ -447,6 +464,9 @@ function CoinInfo({ token }: { token: TokenInfo }) {
label={t("resource")}
address={address}
shortenLength={{ min: 8, max: 10 }}
radixDashboardUrl={`https://${
process.env.NEXT_PUBLIC_NETWORK === "stokenet" ? "stokenet-" : ""
}dashboard.radixdlt.com/resource/${address}`}
/>
</div>
</div>
Expand Down
Loading