Add a 'days with events' preference (default 3, range 1-7) that drives the upcoming events widget, and extend the fetch window to 8 days so the largest window can populate. Add a Calendar settings pane (moved under Integrations) that lists the connected CalDAV/ICS sources in a two-column grid with add/edit/remove, and remove calendars from Manage Integrations. Turn the modal service into a stack so add/edit forms open on top of the settings dialog, with one dialog per level, per-entry title ids, and a softened stacked backdrop. Move CALENDAR_ACTOR into its own config module to break the calendar/caldav/ics import cycle.
77 lines
2.1 KiB
Plaintext
77 lines
2.1 KiB
Plaintext
import Component from '@glimmer/component';
|
|
import { tracked } from '@glimmer/tracking';
|
|
import { action } from '@ember/object';
|
|
import { service } from '@ember/service';
|
|
import { on } from '@ember/modifier';
|
|
import SettingsSelect from './integrations/select.gjs';
|
|
import { TIME_FORMATS } from '../../utils/time-format';
|
|
|
|
// Clock settings: choose how times are displayed across the dashboard. The
|
|
// calendar widget reads the same preference.
|
|
export default class SettingsClockForm extends Component {
|
|
@service clock;
|
|
|
|
@tracked formatDraft = null;
|
|
|
|
get format() {
|
|
return this.formatDraft ?? this.clock.timeFormat;
|
|
}
|
|
|
|
get options() {
|
|
return TIME_FORMATS;
|
|
}
|
|
|
|
@action
|
|
updateFormat(value) {
|
|
this.formatDraft = value;
|
|
}
|
|
|
|
@action
|
|
async handleSubmit(event) {
|
|
event.preventDefault();
|
|
await this.clock.setTimeFormat(this.format);
|
|
this.args.close?.();
|
|
}
|
|
|
|
<template>
|
|
<div class="p-6">
|
|
<h3
|
|
id={{if @titleId @titleId "modal-title"}}
|
|
class="text-base font-semibold leading-6 text-gray-900"
|
|
>Clock</h3>
|
|
<div class="mt-2">
|
|
<p class="text-sm text-gray-500">
|
|
Choose how times are displayed across the dashboard.
|
|
</p>
|
|
</div>
|
|
|
|
<form {{on "submit" this.handleSubmit}} class="mt-5">
|
|
<SettingsSelect
|
|
@id="clock-time-format"
|
|
@name="time-format"
|
|
@label="Time format"
|
|
@options={{this.options}}
|
|
@value={{this.format}}
|
|
@onChange={{this.updateFormat}}
|
|
/>
|
|
|
|
<div class="mt-5 sm:mt-6 flex gap-3">
|
|
<button
|
|
type="submit"
|
|
class="inline-flex w-full justify-center rounded-md bg-indigo-600 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500"
|
|
>
|
|
Save
|
|
</button>
|
|
<button
|
|
type="button"
|
|
{{on "click" @close}}
|
|
class="inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 hover:bg-gray-50"
|
|
>
|
|
Cancel
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</template>
|
|
}
|