Skip to content

Commit

Permalink
only open options modal if options available
Browse files Browse the repository at this point in the history
  • Loading branch information
karooolis committed Nov 21, 2024
1 parent 0b2414b commit ffb3670
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ export function WorldsForm({ worlds }: { worlds: Address[] }) {
}
}

const handleOpenOptions = () => {
if (!open && worlds.length > 0) {
setOpen(true);
}
};

return (
<div className="mx-auto flex min-h-screen w-[450px] flex-col items-center justify-center p-4">
<h1 className="flex items-center gap-6 self-start font-mono text-4xl font-bold uppercase">
Expand All @@ -71,7 +77,7 @@ export function WorldsForm({ worlds }: { worlds: Address[] }) {
field.onBlur();
setOpen(false);
}}
onFocus={() => setOpen(true)}
onFocus={handleOpenOptions}
placeholder="Enter world address..."
// Need to manually trigger form submission as CommandPrimitive.Input captures Enter key events
onKeyDown={(e) => {
Expand Down

0 comments on commit ffb3670

Please sign in to comment.