<!--
~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->

<ion-header>
  <ion-toolbar color="primary" mode="ios">
    <ion-buttons slot="start">
      <ion-back-button></ion-back-button>
    </ion-buttons>
    <ion-title>{{ 'settings.title' | translate | titlecase }}</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content parallax class="ion-no-padding">
  <div class="settings-content">
    @for (categoryKey of categoriesOrder; track categoryKey) {
      @if (objectKeys(settingsCache).includes(categoryKey)) {
        <ion-list>
          <!-- <ion-item-divider>
          <h2>
            {{
            'categories[0]'
            | thingTranslate
            : $any(
            settingsCache[categoryKey]?.settings[
            objectKeys(settingsCache[categoryKey]?.settings)[0]
            ]
            )
            | titlecase
            }}
          </h2>
        </ion-item-divider> -->
          @for (settingKeys of objectKeys(settingsCache[categoryKey].settings); track settingKeys) {
            <stapps-settings-item
              [setting]="settingsCache[categoryKey].settings[settingKeys]"
            ></stapps-settings-item>
          }
        </ion-list>
      }
    }

    <calendar-sync-settings></calendar-sync-settings>

    <ion-button expand="block" (click)="presentResetAlert()" fill="outline">
      {{ 'settings.resetSettings' | translate }}
      <ion-icon slot="start" name="device_reset"></ion-icon>
    </ion-button>
  </div>
</ion-content>
