diff --git a/apps/theming/REUSE.toml b/apps/theming/REUSE.toml index c05da082002..f0d04e87a16 100644 --- a/apps/theming/REUSE.toml +++ b/apps/theming/REUSE.toml @@ -16,7 +16,7 @@ SPDX-FileCopyrightText = "2012-2019 Abbie Gonzalez getEnabledThemes(); + $enabledThemeIds = $this->getEnabledThemes(); // If already enabled, ignore - if (in_array($theme->getId(), $themesIds)) { - return $themesIds; + if (in_array($theme->getId(), $enabledThemeIds)) { + return $enabledThemeIds; } - /** @var ITheme[] */ - $themes = array_filter(array_map(function ($themeId) { - return $this->getThemes()[$themeId]; - }, $themesIds)); + // for other types then supplementary themes we need to filter out themes with the same type + if ($theme->getType() !== ITheme::TYPE_SUPPLEMENTARY) { + $allThemes = $this->getThemes(); + $enabledThemeIds = array_filter($enabledThemeIds, fn (string $themeId) => $allThemes[$themeId]->gettype() !== $theme->gettype()); + } - // Filtering all themes with the same type - $filteredThemes = array_filter($themes, function (ITheme $t) use ($theme) { - return $theme->getType() === $t->getType(); - }); - - // Retrieve IDs only - /** @var string[] */ - $filteredThemesIds = array_map(function (ITheme $t) { - return $t->getId(); - }, array_values($filteredThemes)); - - $enabledThemes = array_merge(array_diff($themesIds, $filteredThemesIds), [$theme->getId()]); - $this->setEnabledThemes($enabledThemes); - - return $enabledThemes; + $enabledThemeIds[] = $theme->getId(); + $this->setEnabledThemes($enabledThemeIds); + return array_values($enabledThemeIds); } /** @@ -127,7 +116,7 @@ class ThemesService { // If enabled, removing it if (in_array($theme->getId(), $themesIds)) { - $enabledThemes = array_diff($themesIds, [$theme->getId()]); + $enabledThemes = array_values(array_diff($themesIds, [$theme->getId()])); $this->setEnabledThemes($enabledThemes); return $enabledThemes; } diff --git a/apps/theming/lib/Themes/ReducedMotion.php b/apps/theming/lib/Themes/ReducedMotion.php index c6e29d8e604..2af78f3f378 100644 --- a/apps/theming/lib/Themes/ReducedMotion.php +++ b/apps/theming/lib/Themes/ReducedMotion.php @@ -17,13 +17,11 @@ class ReducedMotion implements ITheme { ) { } - public function getCustomCss(): string - { + public function getCustomCss(): string { return ''; } - public function getMeta(): array - { + public function getMeta(): array { return []; } @@ -32,7 +30,7 @@ class ReducedMotion implements ITheme { } public function getType(): int { - return ITheme::TYPE_FONT; + return ITheme::TYPE_SUPPLEMENTARY; } public function getTitle(): string { diff --git a/apps/theming/src/UserTheming.vue b/apps/theming/src/UserTheming.vue index ff5908149bb..539a99eb378 100644 --- a/apps/theming/src/UserTheming.vue +++ b/apps/theming/src/UserTheming.vue @@ -13,28 +13,21 @@

-

- -
+ -
- -
+ + +

{{ t('theming', 'Misc accessibility options') }}

+ + + + + + diff --git a/apps/theming/src/components/ItemPreview.vue b/apps/theming/src/components/ThemeListItem.vue similarity index 66% rename from apps/theming/src/components/ItemPreview.vue rename to apps/theming/src/components/ThemeListItem.vue index 5226ddb1609..2fb76f7a2ad 100644 --- a/apps/theming/src/components/ItemPreview.vue +++ b/apps/theming/src/components/ThemeListItem.vue @@ -3,8 +3,12 @@ - SPDX-License-Identifier: AGPL-3.0-or-later -->