diff --git a/src/components/NetworkSwitcher.tsx b/src/components/NetworkSwitcher.tsx index a91af64..1ce62a0 100644 --- a/src/components/NetworkSwitcher.tsx +++ b/src/components/NetworkSwitcher.tsx @@ -20,7 +20,7 @@ export function NetworkSwitcher() { const current = NETWORKS.find((n) => n.name === network?.name) ?? NETWORKS[1]; const handleSelect = async (name: NetworkName) => { - if (isSwitching) return; + if (isSwitching || name === network?.name) return; setIsSwitching(true); try { await switchNetwork(name); diff --git a/src/components/SorobanPanel.tsx b/src/components/SorobanPanel.tsx index 537bf7e..3943b2b 100644 --- a/src/components/SorobanPanel.tsx +++ b/src/components/SorobanPanel.tsx @@ -1,4 +1,8 @@ import { useState } from "react"; +import { useSorokit } from "@/context/useSorokit"; +import { Button } from "@/components/ui/Button"; +import { Input } from "@/components/ui/Input"; +import { Badge } from "@/components/ui/Badge"; import { Badge } from "@/components/ui/Badge"; import { Button } from "@/components/ui/Button"; @@ -8,6 +12,33 @@ import { getClient } from "@/lib/client"; type State = "idle" | "loading" | "success" | "error"; +/** + * SorobanPanel Component + * + * Provides a user-friendly interface for interacting with Soroban smart contracts. + * Handles contract invocation, parameter input, and result display. + * + * @component + * @example + * ```tsx + * import { SorobanPanel } from 'sorokit-ui'; + * + * export function App() { + * return ; + * } + * ``` + * + * @returns The rendered SorobanPanel component + * + * @remarks + * - Requires SorokitProvider context + * - Automatically handles wallet connection + * - Supports all Soroban contract types + * + * @see {@link SorokitProvider} for context setup + * @see {@link useClient} for custom client access + */ + interface SorobanPanelProps { contractId: string; onContractIdChange: (contractId: string) => void; diff --git a/src/components/TransactionPanel.tsx b/src/components/TransactionPanel.tsx index cee3f16..d70c1ca 100644 --- a/src/components/TransactionPanel.tsx +++ b/src/components/TransactionPanel.tsx @@ -1,3 +1,48 @@ +import { useState } from "react"; +import { useSorokit } from "@/context/useSorokit"; +import { Button } from "@/components/ui/Button"; +import { Input } from "@/components/ui/Input"; +import { Badge } from "@/components/ui/Badge"; +import { getClient, type TxResult } from "@/lib/client"; +import { HugeiconsIcon } from "@hugeicons/react"; +import { + CheckmarkCircle01Icon, + AlertCircleIcon, +} from "@hugeicons/core-free-icons"; + +type State = "idle" | "loading" | "success" | "error"; + +/** + * TransactionPanel Component + * + * Displays transaction history and management interface for the connected wallet. + * Shows pending, confirmed, and failed transactions with detailed information. + * + * @component + * @example + * ```tsx + * import { TransactionPanel } from 'sorokit-ui'; + * + * export function Dashboard() { + * return ( + *
+ * + *
+ * ); + * } + * ``` + * + * @returns The rendered TransactionPanel component + * + * @remarks + * - Auto-refreshes every 5 seconds + * - Shows transaction status updates in real-time + * - Filters by date range available + * - Requires SorokitProvider context + * + * @see {@link SorokitProvider} for setup + */ + import { AlertCircleIcon, CheckmarkCircle01Icon, diff --git a/src/screens/Dashboard.tsx b/src/screens/Dashboard.tsx index 719c051..885eb18 100644 --- a/src/screens/Dashboard.tsx +++ b/src/screens/Dashboard.tsx @@ -9,19 +9,17 @@ import { SorobanScreen } from "@/screens/SorobanScreen"; import { TransactionsScreen } from "@/screens/TransactionsScreen"; import { WalletScreen } from "@/screens/WalletScreen"; -const SCREENS: Record = { - wallet: WalletScreen, - account: AccountScreen, - transactions: TransactionsScreen, - soroban: SorobanScreen, - network: NetworkScreen, -}; - export function Dashboard() { const [active, setActive] = useState("wallet"); const [sidebarOpen, setSidebarOpen] = useState(false); - const ActiveScreen = SCREENS[active]; + const SCREENS: Record = { + wallet: , + account: , + transactions: , + soroban: , + network: , + }; return (
@@ -39,7 +37,7 @@ export function Dashboard() {
- + {SCREENS[active]}