calendar menu: make weather optional (#253)

* calendar menu: make weather optional

adds a setting to enable or disable the weather widget in the calendar
menu.

* Fix bottom margin of last child card.

* Fix calendar dropdown merge linting and formatting errors.

* Settings dialog formatting error fix.

---------

Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
This commit is contained in:
Jonas
2024-10-03 05:42:04 +02:00
committed by GitHub
parent f26330d89e
commit fe53b3ebf1
4 changed files with 151 additions and 42 deletions

View File

@@ -1,9 +1,12 @@
import DropdownMenu from '../shared/dropdown/index.js';
import { TimeWidget } from './time/index.js';
import { CalendarWidget } from './calendar.js';
import { WeatherWidget } from './weather/index.js';
import Window from 'types/widgets/window.js';
import { Attribute, Child } from 'lib/types/widget.js';
import DropdownMenu from 'modules/menus/shared/dropdown/index';
import { TimeWidget } from './time/index';
import { CalendarWidget } from './calendar';
import { WeatherWidget } from './weather/index';
import options from 'options';
import Window from 'types/widgets/window';
import { Attribute, Child } from 'lib/types/widget';
const { enabled: weatherEnabled } = options.menus.clock.weather;
export default (): Window<Child, Attribute> => {
return DropdownMenu({
@@ -21,7 +24,9 @@ export default (): Window<Child, Attribute> => {
Widget.Box({
class_name: 'calendar-content-items',
vertical: true,
children: [TimeWidget(), CalendarWidget(), WeatherWidget()],
children: weatherEnabled.bind('value').as((isWeatherEnabled) => {
return [TimeWidget(), CalendarWidget(), ...(isWeatherEnabled ? [WeatherWidget()] : [])];
}),
}),
],
}),