import React, { useState } from 'react'; import { ColorScheme } from '../utils/colorSchemes'; import { generateYAML } from '../utils/yamlExport'; import Image from 'next/image'; import ColorPalette from './ColorPalette'; interface HistoryPopupProps { likedSchemes: ColorScheme[]; dislikedSchemes: ColorScheme[]; onClose: () => void; isDarkMode: boolean; } const HistoryPopup: React.FC = ({ likedSchemes, dislikedSchemes, onClose, isDarkMode }) => { const [copiedColor, setCopiedColor] = useState(null); const handleDownload = (scheme: ColorScheme) => { const yaml = generateYAML(scheme); const blob = new Blob([yaml], { type: 'text/yaml' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `${scheme.name.replace(/\s+/g, '_').toLowerCase()}.yaml`; document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); }; const renderSchemeGrid = (schemes: ColorScheme[], title: string) => (

{title}

{schemes.map((scheme, index) => (

{scheme.name}

))}
); return (

Color Scheme History

{renderSchemeGrid(likedSchemes, "Liked Schemes")} {renderSchemeGrid(dislikedSchemes, "Disliked Schemes")}
); }; export default HistoryPopup;