Skip to content

Commit 00024e7

Browse files
committed
Add initial unfinished repeat item to sidebar
Signed-off-by: Sunik <[email protected]>
1 parent f369596 commit 00024e7

File tree

4 files changed

+101
-0
lines changed

4 files changed

+101
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<!--
2+
Nextcloud - Tasks
3+
4+
@author Sunik Kupfer
5+
@copyright 2023 Sunik Kupfer <[email protected]>
6+
7+
This library is free software; you can redistribute it and/or
8+
modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
9+
License as published by the Free Software Foundation; either
10+
version 3 of the License, or any later version.
11+
12+
This library is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU AFFERO GENERAL PUBLIC LICENSE for more details.
16+
17+
You should have received a copy of the GNU Affero General Public
18+
License along with this library. If not, see <http://www.gnu.org/licenses/>.
19+
20+
-->
21+
22+
<template>
23+
<div class="property__item">
24+
<div class="repeat__icon">
25+
<component :is="icon" :size="20" />
26+
</div>
27+
{{ recurrence }}
28+
</div>
29+
</template>
30+
31+
<script>
32+
33+
import { translate as t } from '@nextcloud/l10n'
34+
35+
export default {
36+
components: {
37+
},
38+
props: {
39+
recurrence: {
40+
type: String,
41+
default: null,
42+
},
43+
disabled: {
44+
type: Boolean,
45+
default: false,
46+
},
47+
placeholder: {
48+
type: String,
49+
default: '',
50+
},
51+
icon: {
52+
type: String,
53+
default: null,
54+
},
55+
},
56+
methods: {
57+
t,
58+
},
59+
}
60+
</script>
61+
62+
<style lang="scss" scoped>
63+
.property__item {
64+
display: flex;
65+
border-bottom: 1px solid var(--color-border);
66+
width: 100%;
67+
color: var(--color-text-lighter);
68+
69+
.repeat__icon {
70+
display: flex;
71+
height: 44px;
72+
width: 44px;
73+
justify-content: center;
74+
flex-basis: 44px;
75+
flex-shrink: 0;
76+
}
77+
}
78+
</style>

src/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import Eye from 'vue-material-design-icons/Eye.vue'
3636
import EyeOff from 'vue-material-design-icons/EyeOff.vue'
3737
import Pulse from 'vue-material-design-icons/Pulse.vue'
3838
import Tag from 'vue-material-design-icons/Tag.vue'
39+
import Repeat from 'vue-material-design-icons/Repeat.vue'
3940
import TrendingUp from 'vue-material-design-icons/TrendingUp.vue'
4041

4142
import Vue from 'vue'
@@ -82,6 +83,8 @@ Vue.component('IconPulse', Pulse)
8283
// eslint-disable-next-line vue/match-component-file-name
8384
Vue.component('IconTag', Tag)
8485
// eslint-disable-next-line vue/match-component-file-name
86+
Vue.component('IconRepeat', Repeat)
87+
// eslint-disable-next-line vue/match-component-file-name
8588
Vue.component('IconTrendingUp', TrendingUp)
8689

8790
if (!OCA.Tasks) {

src/models/task.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,22 @@ export default class Task {
330330
return this._completedDateMoment.clone()
331331
}
332332

333+
/**
334+
* Return the recurrence
335+
*
336+
* @readonly
337+
* @memberof Task
338+
*/
333339
get recurrence() {
334340
return this._recurrence
335341
}
336342

343+
/**
344+
* Whether this task repeats
345+
*
346+
* @readonly
347+
* @memberof Task
348+
*/
337349
get recurring() {
338350
if (this._start === null || this._recurrence === null) {
339351
return false

src/views/AppSidebar.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
192192
icon="IconTag"
193193
@add-tag="updateTag"
194194
@set-tags="updateTags" />
195+
<RepeatItem v-show="!readOnly || task.recurring"
196+
:recurrence="task.recurrence == null ? null : task.recurrence.toString()"
197+
:disabled="readOnly"
198+
:placeholder="t('tasks', 'No recurrence')"
199+
icon="IconRepeat" />
195200
</div>
196201
</NcAppSidebarTab>
197202
<NcEmptyContent v-else :description="taskStatusLabel">
@@ -240,6 +245,7 @@ import CalendarPickerItem from '../components/AppSidebar/CalendarPickerItem.vue'
240245
import MultiselectItem from '../components/AppSidebar/MultiselectItem.vue'
241246
import SliderItem from '../components/AppSidebar/SliderItem.vue'
242247
import TagsItem from '../components/AppSidebar/TagsItem.vue'
248+
import RepeatItem from '../components/AppSidebar/RepeatItem.vue'
243249
import NotesItem from '../components/AppSidebar/NotesItem.vue'
244250
import TaskCheckbox from '../components/TaskCheckbox.vue'
245251
// import TaskStatusDisplay from '../components/TaskStatusDisplay'
@@ -300,6 +306,7 @@ export default {
300306
MultiselectItem,
301307
SliderItem,
302308
TagsItem,
309+
RepeatItem,
303310
CalendarPickerItem,
304311
NotesItem,
305312
TaskCheckbox,
@@ -720,6 +727,7 @@ export default {
720727
calendar: 'getCalendarByRoute',
721728
calendars: 'getSortedCalendars',
722729
tags: 'tags',
730+
recurrence: 'recurrence',
723731
showTaskInCalendar: 'showTaskInCalendar',
724732
calendarView: 'calendarView',
725733
}),

0 commit comments

Comments
 (0)