feat: add onChange handlers to ChipSelect and Text components; clear imageQueue on background type and category changes

This commit is contained in:
alexsparkes
2025-10-31 16:42:15 +00:00
parent ef22e91b07
commit b303d02492
6 changed files with 71 additions and 14 deletions

View File

@@ -8,7 +8,7 @@ import FormControl from '@mui/material/FormControl';
import Select from '@mui/material/Select';
import Chip from '@mui/material/Chip';
function ChipSelect({ label, options }) {
function ChipSelect({ label, options, onChange }) {
let start = (localStorage.getItem('apiCategories') || '').split(',');
if (start[0] === '') {
start = [];
@@ -22,6 +22,11 @@ function ChipSelect({ label, options }) {
} = event;
setoptionsSelected(typeof value === 'string' ? value.split(',') : value);
localStorage.setItem('apiCategories', value);
// Call parent onChange if provided
if (onChange) {
onChange(value);
}
};
return (

View File

@@ -20,6 +20,11 @@ const Text = memo((props) => {
localStorage.setItem(props.name, value);
setValue(value);
// Call parent onChange if provided
if (props.onChange) {
props.onChange(value);
}
if (props.element) {
if (!document.querySelector(props.element)) {
document.querySelector('.reminder-info').style.display = 'flex';
@@ -28,7 +33,7 @@ const Text = memo((props) => {
}
EventBus.emit('refresh', props.category);
}, [props.name, props.upperCaseFirst, props.element, props.category]);
}, [props.name, props.upperCaseFirst, props.element, props.category, props.onChange]);
const resetItem = useCallback(() => {
handleChange({