Add new config format

Should be WAAAAY easier to work with modules now
This commit is contained in:
ajnart
2022-05-22 20:42:10 +02:00
parent bf85818f8b
commit af2e0235bf
12 changed files with 99 additions and 65 deletions

View File

@@ -21,12 +21,7 @@ export const DateModule: IModule = {
export default function DateComponent(props: any) {
const [date, setDate] = useState(new Date());
const { config } = useConfig();
const hours = date.getHours();
const minutes = date.getMinutes();
const isFullTime =
config.settings[`${DateModule.title}.full`] === undefined
? true
: config.settings[`${DateModule.title}.full`];
const isFullTime = config?.modules?.[DateModule.title]?.options?.full?.value ?? false;
const formatString = isFullTime ? 'HH:mm' : 'h:mm A';
// Change date on minute change
// Note: Using 10 000ms instead of 1000ms to chill a little :)