feat: enhance click handling for color inputs and update event bus cleanup

This commit is contained in:
alexsparkes
2026-02-04 21:15:12 +00:00
parent 7a390b91ca
commit 8dd6cf2655
18 changed files with 188 additions and 112 deletions

View File

@@ -141,7 +141,7 @@ const Greeting = () => {
EventBus.on('refresh', handleRefresh);
return () => {
EventBus.off('refresh');
EventBus.off('refresh', handleRefresh);
if (timerRef.current) {
clearTimeout(timerRef.current);
}

View File

@@ -273,12 +273,12 @@ const GreetingOptions = ({ currentSubSection, onSubSectionChange, sectionName })
name="greetingFontWeight"
category="greeting"
items={[
{ value: '400', text: t(fontWeight + '.normal') },
{ value: '600', text: t(fontWeight + '.semi_bold') },
{ value: '100', text: t(fontWeight + '.thin') },
{ value: '200', text: t(fontWeight + '.extra_light') },
{ value: '300', text: t(fontWeight + '.light') },
{ value: '400', text: t(fontWeight + '.normal') },
{ value: '500', text: t(fontWeight + '.medium') },
{ value: '600', text: t(fontWeight + '.semi_bold') },
{ value: '700', text: t(fontWeight + '.bold') },
{ value: '800', text: t(fontWeight + '.extra_bold') },
]}

View File

@@ -26,7 +26,7 @@ const Message = () => {
EventBus.on('refresh', handleRefresh);
return () => {
EventBus.off('refresh');
EventBus.off('refresh', handleRefresh);
};
}, []);

View File

@@ -63,7 +63,7 @@ const Widgets = () => {
EventBus.on('refresh', handleRefresh);
return () => {
EventBus.off('refresh');
EventBus.off('refresh', handleRefresh);
};
}, []);

View File

@@ -67,7 +67,7 @@ const Navbar = ({ openModal }) => {
EventBus.on('refresh', handleRefresh);
return () => {
EventBus.off('refresh');
EventBus.off('refresh', handleRefresh);
};
}, []);

View File

@@ -28,7 +28,7 @@ const Notes = ({ notesRef, floatRef, position, xPosition, yPosition }) => {
EventBus.on('refresh', handleRefresh);
return () => {
EventBus.off('refresh');
EventBus.off('refresh', handleRefresh);
};
}, []);

View File

@@ -232,12 +232,12 @@ const QuoteOptions = ({ currentSubSection, onSubSectionChange, sectionName }) =>
name="quoteFontWeight"
category="quote"
items={[
{ value: '400', text: t(fontWeight + '.normal') },
{ value: '600', text: t(fontWeight + '.semi_bold') },
{ value: '100', text: t(fontWeight + '.thin') },
{ value: '200', text: t(fontWeight + '.extra_light') },
{ value: '300', text: t(fontWeight + '.light') },
{ value: '400', text: t(fontWeight + '.normal') },
{ value: '500', text: t(fontWeight + '.medium') },
{ value: '600', text: t(fontWeight + '.semi_bold') },
{ value: '700', text: t(fontWeight + '.bold') },
{ value: '800', text: t(fontWeight + '.extra_bold') },
]}

View File

@@ -81,11 +81,16 @@ function Search() {
}
}
EventBus.on('refresh', (data) => {
const handleRefresh = (data) => {
if (data === 'search') {
init();
}
});
};
EventBus.on('refresh', handleRefresh);
return () => {
EventBus.off('refresh', handleRefresh);
};
}, [init]);
function searchButton(e) {

View File

@@ -54,7 +54,7 @@ const Autocomplete = ({
EventBus.on('refresh', handleRefresh);
return () => {
EventBus.off('refresh');
EventBus.off('refresh', handleRefresh);
};
}, []);

View File

@@ -135,7 +135,7 @@ const Clock = () => {
EventBus.on('refresh', handleRefresh);
return () => {
EventBus.off('refresh');
EventBus.off('refresh', handleRefresh);
if (timerRef.current) {
clearTimeout(timerRef.current);
}

View File

@@ -143,7 +143,7 @@ const DateWidget = () => {
EventBus.on('refresh', handleRefresh);
return () => {
EventBus.off('refresh');
EventBus.off('refresh', handleRefresh);
};
}, []);

View File

@@ -253,12 +253,12 @@ const TimeOptions = ({ currentSubSection, onSubSectionChange, sectionName }) =>
name="clockFontWeight"
category="clock"
items={[
{ value: '400', text: t(fontWeight + '.normal') },
{ value: '600', text: t(fontWeight + '.semi_bold') },
{ value: '100', text: t(fontWeight + '.thin') },
{ value: '200', text: t(fontWeight + '.extra_light') },
{ value: '300', text: t(fontWeight + '.light') },
{ value: '400', text: t(fontWeight + '.normal') },
{ value: '500', text: t(fontWeight + '.medium') },
{ value: '600', text: t(fontWeight + '.semi_bold') },
{ value: '700', text: t(fontWeight + '.bold') },
{ value: '800', text: t(fontWeight + '.extra_bold') },
]}