Fraser commited on
Commit
0803fb8
·
1 Parent(s): 7a039f4

easy delete

Browse files
src/lib/components/Piclets/PicletDetail.svelte CHANGED
@@ -16,7 +16,6 @@
16
  }
17
 
18
  let { instance, onClose, onDeleted }: Props = $props();
19
- let showDeleteConfirm = $state(false);
20
  let selectedTab = $state<'about' | 'abilities'>('about');
21
  let isSharing = $state(false);
22
 
@@ -38,6 +37,9 @@
38
  async function handleDelete() {
39
  if (!instance.id) return;
40
 
 
 
 
41
  try {
42
  await deletePicletInstance(instance.id);
43
  onDeleted?.();
@@ -209,13 +211,7 @@
209
 
210
  <!-- Actions -->
211
  <div class="bottom-actions">
212
- {#if showDeleteConfirm}
213
- <p class="delete-confirm">Are you sure you want to release this piclet?</p>
214
- <button class="btn btn-danger" onclick={handleDelete}>Yes, Release</button>
215
- <button class="btn btn-secondary" onclick={() => showDeleteConfirm = false}>Cancel</button>
216
- {:else}
217
- <button class="btn btn-danger" onclick={() => showDeleteConfirm = true}>Release Piclet</button>
218
- {/if}
219
  </div>
220
  </div>
221
  </div>
@@ -466,12 +462,6 @@
466
  text-align: center;
467
  }
468
 
469
- .delete-confirm {
470
- margin: 0 0 1rem;
471
- color: #ff3b30;
472
- font-size: 16px;
473
- }
474
-
475
  .section-heading {
476
  font-size: 18px;
477
  font-weight: 600;
@@ -499,13 +489,6 @@
499
  width: 100%;
500
  }
501
 
502
- .btn-secondary {
503
- background: #e5e5ea;
504
- color: #333;
505
- margin-top: 8px;
506
- width: 100%;
507
- }
508
-
509
  /* Enhanced ability and move display styles */
510
  .moves-list {
511
  display: flex;
 
16
  }
17
 
18
  let { instance, onClose, onDeleted }: Props = $props();
 
19
  let selectedTab = $state<'about' | 'abilities'>('about');
20
  let isSharing = $state(false);
21
 
 
37
  async function handleDelete() {
38
  if (!instance.id) return;
39
 
40
+ const confirmed = confirm(`Are you sure you want to release ${instance.nickname || instance.typeId}? This action cannot be undone.`);
41
+ if (!confirmed) return;
42
+
43
  try {
44
  await deletePicletInstance(instance.id);
45
  onDeleted?.();
 
211
 
212
  <!-- Actions -->
213
  <div class="bottom-actions">
214
+ <button class="btn btn-danger" onclick={handleDelete}>Release Piclet</button>
 
 
 
 
 
 
215
  </div>
216
  </div>
217
  </div>
 
462
  text-align: center;
463
  }
464
 
 
 
 
 
 
 
465
  .section-heading {
466
  font-size: 18px;
467
  font-weight: 600;
 
489
  width: 100%;
490
  }
491
 
 
 
 
 
 
 
 
492
  /* Enhanced ability and move display styles */
493
  .moves-list {
494
  display: flex;