Skip to content

Commit ea9bb78

Browse files
Merge pull request #7875 from odzhychko/show-supported-component-types-in-calendar-settings
feat: show supported component types in calendar settings
2 parents 9aa4b5f + 99e54cf commit ea9bb78

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

src/components/AppNavigation/EditCalendarModal.vue

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
<div class="edit-calendar-modal">
99
<h3 class="edit-calendar-modal__header">
1010
{{ $t('calendar', 'Edit calendar') }}
11+
<span class="edit-calendar-modal__header_subtitle">
12+
{{ description }}
13+
</span>
1114
</h3>
1215

1316
<div class="edit-calendar-modal__name-and-color">
@@ -83,6 +86,7 @@
8386

8487
<script>
8588
import { showError } from '@nextcloud/dialogs'
89+
import { getLanguage } from '@nextcloud/l10n'
8690
import { NcAppNavigationSpacer, NcButton, NcCheckboxRadioSwitch, NcColorPicker, NcModal } from '@nextcloud/vue'
8791
import { mapStores } from 'pinia'
8892
import CheckIcon from 'vue-material-design-icons/Check.vue'
@@ -167,6 +171,39 @@ export default {
167171
downloadUrl() {
168172
return this.calendar.url + '?export'
169173
},
174+
175+
/**
176+
* Description about supported component types.
177+
*
178+
* @return {string}
179+
*/
180+
description() {
181+
const supportedTypes = []
182+
if (this.calendar.supportsEvents) {
183+
supportedTypes.push(this.$t('calendar', 'events'))
184+
}
185+
if (this.calendar.supportsTasks) {
186+
supportedTypes.push(this.$t('calendar', 'tasks'))
187+
}
188+
if (this.calendar.supportsJournals) {
189+
// TRANSLATORS "notes" would be more user-friendly. "journal entries" (from RFC 5545) was used to avoid confusion with notes from the Notes app.
190+
supportedTypes.push(this.$t('calendar', 'journal entries'))
191+
}
192+
193+
if (supportedTypes.lenght === 0) {
194+
return this.$t('calendar', 'This calendar supports neither events, tasks nor journal entries.')
195+
}
196+
197+
const formatter = new Intl.ListFormat(getLanguage(), { type: 'conjunction' })
198+
const localizedTypes = formatter.format(supportedTypes)
199+
return this.$n(
200+
'calendar',
201+
'This calendar supports only {types}.',
202+
'This calendar supports {types}.',
203+
supportedTypes.length,
204+
{ types: localizedTypes },
205+
)
206+
},
170207
},
171208
172209
watch: {
@@ -295,6 +332,13 @@ export default {
295332
font-size: 21px;
296333
}
297334
335+
&__header_subtitle {
336+
display: block;
337+
color: var(--color-text-maxcontrast);
338+
font-size: 1rem;
339+
font-weight: normal;
340+
}
341+
298342
&__name-and-color {
299343
display: flex;
300344
align-items: center;

0 commit comments

Comments
 (0)