import React from 'react';
import { CERT_LABELS } from '../data/constants';

export default function UploadSourceSheet({ visible, certType, onCamera, onAlbum, onCancel }) {
  if (!visible || !certType) return null;
  const label = CERT_LABELS[certType] || '证件';

  return (
    <div className="dt-sheet-overlay" onClick={onCancel}>
      <div className="dt-sheet" onClick={(e) => e.stopPropagation()}>
        <div className="dt-sheet-title">上传{label}</div>
        <p className="dt-sheet-desc">请选择获取证件照片的方式</p>
        <button type="button" className="dt-sheet-option" onClick={onCamera}>
          <span className="dt-sheet-option-icon" aria-hidden>📷</span>
          <span className="dt-sheet-option-text">
            <strong>拍照上传</strong>
            <small>调用摄像头拍摄证件</small>
          </span>
        </button>
        <button type="button" className="dt-sheet-option" onClick={onAlbum}>
          <span className="dt-sheet-option-icon" aria-hidden>🖼</span>
          <span className="dt-sheet-option-text">
            <strong>从相册选择</strong>
            <small>选择本地已保存的证件照片</small>
          </span>
        </button>
        <button type="button" className="dt-sheet-cancel" onClick={onCancel}>
          取消
        </button>
      </div>
    </div>
  );
}
