|
| 1 | +<!-- |
| 2 | + - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors |
| 3 | + - SPDX-License-Identifier: AGPL-3.0-or-later |
| 4 | + --> |
| 5 | + |
| 6 | +<script setup lang="ts"> |
| 7 | +import { t } from '@nextcloud/l10n' |
| 8 | +import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' |
| 9 | +import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch.js' |
| 10 | +import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js' |
| 11 | +import IconThemeLightDark from 'vue-material-design-icons/ThemeLightDark.vue' |
| 12 | +import SettingsSubsection from './components/SettingsSubsection.vue' |
| 13 | +import SettingsSelect from './components/SettingsSelect.vue' |
| 14 | +import { useAppConfigValue } from './useAppConfigValue.ts' |
| 15 | +import { useNcSelectModel } from '../composables/useNcSelectModel.ts' |
| 16 | +import { useAppConfig } from './appConfig.store.ts' |
| 17 | +import { storeToRefs } from 'pinia' |
| 18 | + |
| 19 | +const { isRelaunchRequired } = storeToRefs(useAppConfig()) |
| 20 | + |
| 21 | +const theme = useAppConfigValue('theme') |
| 22 | +const themeOptions = [ |
| 23 | + { label: t('talk_desktop', 'System default'), value: 'default' } as const, |
| 24 | + { label: t('talk_desktop', 'Light'), value: 'light' } as const, |
| 25 | + { label: t('talk_desktop', 'Dark'), value: 'dark' } as const, |
| 26 | +] |
| 27 | +const themeOption = useNcSelectModel(theme, themeOptions) |
| 28 | + |
| 29 | +const systemTitleBar = useAppConfigValue('systemTitleBar') |
| 30 | + |
| 31 | +/** |
| 32 | + * Restart the app |
| 33 | + */ |
| 34 | +function relaunch() { |
| 35 | + window.TALK_DESKTOP.relaunchWindow() |
| 36 | +} |
| 37 | +</script> |
| 38 | + |
| 39 | +<template> |
| 40 | + <div> |
| 41 | + <NcNoteCard v-if="isRelaunchRequired" type="info" class="relaunch-require-note-card"> |
| 42 | + <div class="relaunch-require-note-card__content"> |
| 43 | + <span>{{ t('talk_desktop', 'Some changes require a relaunch to take effect') }}</span> |
| 44 | + <NcButton type="primary" |
| 45 | + size="small" |
| 46 | + class="relaunch-require-note-card__button" |
| 47 | + @click="relaunch"> |
| 48 | + {{ t('talk_desktop', 'Restart') }} |
| 49 | + </NcButton> |
| 50 | + </div> |
| 51 | + </NcNoteCard> |
| 52 | + |
| 53 | + <SettingsSubsection :name="t('talk_desktop', 'Appearance')"> |
| 54 | + <SettingsSelect v-model="themeOption" :options="themeOptions"> |
| 55 | + <template #icon> |
| 56 | + <IconThemeLightDark :size="20" /> |
| 57 | + </template> |
| 58 | + {{ t('talk_desktop', 'Theme') }} |
| 59 | + </SettingsSelect> |
| 60 | + |
| 61 | + <NcCheckboxRadioSwitch :checked.sync="systemTitleBar" type="switch"> |
| 62 | + {{ t('talk_desktop', 'Use system title bar') }} |
| 63 | + </NcCheckboxRadioSwitch> |
| 64 | + </SettingsSubsection> |
| 65 | + </div> |
| 66 | +</template> |
| 67 | + |
| 68 | +<style scoped> |
| 69 | +.relaunch-require-note-card { |
| 70 | + margin-block-start: 0 !important; |
| 71 | +} |
| 72 | + |
| 73 | +.relaunch-require-note-card > :deep(div) { |
| 74 | + flex: 1; /* TODO: fix in upstream */ |
| 75 | +} |
| 76 | + |
| 77 | +.relaunch-require-note-card__content { |
| 78 | + display: flex; |
| 79 | + gap: var(--default-grid-baseline); |
| 80 | + align-items: flex-start; |
| 81 | +} |
| 82 | + |
| 83 | +.relaunch-require-note-card__button { |
| 84 | + margin-inline-start: auto; |
| 85 | + flex: 0 0 auto; |
| 86 | +} |
| 87 | +</style> |
0 commit comments