|
| 1 | +import React from 'react'; |
| 2 | +import { useTranslation } from 'react-i18next'; |
| 3 | +import { type FormatDetails } from './AddAlbumVersionModal'; |
| 4 | +import { getImageUrl } from '../../utils/imageUrl'; |
| 5 | + |
| 6 | +interface ConfirmAddModalProps { |
| 7 | + isOpen: boolean; |
| 8 | + coverImage?: string; |
| 9 | + albumTitle?: string; |
| 10 | + format: FormatDetails | null; |
| 11 | + onConfirm: () => void; |
| 12 | + onCancel: () => void; |
| 13 | +} |
| 14 | + |
| 15 | +const ConfirmAddModal: React.FC<ConfirmAddModalProps> = ({ |
| 16 | + isOpen, |
| 17 | + coverImage, |
| 18 | + albumTitle, |
| 19 | + format, |
| 20 | + onConfirm, |
| 21 | + onCancel, |
| 22 | +}) => { |
| 23 | + const { t } = useTranslation(); |
| 24 | + |
| 25 | + if (!isOpen || !format) return null; |
| 26 | + |
| 27 | + return ( |
| 28 | + <dialog className="modal modal-open"> |
| 29 | + {/* Transparent glassmorphism backdrop */} |
| 30 | + <div |
| 31 | + className="modal-box border border-base-content/10" |
| 32 | + style={{ |
| 33 | + background: 'color-mix(in srgb, oklch(var(--b2)) 40%, transparent)', |
| 34 | + backdropFilter: 'blur(8px)', |
| 35 | + WebkitBackdropFilter: 'blur(8px)', |
| 36 | + }} |
| 37 | + > |
| 38 | + <div className="flex gap-4 items-start"> |
| 39 | + {/* Album cover */} |
| 40 | + {coverImage && ( |
| 41 | + <img |
| 42 | + src={getImageUrl(coverImage)} |
| 43 | + alt={albumTitle || ''} |
| 44 | + className="w-20 h-20 rounded-lg object-cover shadow-md flex-shrink-0" |
| 45 | + /> |
| 46 | + )} |
| 47 | + |
| 48 | + <div className="flex-1 min-w-0"> |
| 49 | + <h3 className="font-bold text-lg">{t('versions.confirmAddTitle')}</h3> |
| 50 | + {albumTitle && ( |
| 51 | + <p className="text-sm text-base-content/60 mt-0.5 truncate">{albumTitle}</p> |
| 52 | + )} |
| 53 | + <div className="mt-2"> |
| 54 | + <p className="text-base-content/80"> |
| 55 | + <span className="font-semibold">{format.name}</span> |
| 56 | + {format.text && <span className="ml-1 text-accent">{format.text}</span>} |
| 57 | + </p> |
| 58 | + {format.descriptions?.length > 0 && ( |
| 59 | + <p className="text-sm text-base-content/50 mt-0.5"> |
| 60 | + {format.descriptions.join(', ')} |
| 61 | + </p> |
| 62 | + )} |
| 63 | + </div> |
| 64 | + </div> |
| 65 | + </div> |
| 66 | + |
| 67 | + <div className="modal-action"> |
| 68 | + <button className="btn btn-ghost" onClick={onCancel}> |
| 69 | + {t('common.cancel')} |
| 70 | + </button> |
| 71 | + <button className="btn btn-primary" onClick={onConfirm}> |
| 72 | + {t('versions.confirmAddYes')} |
| 73 | + </button> |
| 74 | + </div> |
| 75 | + </div> |
| 76 | + <form method="dialog" className="modal-backdrop" style={{ background: 'rgba(0, 0, 0, 0.15)' }}> |
| 77 | + <button onClick={onCancel}>{t('common.close')}</button> |
| 78 | + </form> |
| 79 | + </dialog> |
| 80 | + ); |
| 81 | +}; |
| 82 | + |
| 83 | +export default ConfirmAddModal; |
0 commit comments