jbilcke-hf HF staff commited on
Commit
a1fa8d5
1 Parent(s): 11cdf4a

allow reload/edit in case of error

Browse files
Files changed (1) hide show
  1. src/app/interface/panel/index.tsx +18 -7
src/app/interface/panel/index.tsx CHANGED
@@ -309,6 +309,10 @@ export function Panel({
309
  )
310
  }
311
 
 
 
 
 
312
  return (
313
  <div className={cn(
314
  frameClassName,
@@ -330,14 +334,21 @@ export function Panel({
330
  `print:hidden`
331
  )}>
332
  <div
333
- onClick={rendered.status === "completed" ? handleReload : undefined}
 
 
 
334
  className={cn(
335
  `bg-stone-100 rounded-lg`,
336
  `flex flex-row space-x-2 items-center`,
337
- `py-1 px-2 md:py-2 md:px-3 cursor-pointer`,
338
  `transition-all duration-200 ease-in-out`,
339
- rendered.status === "completed" ? "opacity-95" : "opacity-50",
340
- mouseOver && rendered.assetUrl ? `scale-95 hover:scale-100 hover:opacity-100`: `scale-0`
 
 
 
 
341
  )}>
342
  <RxReload
343
  className="w-3 h-3 md:w-4 md:h-4 lg:w-5 lg:h-5"
@@ -351,7 +362,7 @@ export function Panel({
351
  )}>Redraw</span>
352
  </div>
353
  <EditModal
354
- isEnabled={rendered.status === "completed"}
355
  existingPrompt={prompt}
356
  onSave={handleSavePrompt}
357
  >
@@ -361,8 +372,8 @@ export function Panel({
361
  `flex flex-row space-x-2 items-center`,
362
  `py-1 px-3 md:py-2 md:px-3 cursor-pointer`,
363
  `transition-all duration-200 ease-in-out`,
364
- rendered.status === "completed" ? "opacity-95" : "opacity-50",
365
- mouseOver && rendered.assetUrl ? `scale-95 hover:scale-100 hover:opacity-100`: `scale-0`
366
  )}>
367
  <RxPencil2
368
  className="w-3 h-3 md:w-4 md:h-4 lg:w-5 lg:h-5"
 
309
  )
310
  }
311
 
312
+ const hasSucceededOrFailed =
313
+ rendered.status === "completed" ||
314
+ rendered.status === "error"
315
+
316
  return (
317
  <div className={cn(
318
  frameClassName,
 
334
  `print:hidden`
335
  )}>
336
  <div
337
+ onClick={
338
+ hasSucceededOrFailed
339
+ ? handleReload
340
+ : undefined}
341
  className={cn(
342
  `bg-stone-100 rounded-lg`,
343
  `flex flex-row space-x-2 items-center`,
344
+ `py-1 px-2 md:py-2 md:px-3`,
345
  `transition-all duration-200 ease-in-out`,
346
+ hasSucceededOrFailed
347
+ ? "opacity-95 cursor-pointer"
348
+ : "opacity-50 cursor-wait",
349
+ mouseOver && (
350
+ hasSucceededOrFailed
351
+ ) ? `scale-95 hover:scale-100 hover:opacity-100`: `scale-0`
352
  )}>
353
  <RxReload
354
  className="w-3 h-3 md:w-4 md:h-4 lg:w-5 lg:h-5"
 
362
  )}>Redraw</span>
363
  </div>
364
  <EditModal
365
+ isEnabled={hasSucceededOrFailed}
366
  existingPrompt={prompt}
367
  onSave={handleSavePrompt}
368
  >
 
372
  `flex flex-row space-x-2 items-center`,
373
  `py-1 px-3 md:py-2 md:px-3 cursor-pointer`,
374
  `transition-all duration-200 ease-in-out`,
375
+ hasSucceededOrFailed ? "opacity-95" : "opacity-50",
376
+ mouseOver && hasSucceededOrFailed ? `scale-95 hover:scale-100 hover:opacity-100`: `scale-0`
377
  )}>
378
  <RxPencil2
379
  className="w-3 h-3 md:w-4 md:h-4 lg:w-5 lg:h-5"