mirror of
https://github.com/dergigi/boris.git
synced 2025-12-27 11:34:50 +01:00
- Create deletionService for NIP-09 kind:5 event deletion requests - Add ConfirmDialog component for user confirmation before deletion - Add subtle delete button to highlight items (trash icon) - Only show delete button for user's own highlights - Position delete button symmetrically opposite to relay indicator - Add confirmation dialog to prevent accidental deletions - Remove highlights from UI immediately after deletion request - Style delete button with red hover color - Add comprehensive confirmation dialog styling (danger/warning/info variants) Implements NIP-09 Event Deletion Request. Users can now delete their own highlights after confirming the action.
57 lines
1.4 KiB
TypeScript
57 lines
1.4 KiB
TypeScript
import React from 'react'
|
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons'
|
|
|
|
interface ConfirmDialogProps {
|
|
isOpen: boolean
|
|
title: string
|
|
message: string
|
|
confirmText?: string
|
|
cancelText?: string
|
|
onConfirm: () => void
|
|
onCancel: () => void
|
|
variant?: 'danger' | 'warning' | 'info'
|
|
}
|
|
|
|
const ConfirmDialog: React.FC<ConfirmDialogProps> = ({
|
|
isOpen,
|
|
title,
|
|
message,
|
|
confirmText = 'Confirm',
|
|
cancelText = 'Cancel',
|
|
onConfirm,
|
|
onCancel,
|
|
variant = 'warning'
|
|
}) => {
|
|
if (!isOpen) return null
|
|
|
|
return (
|
|
<div className="confirm-dialog-overlay" onClick={onCancel}>
|
|
<div className="confirm-dialog" onClick={(e) => e.stopPropagation()}>
|
|
<div className={`confirm-dialog-icon ${variant}`}>
|
|
<FontAwesomeIcon icon={faExclamationTriangle} />
|
|
</div>
|
|
<h3 className="confirm-dialog-title">{title}</h3>
|
|
<p className="confirm-dialog-message">{message}</p>
|
|
<div className="confirm-dialog-actions">
|
|
<button
|
|
className="confirm-dialog-btn cancel"
|
|
onClick={onCancel}
|
|
>
|
|
{cancelText}
|
|
</button>
|
|
<button
|
|
className={`confirm-dialog-btn confirm ${variant}`}
|
|
onClick={onConfirm}
|
|
>
|
|
{confirmText}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default ConfirmDialog
|
|
|