chore: remove unused code

This commit is contained in:
SethBurkart123
2024-02-26 18:28:50 +11:00
parent fbe2ae3347
commit 08c5e8978a
+6 -7
View File
@@ -48,7 +48,6 @@ function Picker() {
return () => { return () => {
window.removeEventListener("message", handleMessage); window.removeEventListener("message", handleMessage);
}; };
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []); }, []);
useEffect(() => { useEffect(() => {
@@ -56,7 +55,7 @@ function Picker() {
if (!showPicker) { if (!showPicker) {
// Check if the selected color is already in the presets // Check if the selected color is already in the presets
const existingIndex = presets.indexOf(settingsState.customThemeColor); const existingIndex = presets.indexOf(settingsState.customThemeColor);
let updatedPresets; let updatedPresets;
if (existingIndex > -1) { if (existingIndex > -1) {
// If the color exists, move it to the front // If the color exists, move it to the front
@@ -69,7 +68,7 @@ function Picker() {
// If the color is new, add it to the front and slice the array // If the color is new, add it to the front and slice the array
updatedPresets = [settingsState.customThemeColor, ...presets].slice(0, 18); updatedPresets = [settingsState.customThemeColor, ...presets].slice(0, 18);
} }
setPresets(updatedPresets); setPresets(updatedPresets);
localStorage.setItem('colorPickerPresets', JSON.stringify(updatedPresets)); localStorage.setItem('colorPickerPresets', JSON.stringify(updatedPresets));
} }
@@ -98,7 +97,7 @@ function Picker() {
return ( return (
// Apply fade-in animation to background // Apply fade-in animation to background
<motion.div <motion.div
initial="hidden" initial="hidden"
animate={showPicker ? "visible" : "exit"} animate={showPicker ? "visible" : "exit"}
exit="exit" exit="exit"
@@ -109,13 +108,13 @@ function Picker() {
> >
<div> <div>
{/* Apply springy scale animation */} {/* Apply springy scale animation */}
<motion.div <motion.div
initial="hidden" initial="hidden"
animate={showPicker ? "visible" : "exit"} animate={showPicker ? "visible" : "exit"}
exit="exit" exit="exit"
variants={scaleVariants} variants={scaleVariants}
transition={{ type: "spring", stiffness: 500, damping: 40 }} transition={{ type: "spring", stiffness: 500, damping: 40 }}
onClick={(e) => e.stopPropagation()} onClick={(e) => e.stopPropagation()}
className="h-auto p-4 bg-white border rounded-lg shadow-lg dark:bg-zinc-800 border-zinc-100 dark:border-zinc-700" className="h-auto p-4 bg-white border rounded-lg shadow-lg dark:bg-zinc-800 border-zinc-100 dark:border-zinc-700"
> >
<ColorPicker disableDarkMode={true} presets={presets} hideInputs={true} value={settingsState.customThemeColor} onChange={colorChange} /> <ColorPicker disableDarkMode={true} presets={presets} hideInputs={true} value={settingsState.customThemeColor} onChange={colorChange} />
@@ -125,4 +124,4 @@ function Picker() {
); );
} }
export default memo(Picker); export default memo(Picker);