jbilcke-hf HF staff commited on
Commit
d5af700
1 Parent(s): 51e7e1a
src/app/interface/edit-modal/index.tsx CHANGED
@@ -32,11 +32,18 @@ export function EditModal({
32
  }
33
 
34
  return (
35
- <Dialog open={isOpen} onOpenChange={() => isEnabled ? setOpen(true) : undefined}>
 
 
 
 
 
 
 
36
  <DialogTrigger asChild>
37
  {children}
38
  </DialogTrigger>
39
- <DialogContent className="sm:max-w-[425px]">
40
  <DialogHeader>
41
  <DialogTitle>Edit Prompt</DialogTitle>
42
  <DialogDescription className="w-full text-center text-lg font-bold text-stone-800">
@@ -61,6 +68,14 @@ export function EditModal({
61
  />
62
  </div>
63
  <DialogFooter>
 
 
 
 
 
 
 
 
64
  <Button
65
  type="submit"
66
  onClick={() => handleSubmit()}
 
32
  }
33
 
34
  return (
35
+ <Dialog open={isOpen} onOpenChange={(open) => {
36
+ if (!open || isEnabled) {
37
+ setOpen(open)
38
+ if (!open) {
39
+ setDraftPrompt(existingPrompt)
40
+ }
41
+ }
42
+ }}>
43
  <DialogTrigger asChild>
44
  {children}
45
  </DialogTrigger>
46
+ <DialogContent className="sm:max-w-[425px] text-stone-800">
47
  <DialogHeader>
48
  <DialogTitle>Edit Prompt</DialogTitle>
49
  <DialogDescription className="w-full text-center text-lg font-bold text-stone-800">
 
68
  />
69
  </div>
70
  <DialogFooter>
71
+ <Button
72
+ type="button"
73
+ variant="outline"
74
+ onClick={() => {
75
+ setOpen(false)
76
+ setDraftPrompt(existingPrompt)
77
+ }}
78
+ >cancel</Button>
79
  <Button
80
  type="submit"
81
  onClick={() => handleSubmit()}