import { useState, type ReactNode } from 'react';
import { Loader2 } from 'lucide-react';
/**
* Toast description content for the signer nudge toast.
*
* On Android, includes an "Approve in signer" link that opens the signer via
* the `nostrsigner:` URI scheme (keeps the WebSocket alive), plus a
* Skip/Cancel button. On desktop, shows a description with a Skip button.
*/
export function NudgeToastContent({
description,
android,
relayOk,
onCancel,
}: {
description: string;
android: boolean;
relayOk: boolean;
onCancel: () => void;
}): ReactNode {
return (
{description}
{android && relayOk ? (
) : (
)}
);
}
/**
* Toast description for the phase-transition toast (encrypt done, now sign).
* On Android includes the "Approve in signer" link.
*/
export function PhaseToastContent({
message,
android,
}: {
message: string;
android: boolean;
}): ReactNode {
return (
{message}
{android && (
{ /* phase toast auto-expires */ }} />
)}
);
}
// ---------------------------------------------------------------------------
// Internal components
// ---------------------------------------------------------------------------
function AndroidApproveRow({ onCancel }: { onCancel: () => void }) {
const [waiting, setWaiting] = useState(false);
return (
{waiting ? (
Waiting for signer...
) : (
{
setWaiting(true);
}}
>
Approve in signer
)}
{waiting ? (
) : (
)}
);
}
function SkipButton({ onClick }: { onClick: () => void }) {
return (
);
}