feat: integrate EventBus for color change refresh in Greeting, Quote, and Time options

This commit is contained in:
alexsparkes
2026-02-05 22:51:47 +00:00
parent 8dd6cf2655
commit a0517acd53
3 changed files with 7 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
import { useT } from 'contexts';
import { useState } from 'react';
import EventBus from 'utils/eventbus';
import {
Header,
@@ -240,6 +241,7 @@ const GreetingOptions = ({ currentSubSection, onSubSectionChange, sectionName })
const color = event.target.value;
setGreetingColor(color);
localStorage.setItem('greetingColor', color);
EventBus.emit('refresh', 'greeting');
};
return (

View File

@@ -1,6 +1,7 @@
import { useT } from 'contexts';
import variables from 'config/variables';
import React, { useState, useEffect } from 'react';
import EventBus from 'utils/eventbus';
import {
MdCancel,
MdAdd,
@@ -199,6 +200,7 @@ const QuoteOptions = ({ currentSubSection, onSubSectionChange, sectionName }) =>
const color = event.target.value;
setQuoteColor(color);
localStorage.setItem('quoteColor', color);
EventBus.emit('refresh', 'quote');
};
return (

View File

@@ -1,5 +1,6 @@
import { useT } from 'contexts';
import React, { useState } from 'react';
import EventBus from 'utils/eventbus';
import { Header, Row, Content, Action, PreferencesWrapper, Section } from 'components/Layout/Settings';
import { Checkbox, Dropdown, Radio } from 'components/Form/Settings';
@@ -30,6 +31,7 @@ const TimeOptions = ({ currentSubSection, onSubSectionChange, sectionName }) =>
setSecondColour(colour);
}
localStorage.setItem(type, colour);
EventBus.emit('refresh', 'clock');
};
const WidgetType = () => {
@@ -220,6 +222,7 @@ const TimeOptions = ({ currentSubSection, onSubSectionChange, sectionName }) =>
const color = event.target.value;
setClockColor(color);
localStorage.setItem('clockColor', color);
EventBus.emit('refresh', 'clock');
};
return (