Skip to content

Commit 6c4a7c3

Browse files
committed
refactor(dav): migrate ExampleContentDownloadButton to Typescript and script-setup
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent 1e657e7 commit 6c4a7c3

File tree

2 files changed

+47
-57
lines changed

2 files changed

+47
-57
lines changed

apps/dav/src/components/AvailabilityForm.vue

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,46 +2,11 @@
22
- SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
5-
<template>
6-
<div>
7-
<CalendarAvailability
8-
:slots.sync="slots"
9-
:loading="loading"
10-
:l10n-to="t('dav', 'to')"
11-
:l10n-delete-slot="t('dav', 'Delete slot')"
12-
:l10n-empty-day="t('dav', 'No working hours set')"
13-
:l10n-add-slot="t('dav', 'Add slot')"
14-
:l10n-week-day-list-label="t('dav', 'Weekdays')"
15-
:l10n-monday="t('dav', 'Monday')"
16-
:l10n-tuesday="t('dav', 'Tuesday')"
17-
:l10n-wednesday="t('dav', 'Wednesday')"
18-
:l10n-thursday="t('dav', 'Thursday')"
19-
:l10n-friday="t('dav', 'Friday')"
20-
:l10n-saturday="t('dav', 'Saturday')"
21-
:l10n-sunday="t('dav', 'Sunday')"
22-
:l10n-start-picker-label="(dayName) => t('dav', 'Pick a start time for {dayName}', { dayName })"
23-
:l10n-end-picker-label="(dayName) => t('dav', 'Pick a end time for {dayName}', { dayName })" />
24-
25-
<NcCheckboxRadioSwitch v-model="automated">
26-
{{ t('dav', 'Automatically set user status to "Do not disturb" outside of availability to mute all notifications.') }}
27-
</NcCheckboxRadioSwitch>
28-
29-
<NcButton
30-
:disabled="loading || saving"
31-
variant="primary"
32-
@click="save">
33-
{{ t('dav', 'Save') }}
34-
</NcButton>
35-
</div>
36-
</template>
375

386
<script setup lang="ts">
397
import { CalendarAvailability } from '@nextcloud/calendar-availability-vue'
408
import { getCapabilities } from '@nextcloud/capabilities'
41-
import {
42-
showError,
43-
showSuccess,
44-
} from '@nextcloud/dialogs'
9+
import { showError, showSuccess } from '@nextcloud/dialogs'
4510
import { loadState } from '@nextcloud/initial-state'
4611
import { t } from '@nextcloud/l10n'
4712
import { onMounted, ref } from 'vue'
@@ -106,6 +71,39 @@ async function save() {
10671
}
10772
</script>
10873

74+
<template>
75+
<div>
76+
<CalendarAvailability
77+
v-model:slots="slots"
78+
:loading="loading"
79+
:l10n-to="t('dav', 'to')"
80+
:l10n-delete-slot="t('dav', 'Delete slot')"
81+
:l10n-empty-day="t('dav', 'No working hours set')"
82+
:l10n-add-slot="t('dav', 'Add slot')"
83+
:l10n-week-day-list-label="t('dav', 'Weekdays')"
84+
:l10n-monday="t('dav', 'Monday')"
85+
:l10n-tuesday="t('dav', 'Tuesday')"
86+
:l10n-wednesday="t('dav', 'Wednesday')"
87+
:l10n-thursday="t('dav', 'Thursday')"
88+
:l10n-friday="t('dav', 'Friday')"
89+
:l10n-saturday="t('dav', 'Saturday')"
90+
:l10n-sunday="t('dav', 'Sunday')"
91+
:l10n-start-picker-label="(dayName) => t('dav', 'Pick a start time for {dayName}', { dayName })"
92+
:l10n-end-picker-label="(dayName) => t('dav', 'Pick a end time for {dayName}', { dayName })" />
93+
94+
<NcCheckboxRadioSwitch v-model="automated">
95+
{{ t('dav', 'Automatically set user status to "Do not disturb" outside of availability to mute all notifications.') }}
96+
</NcCheckboxRadioSwitch>
97+
98+
<NcButton
99+
:disabled="loading || saving"
100+
variant="primary"
101+
@click="save">
102+
{{ t('dav', 'Save') }}
103+
</NcButton>
104+
</div>
105+
</template>
106+
109107
<style lang="scss" scoped>
110108
:deep(.availability-day) {
111109
padding: 0 10px 0 10px;

apps/dav/src/components/ExampleContentDownloadButton.vue

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,20 @@
33
- SPDX-License-Identifier: AGPL-3.0-or-later
44
-->
55

6+
<script setup lang="ts">
7+
import { NcButton } from '@nextcloud/vue'
8+
import IconDownload from 'vue-material-design-icons/TrayArrowDown.vue'
9+
10+
defineProps<{
11+
/**
12+
* The href link for the download
13+
*/
14+
href: string
15+
}>()
16+
</script>
17+
618
<template>
7-
<NcButton variant="tertiary" :href="href">
19+
<NcButton variant="tertiary" :href>
820
<template #icon>
921
<slot name="icon" />
1022
</template>
@@ -19,26 +31,6 @@
1931
</NcButton>
2032
</template>
2133

22-
<script>
23-
import { NcButton } from '@nextcloud/vue'
24-
import IconDownload from 'vue-material-design-icons/TrayArrowDown.vue'
25-
26-
export default {
27-
name: 'ExampleContentDownloadButton',
28-
components: {
29-
NcButton,
30-
IconDownload,
31-
},
32-
33-
props: {
34-
href: {
35-
type: String,
36-
required: true,
37-
},
38-
},
39-
}
40-
</script>
41-
4234
<style lang="scss" scoped>
4335
.download-button {
4436
display: flex;

0 commit comments

Comments
 (0)