Skip to content

Conversation

@jahrulezfrancis
Copy link

@jahrulezfrancis jahrulezfrancis commented Jan 21, 2026

Adds a “View on Stellar Expert” button to the Escrow Viewer, linking directly to the currently loaded escrow contract on Stellar Expert.

The button:

Appears only when a valid escrow contract is loaded

Automatically adapts to testnet or mainnet based on the current network

Opens in a new tab for safe external navigation

Includes a tooltip to clarify that the link opens the contract on Stellar Expert

This enhancement improves transparency, reinforces user trust, and aligns the Escrow Viewer with standard Web3 UX expectations.

Screenshot before implementation:

Screenshot from 2026-01-21 19-40-19

Video after implementation:

Screencast.from.2026-01-21.19-52-00.mp4

Closes #41

Summary by CodeRabbit

  • New Features

    • Added Stellar Expert integration with external-link icon and tooltip to view contract details externally.
  • Improvements

    • Adjusted Transaction History layout and spacing to accommodate the new link.
    • Improved URL validation and error handling for external links.
    • Refined debug logging behavior to depend on development mode.
    • Minor formatting and UI structure cleanups for more consistent rendering.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Contributor

vercel bot commented Jan 21, 2026

@jahrulezfrancis is attempting to deploy a commit to the Trustless Work Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

Adds a network-aware "View on Stellar Expert" button and tooltip to EscrowDetails, computing and validating a Stellar Expert URL from the contractId and currentNetwork, adjusts layout to place the link above Transaction History, and updates debug logging and minor formatting.

Changes

Cohort / File(s) Summary
Stellar Expert integration
src/components/escrow/EscrowDetails.tsx
Adds memoized stellarExpertUrl and isValidStellarExpertUrl derived from contractId and currentNetwork; chooses testnet vs public path and guards rendering.
UI / Tooltip & External Link
src/components/escrow/EscrowDetails.tsx
Imports and uses TooltipProvider/TooltipTrigger/TooltipContent and an external link icon; renders conditional "View on Stellar Expert" button that opens new tab (rel="noopener noreferrer").
Layout, logging & minor refactors
src/components/escrow/EscrowDetails.tsx
Moves Stellar Expert block above Transaction History, adjusts spacing/layout, refactors organizedWithLive memo, changes DEBUG derivation to NODE_ENV === "development", tweaks a scrollIntoView catch, and applies formatting/indentation updates.

Sequence Diagram(s)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped across the code tonight,
A shiny link to Stellar’s light,
Testnet, mainnet — I know the way,
Above the history where users stay,
Click and gaze — on-chain delight ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding a Stellar Expert explorer link for escrow contracts, directly matching the PR's primary objective.
Linked Issues check ✅ Passed The implementation satisfies all core requirements: dynamic URL construction for testnet/mainnet, correct placement and styling, tooltip support, external link icon, disabled state handling, and no impact to data/escrow logic.
Out of Scope Changes check ✅ Passed Minor refactoring (formatting in organizedWithLive memo, catch clause simplification, DEBUG flag derivation) are code quality improvements aligned with the change scope and do not introduce functional drift.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@src/components/escrow/EscrowDetails.tsx`:
- Around line 266-276: The JSX currently nests an <a> inside a <button> (in
EscrowDetails, around the stellarExpertUrl block), which is invalid; replace the
outer <button> with an anchor element styled with the same classes so the whole
control is a single interactive element, move the ExternalLink icon inside that
anchor, preserve href={stellarExpertUrl ?? undefined}, target="_blank",
rel="noopener noreferrer" and aria-label="View on Stellar Expert", and ensure
the className and accessible attributes match the original button styling and
behavior.
- Around line 195-221: The DEBUG constant in EscrowDetails is hardcoded to true
causing development console logs (useEffect blocks referencing currentNetwork,
contractId, raw, organized, ledgerBalance, decimals, mismatch) to leak into
production; replace the hardcoded const DEBUG = true with a production-safe
toggle (e.g., derive DEBUG from an environment variable or NODE_ENV such as
const DEBUG = process.env.REACT_APP_DEBUG_ESCROW === 'true' ||
process.env.NODE_ENV !== 'production'), or remove the debug useEffect blocks
entirely, and ensure all console.log calls in those useEffect hooks are gated by
that DEBUG check so they are not executed in production builds.
🧹 Nitpick comments (2)
src/components/escrow/EscrowDetails.tsx (2)

8-8: Inconsistent tooltip imports from different sources.

TooltipContent, TooltipProvider, and TooltipTrigger are imported from @/components/ui/tooltip, but Tooltip is imported directly from @radix-ui/react-tooltip. This inconsistency may cause styling or behavior mismatches if the internal tooltip component applies custom styling or props.

Suggested fix
-import { TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
+import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/components/ui/tooltip";
 import { ExternalLink } from "lucide-react";
-import { Tooltip } from "@radix-ui/react-tooltip";

Also applies to: 33-33


82-95: Consider validating contractId format before building the URL.

The URL is constructed directly with contractId without validating it's a proper Stellar contract ID. While isValidStellarExpertUrl guards against invalid networks, a malformed or malicious contract ID could still produce an unexpected URL.

Suggested improvement
+// Basic Stellar contract ID validation (56 chars, starts with C)
+const isValidContractId = (id: string) => /^C[A-Z0-9]{55}$/.test(id);
+
 const stellarExpertUrl = useMemo(() => {
-  if (!contractId) return null;
+  if (!contractId || !isValidContractId(contractId)) return null;

   const networkPath =
     currentNetwork === "testnet" ? "testnet" : "public";

   return `https://stellar.expert/explorer/${networkPath}/contract/${contractId}`;
 }, [contractId, currentNetwork]);

@jahrulezfrancis
Copy link
Author

@techrebelgit , I would appreciate your review

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@src/components/escrow/EscrowDetails.tsx`:
- Around line 85-98: Render the missing "View on Stellar Expert" link inside the
existing {raw && ...} JSX block (around where the "View Transaction History"
button is rendered) by conditionally outputting an <a> (styled as a button) when
isValidStellarExpertUrl is true; use the computed stellarExpertUrl as the href,
set target="_blank" rel="noopener noreferrer", place it above the "View
Transaction History" control, and add a tooltip and an external-link icon to
match UI conventions (do not wrap an <a> in a <button>, and keep styling
consistent with the other action buttons).
- Around line 35-36: Remove the duplicate ExternalLink import and any unused
Tooltip imports in EscrowDetails.tsx: delete the repeated "ExternalLink" import,
remove the standalone "Tooltip" import from "@radix-ui/react-tooltip", and if
"TooltipContent" and "TooltipTrigger" (from the other import) are not used in
the component JSX, remove them from that import as well so only the actually
used symbols remain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add “View on Stellar Expert” Button to Escrow Viewer

2 participants