Skip to content
Merged
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
19 changes: 19 additions & 0 deletions app/components/trade/OrderTicket.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,12 @@ const OrderTicketInner: FC<{ slabAddress: string }> = ({ slabAddress }) => {
const needsWallet = !connected;
const needsAccount = connected && !userAccount;
const needsDeposit = connected && userAccount && capital === 0n;
// With no wallet, no account, or an unfunded account, every control below
// can only compose an order that cannot be submitted — the CTA at the
// bottom (Connect / Start Trading / Deposit to Trade) is the only real
// action. Lock the whole ticket so the controls read as "not yet", instead
// of inviting input that dead-ends.
const ticketLocked = needsWallet || needsAccount || !!needsDeposit;

async function handleTrade(
snapshotSize?: bigint,
Expand Down Expand Up @@ -698,6 +704,17 @@ setEngineLockError(null);
</span>
</div>

{/* Locked shell — a disabled fieldset natively disables every input and
button inside (including keyboard focus), and the opacity drop makes
the "not yet" state legible at a glance. min-w-0 counters fieldset's
default min-inline-size: min-content, which would otherwise stop the
ticket from shrinking in narrow layouts. */}
<fieldset
disabled={ticketLocked}
aria-disabled={ticketLocked}
className={`min-w-0 transition-opacity duration-150 ${ticketLocked ? "pointer-events-none select-none opacity-40" : ""}`}
>

{/* Long / Short segmented — semantic long/short tokens only, symmetric
unselected states (both read as neutral until chosen — previously
Short's idle state was tinted red even when not selected, which
Expand Down Expand Up @@ -986,6 +1003,8 @@ setEngineLockError(null);
);
})()}

</fieldset>

{/* Single validation banner (highest-priority issue only) */}
{blockingIssue && (
<div className="mb-3 rounded-none border border-[var(--warning)]/30 bg-[var(--warning)]/5 p-2.5">
Expand Down
Loading