mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-09-09 19:27:45 +02:00
[eric] cloud: a refusal keeps the way out of it, and Try again actually clears it
This commit is contained in:
@@ -97,7 +97,21 @@ const CloudRunSection: React.FC<{ workflow: Workflow; cloud: CloudStatusHandle }
|
||||
|
||||
{cloud.pending && <Note wc={WC} tone="quiet">Talking to the cloud…</Note>}
|
||||
|
||||
{!cloud.pending && cloud.refusal && <Note wc={WC} tone="warn">{cloud.refusal}</Note>}
|
||||
{/* A refusal used to swallow every other branch, including the one holding the upgrade link, so being told you need Pro removed the way to get Pro. Carry the action through. */}
|
||||
{!cloud.pending && cloud.refusal && (
|
||||
<Note wc={WC} tone="warn">
|
||||
<span>
|
||||
{cloud.refusal}
|
||||
{availability.kind === 'blocked' && availability.action === 'sign_in' && (
|
||||
<button onClick={() => dispatch(openSettingsCard())} style={link}>Sign in</button>
|
||||
)}
|
||||
{availability.kind === 'blocked' && availability.action === 'plans' && (
|
||||
<button onClick={() => dispatch(openSettingsCard())} style={link}>See plans</button>
|
||||
)}
|
||||
<button onClick={cloud.retry} style={link}>Try again</button>
|
||||
</span>
|
||||
</Note>
|
||||
)}
|
||||
|
||||
{!cloud.pending && !cloud.refusal && availability.kind === 'checking' && (
|
||||
<Note wc={WC} tone="quiet">Checking what your account allows…</Note>
|
||||
|
||||
@@ -12,6 +12,7 @@ export interface CloudStatusHandle {
|
||||
pending: boolean;
|
||||
/** Set only by a refused flip, and cleared by the next attempt. */
|
||||
refusal: string | null;
|
||||
retry: () => void;
|
||||
choose: (target: CloudTarget, enabled: boolean) => void;
|
||||
refresh: () => void;
|
||||
}
|
||||
@@ -59,5 +60,10 @@ export function useCloudStatus(workflow: Workflow): CloudStatusHandle {
|
||||
});
|
||||
}, [dispatch, pending, refresh, workflowId, dashboardId]);
|
||||
|
||||
return { probe, pending, refusal, choose, refresh };
|
||||
// refresh() deliberately leaves `refusal` alone: choose() calls it right after setting one, and
|
||||
// clearing there would wipe the message before it rendered. A user-driven retry is a different
|
||||
// intent, so it gets its own door; without it a refusal outlived the thing that caused it.
|
||||
const retry = useCallback(() => { setRefusal(null); refresh(); }, [refresh]);
|
||||
|
||||
return { probe, pending, refusal, choose, refresh, retry };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user