Files
raucao 11f8d3f049 WIP: Add calendar settings and a nested modal stack
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.
2026-11-06 15:48:08 +04:00

93 lines
2.7 KiB
Plaintext

import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { action } from '@ember/object';
import { on } from '@ember/modifier';
import {
DEFAULT_SETTINGS_SECTION_ID,
SETTINGS_GROUPS,
findSettingsSection,
} from '../../config/settings';
import { contentFor } from '../../config/settings-content';
import Nav from './global-settings/nav.gjs';
import Section from './global-settings/section.gjs';
// Container for the global settings dialog: a left navigation menu and a right
// content pane. Phase 1 only renders placeholder content per section; real
// settings forms will replace the placeholders one section at a time.
export default class SettingsGlobalSettings extends Component {
@tracked activeId = DEFAULT_SETTINGS_SECTION_ID;
get groups() {
return SETTINGS_GROUPS;
}
get activeSection() {
return findSettingsSection(this.activeId);
}
get activeLabel() {
return this.activeSection?.label ?? 'Settings';
}
get activeContent() {
return contentFor(this.activeId);
}
@action
selectSection(id) {
this.activeId = id;
}
<template>
<div
class="flex h-[80vh] w-full flex-col text-gray-900 sm:h-[min(80vh,40rem)] sm:flex-row"
>
<Nav
@groups={{this.groups}}
@activeId={{this.activeId}}
@onSelect={{this.selectSection}}
/>
<div class="flex min-h-0 flex-1 flex-col">
<header
class="flex items-center justify-between gap-4 border-b border-gray-200 px-6 py-4"
>
<h3
id={{if @titleId @titleId "modal-title"}}
class="text-base font-semibold text-gray-900"
>
{{this.activeLabel}}
</h3>
<button
type="button"
{{on "click" @close}}
aria-label="Close settings"
class="rounded-md p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
>
<svg
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="1.5"
aria-hidden="true"
class="size-5"
>
<path
d="M6 18 18 6M6 6l12 12"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
</button>
</header>
{{#if this.activeContent}}
<this.activeContent @section={{this.activeSection}} />
{{else if this.activeSection}}
<Section @section={{this.activeSection}} />
{{/if}}
</div>
</div>
</template>
}