NotificationProviderCard.tsx 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. import { useState } from 'react';
  2. import { useMutation, useQueryClient, useQuery } from '@tanstack/react-query';
  3. import { Bell, Trash2, Settings2, Edit2, Send, Loader2, CheckCircle, XCircle, Moon, Clock, ChevronDown, ChevronUp, Calendar } from 'lucide-react';
  4. import { api } from '../api/client';
  5. import { formatDateOnly, parseUTCDate } from '../utils/date';
  6. import type { NotificationProvider, NotificationProviderUpdate } from '../api/client';
  7. import { Card, CardContent } from './Card';
  8. import { Button } from './Button';
  9. import { ConfirmModal } from './ConfirmModal';
  10. import { Toggle } from './Toggle';
  11. interface NotificationProviderCardProps {
  12. provider: NotificationProvider;
  13. onEdit: (provider: NotificationProvider) => void;
  14. }
  15. const PROVIDER_LABELS: Record<string, string> = {
  16. callmebot: 'CallMeBot/WhatsApp',
  17. ntfy: 'ntfy',
  18. pushover: 'Pushover',
  19. telegram: 'Telegram',
  20. email: 'Email',
  21. discord: 'Discord',
  22. webhook: 'Webhook',
  23. };
  24. export function NotificationProviderCard({ provider, onEdit }: NotificationProviderCardProps) {
  25. const queryClient = useQueryClient();
  26. const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
  27. const [isExpanded, setIsExpanded] = useState(false);
  28. const [testResult, setTestResult] = useState<{ success: boolean; message: string } | null>(null);
  29. // Fetch printers for linking
  30. const { data: printers } = useQuery({
  31. queryKey: ['printers'],
  32. queryFn: api.getPrinters,
  33. });
  34. const linkedPrinter = printers?.find(p => p.id === provider.printer_id);
  35. // Update mutation
  36. const updateMutation = useMutation({
  37. mutationFn: (data: NotificationProviderUpdate) => api.updateNotificationProvider(provider.id, data),
  38. onSuccess: () => {
  39. queryClient.invalidateQueries({ queryKey: ['notification-providers'] });
  40. },
  41. });
  42. // Delete mutation
  43. const deleteMutation = useMutation({
  44. mutationFn: () => api.deleteNotificationProvider(provider.id),
  45. onSuccess: () => {
  46. queryClient.invalidateQueries({ queryKey: ['notification-providers'] });
  47. },
  48. });
  49. // Test mutation
  50. const testMutation = useMutation({
  51. mutationFn: () => api.testNotificationProvider(provider.id),
  52. onSuccess: (result) => {
  53. setTestResult(result);
  54. queryClient.invalidateQueries({ queryKey: ['notification-providers'] });
  55. },
  56. onError: (err: Error) => {
  57. setTestResult({ success: false, message: err.message });
  58. },
  59. });
  60. // Format time for display
  61. const formatTime = (time: string | null) => {
  62. if (!time) return '';
  63. return time;
  64. };
  65. return (
  66. <>
  67. <Card className="relative">
  68. <CardContent className="p-4">
  69. {/* Header Row */}
  70. <div className="flex items-start justify-between mb-3">
  71. <div className="flex items-center gap-3">
  72. <div className={`p-2 rounded-lg ${provider.enabled ? 'bg-bambu-green/20' : 'bg-bambu-dark'}`}>
  73. <Bell className={`w-5 h-5 ${provider.enabled ? 'text-bambu-green' : 'text-bambu-gray'}`} />
  74. </div>
  75. <div>
  76. <h3 className="font-medium text-white">{provider.name}</h3>
  77. <p className="text-sm text-bambu-gray">{PROVIDER_LABELS[provider.provider_type] || provider.provider_type}</p>
  78. </div>
  79. </div>
  80. {/* Quick enable/disable toggle + Status indicator */}
  81. <div className="flex items-center gap-3">
  82. {provider.last_success && (
  83. <span className="text-xs text-status-ok hidden sm:inline">Last: {formatDateOnly(provider.last_success)}</span>
  84. )}
  85. {/* Only show error if it's more recent than last success */}
  86. {provider.last_error && provider.last_error_at && (
  87. !provider.last_success || (parseUTCDate(provider.last_error_at)?.getTime() || 0) > (parseUTCDate(provider.last_success)?.getTime() || 0)
  88. ) && (
  89. <span className="text-xs text-status-error" title={provider.last_error}>Error</span>
  90. )}
  91. <Toggle
  92. checked={provider.enabled}
  93. onChange={(checked) => updateMutation.mutate({ enabled: checked })}
  94. />
  95. </div>
  96. </div>
  97. {/* Linked Printer */}
  98. {linkedPrinter && (
  99. <div className="mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg">
  100. <span className="text-xs text-bambu-gray">Printer: </span>
  101. <span className="text-sm text-white">{linkedPrinter.name}</span>
  102. </div>
  103. )}
  104. {!linkedPrinter && !provider.printer_id && (
  105. <div className="mb-3 px-2 py-1.5 bg-bambu-dark rounded-lg">
  106. <span className="text-xs text-bambu-gray">All printers</span>
  107. </div>
  108. )}
  109. {/* Event summary - show all event tags */}
  110. <div className="mb-3 flex flex-wrap gap-1">
  111. {provider.on_print_start && (
  112. <span className="px-2 py-0.5 bg-blue-500/20 text-blue-400 text-xs rounded">Start</span>
  113. )}
  114. {provider.on_plate_not_empty && (
  115. <span className="px-2 py-0.5 bg-rose-600/20 text-rose-300 text-xs rounded">Plate Check</span>
  116. )}
  117. {provider.on_print_complete && (
  118. <span className="px-2 py-0.5 bg-bambu-green/20 text-bambu-green text-xs rounded">Complete</span>
  119. )}
  120. {provider.on_print_failed && (
  121. <span className="px-2 py-0.5 bg-red-500/20 text-red-400 text-xs rounded">Failed</span>
  122. )}
  123. {provider.on_print_stopped && (
  124. <span className="px-2 py-0.5 bg-orange-500/20 text-orange-400 text-xs rounded">Stopped</span>
  125. )}
  126. {provider.on_print_progress && (
  127. <span className="px-2 py-0.5 bg-yellow-500/20 text-yellow-400 text-xs rounded">Progress</span>
  128. )}
  129. {provider.on_printer_offline && (
  130. <span className="px-2 py-0.5 bg-gray-500/20 text-gray-400 text-xs rounded">Offline</span>
  131. )}
  132. {provider.on_printer_error && (
  133. <span className="px-2 py-0.5 bg-rose-500/20 text-rose-400 text-xs rounded">Error</span>
  134. )}
  135. {provider.on_filament_low && (
  136. <span className="px-2 py-0.5 bg-cyan-500/20 text-cyan-400 text-xs rounded">Low Filament</span>
  137. )}
  138. {provider.on_maintenance_due && (
  139. <span className="px-2 py-0.5 bg-purple-500/20 text-purple-400 text-xs rounded">Maintenance</span>
  140. )}
  141. {provider.on_ams_humidity_high && (
  142. <span className="px-2 py-0.5 bg-blue-600/20 text-blue-300 text-xs rounded">AMS Humidity</span>
  143. )}
  144. {provider.on_ams_temperature_high && (
  145. <span className="px-2 py-0.5 bg-orange-600/20 text-orange-300 text-xs rounded">AMS Temp</span>
  146. )}
  147. {provider.on_ams_ht_humidity_high && (
  148. <span className="px-2 py-0.5 bg-cyan-600/20 text-cyan-300 text-xs rounded">AMS-HT Humidity</span>
  149. )}
  150. {provider.on_ams_ht_temperature_high && (
  151. <span className="px-2 py-0.5 bg-amber-600/20 text-amber-300 text-xs rounded">AMS-HT Temp</span>
  152. )}
  153. {provider.on_bed_cooled && (
  154. <span className="px-2 py-0.5 bg-teal-500/20 text-teal-400 text-xs rounded">Bed Cooled</span>
  155. )}
  156. {provider.quiet_hours_enabled && (
  157. <span className="px-2 py-0.5 bg-indigo-500/20 text-indigo-400 text-xs rounded flex items-center gap-1">
  158. <Moon className="w-3 h-3" />
  159. Quiet
  160. </span>
  161. )}
  162. {provider.daily_digest_enabled && (
  163. <span className="px-2 py-0.5 bg-emerald-500/20 text-emerald-400 text-xs rounded flex items-center gap-1">
  164. <Calendar className="w-3 h-3" />
  165. Digest {provider.daily_digest_time}
  166. </span>
  167. )}
  168. </div>
  169. {/* Test Button */}
  170. <div className="mb-3">
  171. <Button
  172. size="sm"
  173. variant="secondary"
  174. disabled={testMutation.isPending}
  175. onClick={() => {
  176. setTestResult(null);
  177. testMutation.mutate();
  178. }}
  179. className="w-full"
  180. >
  181. {testMutation.isPending ? (
  182. <Loader2 className="w-4 h-4 animate-spin" />
  183. ) : (
  184. <Send className="w-4 h-4" />
  185. )}
  186. Send Test Notification
  187. </Button>
  188. </div>
  189. {/* Test Result */}
  190. {testResult && (
  191. <div className={`mb-3 p-2 rounded-lg flex items-center gap-2 text-sm ${
  192. testResult.success
  193. ? 'bg-bambu-green/20 text-bambu-green'
  194. : 'bg-red-500/20 text-red-400'
  195. }`}>
  196. {testResult.success ? (
  197. <CheckCircle className="w-4 h-4" />
  198. ) : (
  199. <XCircle className="w-4 h-4" />
  200. )}
  201. <span>{testResult.message}</span>
  202. </div>
  203. )}
  204. {/* Toggle Settings Panel */}
  205. <button
  206. onClick={() => setIsExpanded(!isExpanded)}
  207. className="w-full flex items-center justify-between py-2 text-sm text-bambu-gray hover:text-white transition-colors border-t border-bambu-dark-tertiary"
  208. >
  209. <span className="flex items-center gap-2">
  210. <Settings2 className="w-4 h-4" />
  211. Event Settings
  212. </span>
  213. {isExpanded ? (
  214. <ChevronUp className="w-4 h-4" />
  215. ) : (
  216. <ChevronDown className="w-4 h-4" />
  217. )}
  218. </button>
  219. {/* Expanded Settings */}
  220. {isExpanded && (
  221. <div className="pt-3 border-t border-bambu-dark-tertiary space-y-4">
  222. {/* Enabled Toggle */}
  223. <div className="flex items-center justify-between">
  224. <div>
  225. <p className="text-sm text-white">Enabled</p>
  226. <p className="text-xs text-bambu-gray">Send notifications from this provider</p>
  227. </div>
  228. <Toggle
  229. checked={provider.enabled}
  230. onChange={(checked) => updateMutation.mutate({ enabled: checked })}
  231. />
  232. </div>
  233. {/* Print Lifecycle Events */}
  234. <div className="space-y-2">
  235. <p className="text-xs text-bambu-gray uppercase tracking-wide">Print Events</p>
  236. <div className="flex items-center justify-between">
  237. <p className="text-sm text-white">Print Started</p>
  238. <Toggle
  239. checked={provider.on_print_start}
  240. onChange={(checked) => updateMutation.mutate({ on_print_start: checked })}
  241. />
  242. </div>
  243. <div className="flex items-center justify-between">
  244. <div>
  245. <p className="text-sm text-white">Plate Not Empty</p>
  246. <p className="text-xs text-bambu-gray">Objects detected before print</p>
  247. </div>
  248. <Toggle
  249. checked={provider.on_plate_not_empty ?? true}
  250. onChange={(checked) => updateMutation.mutate({ on_plate_not_empty: checked })}
  251. />
  252. </div>
  253. <div className="flex items-center justify-between">
  254. <p className="text-sm text-white">Print Completed</p>
  255. <Toggle
  256. checked={provider.on_print_complete}
  257. onChange={(checked) => updateMutation.mutate({ on_print_complete: checked })}
  258. />
  259. </div>
  260. <div className="flex items-center justify-between">
  261. <div>
  262. <p className="text-sm text-white">Bed Cooled</p>
  263. <p className="text-xs text-bambu-gray">Bed cooled below threshold after print</p>
  264. </div>
  265. <Toggle
  266. checked={provider.on_bed_cooled ?? false}
  267. onChange={(checked) => updateMutation.mutate({ on_bed_cooled: checked })}
  268. />
  269. </div>
  270. <div className="flex items-center justify-between">
  271. <p className="text-sm text-white">Print Failed</p>
  272. <Toggle
  273. checked={provider.on_print_failed}
  274. onChange={(checked) => updateMutation.mutate({ on_print_failed: checked })}
  275. />
  276. </div>
  277. <div className="flex items-center justify-between">
  278. <p className="text-sm text-white">Print Stopped</p>
  279. <Toggle
  280. checked={provider.on_print_stopped}
  281. onChange={(checked) => updateMutation.mutate({ on_print_stopped: checked })}
  282. />
  283. </div>
  284. <div className="flex items-center justify-between">
  285. <div>
  286. <p className="text-sm text-white">Progress Milestones</p>
  287. <p className="text-xs text-bambu-gray">Notify at 25%, 50%, 75%</p>
  288. </div>
  289. <Toggle
  290. checked={provider.on_print_progress}
  291. onChange={(checked) => updateMutation.mutate({ on_print_progress: checked })}
  292. />
  293. </div>
  294. </div>
  295. {/* Printer Status Events */}
  296. <div className="space-y-2">
  297. <p className="text-xs text-bambu-gray uppercase tracking-wide">Printer Status</p>
  298. <div className="flex items-center justify-between">
  299. <p className="text-sm text-white">Printer Offline</p>
  300. <Toggle
  301. checked={provider.on_printer_offline}
  302. onChange={(checked) => updateMutation.mutate({ on_printer_offline: checked })}
  303. />
  304. </div>
  305. <div className="flex items-center justify-between">
  306. <p className="text-sm text-white">Printer Error</p>
  307. <Toggle
  308. checked={provider.on_printer_error}
  309. onChange={(checked) => updateMutation.mutate({ on_printer_error: checked })}
  310. />
  311. </div>
  312. <div className="flex items-center justify-between">
  313. <p className="text-sm text-white">Low Filament</p>
  314. <Toggle
  315. checked={provider.on_filament_low}
  316. onChange={(checked) => updateMutation.mutate({ on_filament_low: checked })}
  317. />
  318. </div>
  319. <div className="flex items-center justify-between">
  320. <div>
  321. <p className="text-sm text-white">Maintenance Due</p>
  322. <p className="text-xs text-bambu-gray">Notify when maintenance is needed</p>
  323. </div>
  324. <Toggle
  325. checked={provider.on_maintenance_due ?? false}
  326. onChange={(checked) => updateMutation.mutate({ on_maintenance_due: checked })}
  327. />
  328. </div>
  329. </div>
  330. {/* AMS Environmental Alarms (regular AMS) */}
  331. <div className="space-y-2">
  332. <p className="text-xs text-bambu-gray uppercase tracking-wide">AMS Alarms</p>
  333. <div className="flex items-center justify-between">
  334. <div>
  335. <p className="text-sm text-white">AMS Humidity High</p>
  336. <p className="text-xs text-bambu-gray">Regular AMS humidity exceeds threshold</p>
  337. </div>
  338. <Toggle
  339. checked={provider.on_ams_humidity_high ?? false}
  340. onChange={(checked) => updateMutation.mutate({ on_ams_humidity_high: checked })}
  341. />
  342. </div>
  343. <div className="flex items-center justify-between">
  344. <div>
  345. <p className="text-sm text-white">AMS Temperature High</p>
  346. <p className="text-xs text-bambu-gray">Regular AMS temperature exceeds threshold</p>
  347. </div>
  348. <Toggle
  349. checked={provider.on_ams_temperature_high ?? false}
  350. onChange={(checked) => updateMutation.mutate({ on_ams_temperature_high: checked })}
  351. />
  352. </div>
  353. </div>
  354. {/* AMS-HT Environmental Alarms */}
  355. <div className="space-y-2">
  356. <p className="text-xs text-bambu-gray uppercase tracking-wide">AMS-HT Alarms</p>
  357. <div className="flex items-center justify-between">
  358. <div>
  359. <p className="text-sm text-white">AMS-HT Humidity High</p>
  360. <p className="text-xs text-bambu-gray">AMS-HT humidity exceeds threshold</p>
  361. </div>
  362. <Toggle
  363. checked={provider.on_ams_ht_humidity_high ?? false}
  364. onChange={(checked) => updateMutation.mutate({ on_ams_ht_humidity_high: checked })}
  365. />
  366. </div>
  367. <div className="flex items-center justify-between">
  368. <div>
  369. <p className="text-sm text-white">AMS-HT Temperature High</p>
  370. <p className="text-xs text-bambu-gray">AMS-HT temperature exceeds threshold</p>
  371. </div>
  372. <Toggle
  373. checked={provider.on_ams_ht_temperature_high ?? false}
  374. onChange={(checked) => updateMutation.mutate({ on_ams_ht_temperature_high: checked })}
  375. />
  376. </div>
  377. </div>
  378. {/* Print Queue Events */}
  379. <div className="space-y-2">
  380. <p className="text-xs text-bambu-gray uppercase tracking-wide">Print Queue</p>
  381. <div className="flex items-center justify-between">
  382. <div>
  383. <p className="text-sm text-white">Job Added</p>
  384. <p className="text-xs text-bambu-gray">Job added to queue</p>
  385. </div>
  386. <Toggle
  387. checked={provider.on_queue_job_added ?? false}
  388. onChange={(checked) => updateMutation.mutate({ on_queue_job_added: checked })}
  389. />
  390. </div>
  391. <div className="flex items-center justify-between">
  392. <div>
  393. <p className="text-sm text-white">Job Assigned</p>
  394. <p className="text-xs text-bambu-gray">Model-based job assigned to printer</p>
  395. </div>
  396. <Toggle
  397. checked={provider.on_queue_job_assigned ?? false}
  398. onChange={(checked) => updateMutation.mutate({ on_queue_job_assigned: checked })}
  399. />
  400. </div>
  401. <div className="flex items-center justify-between">
  402. <div>
  403. <p className="text-sm text-white">Job Started</p>
  404. <p className="text-xs text-bambu-gray">Queue job started printing</p>
  405. </div>
  406. <Toggle
  407. checked={provider.on_queue_job_started ?? false}
  408. onChange={(checked) => updateMutation.mutate({ on_queue_job_started: checked })}
  409. />
  410. </div>
  411. <div className="flex items-center justify-between">
  412. <div>
  413. <p className="text-sm text-white">Job Waiting</p>
  414. <p className="text-xs text-bambu-gray">Job waiting for filament</p>
  415. </div>
  416. <Toggle
  417. checked={provider.on_queue_job_waiting ?? true}
  418. onChange={(checked) => updateMutation.mutate({ on_queue_job_waiting: checked })}
  419. />
  420. </div>
  421. <div className="flex items-center justify-between">
  422. <div>
  423. <p className="text-sm text-white">Job Skipped</p>
  424. <p className="text-xs text-bambu-gray">Job skipped (previous failed)</p>
  425. </div>
  426. <Toggle
  427. checked={provider.on_queue_job_skipped ?? true}
  428. onChange={(checked) => updateMutation.mutate({ on_queue_job_skipped: checked })}
  429. />
  430. </div>
  431. <div className="flex items-center justify-between">
  432. <div>
  433. <p className="text-sm text-white">Job Failed</p>
  434. <p className="text-xs text-bambu-gray">Job failed to start</p>
  435. </div>
  436. <Toggle
  437. checked={provider.on_queue_job_failed ?? true}
  438. onChange={(checked) => updateMutation.mutate({ on_queue_job_failed: checked })}
  439. />
  440. </div>
  441. <div className="flex items-center justify-between">
  442. <div>
  443. <p className="text-sm text-white">Queue Complete</p>
  444. <p className="text-xs text-bambu-gray">All queue jobs finished</p>
  445. </div>
  446. <Toggle
  447. checked={provider.on_queue_completed ?? false}
  448. onChange={(checked) => updateMutation.mutate({ on_queue_completed: checked })}
  449. />
  450. </div>
  451. </div>
  452. {/* Quiet Hours */}
  453. <div className="space-y-2">
  454. <div className="flex items-center justify-between">
  455. <div className="flex items-center gap-2">
  456. <Moon className="w-4 h-4 text-purple-400" />
  457. <p className="text-sm text-white">Quiet Hours</p>
  458. </div>
  459. <Toggle
  460. checked={provider.quiet_hours_enabled}
  461. onChange={(checked) => updateMutation.mutate({ quiet_hours_enabled: checked })}
  462. />
  463. </div>
  464. {provider.quiet_hours_enabled && (
  465. <div className="pl-4 border-l-2 border-bambu-dark-tertiary space-y-2">
  466. <p className="text-xs text-bambu-gray">No notifications during these hours</p>
  467. <div className="flex items-center gap-2">
  468. <Clock className="w-4 h-4 text-bambu-gray" />
  469. <span className="text-sm text-white">
  470. {formatTime(provider.quiet_hours_start) || '22:00'} - {formatTime(provider.quiet_hours_end) || '07:00'}
  471. </span>
  472. </div>
  473. <p className="text-xs text-bambu-gray">Edit provider to change quiet hours</p>
  474. </div>
  475. )}
  476. </div>
  477. {/* Daily Digest */}
  478. <div className="space-y-2">
  479. <div className="flex items-center justify-between">
  480. <div className="flex items-center gap-2">
  481. <Calendar className="w-4 h-4 text-emerald-400" />
  482. <p className="text-sm text-white">Daily Digest</p>
  483. </div>
  484. <Toggle
  485. checked={provider.daily_digest_enabled}
  486. onChange={(checked) => updateMutation.mutate({ daily_digest_enabled: checked })}
  487. />
  488. </div>
  489. {provider.daily_digest_enabled && (
  490. <div className="pl-4 border-l-2 border-bambu-dark-tertiary space-y-2">
  491. <p className="text-xs text-bambu-gray">Batch notifications into a single daily summary</p>
  492. <div className="flex items-center gap-2">
  493. <Clock className="w-4 h-4 text-bambu-gray" />
  494. <span className="text-sm text-white">
  495. Send at {formatTime(provider.daily_digest_time) || '08:00'}
  496. </span>
  497. </div>
  498. <p className="text-xs text-bambu-gray">Edit provider to change digest time</p>
  499. </div>
  500. )}
  501. </div>
  502. {/* Action Buttons */}
  503. <div className="flex gap-2 pt-2">
  504. <Button
  505. size="sm"
  506. variant="secondary"
  507. onClick={() => onEdit(provider)}
  508. className="flex-1"
  509. >
  510. <Edit2 className="w-4 h-4" />
  511. Edit
  512. </Button>
  513. <Button
  514. size="sm"
  515. variant="secondary"
  516. onClick={() => setShowDeleteConfirm(true)}
  517. className="text-red-400 hover:text-red-300"
  518. >
  519. <Trash2 className="w-4 h-4" />
  520. </Button>
  521. </div>
  522. </div>
  523. )}
  524. </CardContent>
  525. </Card>
  526. {/* Delete Confirmation */}
  527. {showDeleteConfirm && (
  528. <ConfirmModal
  529. title="Delete Notification Provider"
  530. message={`Are you sure you want to delete "${provider.name}"? This cannot be undone.`}
  531. confirmText="Delete"
  532. variant="danger"
  533. onConfirm={() => {
  534. deleteMutation.mutate();
  535. setShowDeleteConfirm(false);
  536. }}
  537. onCancel={() => setShowDeleteConfirm(false)}
  538. />
  539. )}
  540. </>
  541. );
  542. }