Skip to content
Merged
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
1 change: 0 additions & 1 deletion contracts/stream_contract/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ pub struct AdminTransferredEvent {
pub new_admin: Address,
}

/// Emitted when a stream is paused.
/// Emitted when a sender pauses an active stream.
///
/// Topic: `("stream_paused", stream_id)`
Expand Down
9 changes: 1 addition & 8 deletions frontend/src/components/TransactionTracker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, { useEffect, useState, useCallback } from "react";
import { Loader2, CheckCircle, XCircle, ExternalLink, RefreshCw, Clock, Ban, FileSearch } from "lucide-react";
import toast from "react-hot-toast";
import type { BackendStream } from "@/lib/api-types";
import { formatAmount } from "@/utils/amount";

/**
* TransactionTracker - Shared component for tracking on-chain transaction lifecycle
Expand Down Expand Up @@ -426,14 +427,6 @@ function renderChanges(prev: BackendStream, current: BackendStream) {
return changes;
}

// Helper to format amounts
function formatAmount(raw: bigint, decimals: number): string {
const divisor = BigInt(10 ** decimals);
const whole = raw / divisor;
const fraction = (raw % divisor).toString().padStart(decimals, "0").replace(/0+$/, "");
return fraction ? `${whole}.${fraction}` : whole.toString();
}

// Hook for using transaction tracker in components
export function useTransactionTracker() {
const [status, setStatus] = useState<TransactionStatus>("idle");
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/dashboard/StreamDetailsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const StreamDetailsModal: React.FC<StreamDetailsModalProps> = ({
return () => window.removeEventListener("keydown", handleEscape);
}, [onClose]);

const progress = (stream.withdrawn / stream.deposited) * 100;
const progress = stream.deposited > 0 ? Math.min(100, Math.max(0, (stream.withdrawn / stream.deposited) * 100)) : 0;
const remaining = stream.deposited - stream.withdrawn;

return (
Expand All @@ -45,6 +45,7 @@ export const StreamDetailsModal: React.FC<StreamDetailsModalProps> = ({
</div>
<button
onClick={onClose}
aria-label="Close"
className="p-2 rounded-full hover:bg-white/10 text-slate-400 transition-colors"
>
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
Expand Down
45 changes: 25 additions & 20 deletions frontend/src/components/ui/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,29 +38,34 @@ export const Button: React.FC<ButtonProps> = ({
<button
className={`${baseStyles} ${variants[variant]} ${sizes[size]} ${glowStyles} ${className}`}
disabled={disabled || loading}
aria-busy={loading}
{...props}
>
{loading && (
<svg
className="animate-spin -ml-1 mr-2 h-4 w-4 text-current"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
>
<circle
className="opacity-25"
cx="12"
cy="12"
r="10"
stroke="currentColor"
strokeWidth="4"
/>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
/>
</svg>
<>
<svg
aria-hidden="true"
className="animate-spin -ml-1 mr-2 h-4 w-4 text-current"
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
>
<circle
className="opacity-25"
cx="12"
cy="12"
r="10"
stroke="currentColor"
strokeWidth="4"
/>
<path
className="opacity-75"
fill="currentColor"
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
/>
</svg>
<span className="sr-only">Loading</span>
</>
)}
{children}
</button>
Expand Down
Loading