Skip to content

Commit

Permalink
Disable app create unless prompt is given
Browse files Browse the repository at this point in the history
  • Loading branch information
benjreinhart committed Oct 22, 2024
1 parent cf7b413 commit 2cc543d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/web/src/components/apps/create-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@ export default function CreateAppModal({ onClose, onCreate }: PropsType) {

const [submitting, setSubmitting] = useState(false);

const validPrompt = prompt.trim() !== '';

async function onSubmit(e: React.FormEvent) {
e.preventDefault();
e.stopPropagation();

if (submitting) {
if (submitting || !validPrompt) {
return;
}

Expand Down Expand Up @@ -130,7 +132,7 @@ export default function CreateAppModal({ onClose, onCreate }: PropsType) {
Cancel
</Button>

<Button disabled={!aiEnabled || submitting} type="submit">
<Button disabled={!aiEnabled || submitting || !validPrompt} type="submit">
{submitting ? (
<div className="flex items-center gap-2">
<Loader2 className="h-4 w-4 animate-spin" /> Generating...
Expand Down

0 comments on commit 2cc543d

Please sign in to comment.