Skip to content

Commit 4ae567e

Browse files
committed
fixup! Implement frontend for iMIP data
1 parent d243512 commit 4ae567e

2 files changed

Lines changed: 38 additions & 31 deletions

File tree

src/components/Imip.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@
4343

4444
<EventData :event="parsedEvent" />
4545

46+
<!-- TODO: actually implement buttons (https://github.com/nextcloud/mail/issues/6803) -->
47+
<!-- TODO: "More options" needs more specification -->
48+
<!--
4649
<div class="imip__actions">
47-
<!-- TODO: actually implement buttons (https://github.com/nextcloud/mail/issues/6803) -->
4850
<template v-if="isRequest && eventIsInFuture">
4951
<Button
5052
type="tertiary">
@@ -54,16 +56,16 @@
5456
{{ t('mail', 'Decline') }}
5557
</Button>
5658
</template>
57-
<!-- TODO: "More options" needs more specification -->
5859
<Actions :menu-title="t('mail', 'More options')" />
5960
</div>
61+
-->
6062
</div>
6163
</template>
6264

6365
<script>
6466
import EventData from './imip/EventData'
65-
import Button from '@nextcloud/vue/dist/Components/Button'
66-
import Actions from '@nextcloud/vue/dist/Components/Actions'
67+
// import Button from '@nextcloud/vue/dist/Components/Button'
68+
// import Actions from '@nextcloud/vue/dist/Components/Actions'
6769
import CloseIcon from 'vue-material-design-icons/Close'
6870
import CalendarIcon from 'vue-material-design-icons/Calendar'
6971
import { getParserManager } from '@nextcloud/calendar-js'
@@ -76,8 +78,8 @@ export default {
7678
name: 'Imip',
7779
components: {
7880
EventData,
79-
Button,
80-
Actions,
81+
// Button,
82+
// Actions,
8183
CloseIcon,
8284
CalendarIcon,
8385
},

src/components/imip/EventData.vue

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
<CalendarIcon class="event-data__row__icon" :size="20" />
2929
<div>
3030
{{ startDate }}
31-
<span v-if="timezone.start && timezone.start !== timezone.end" class="muted">
32-
{{ timezone.start }}
31+
<span v-if="startTimezone && startTimezone !== endTimezone" class="muted">
32+
{{ startTimezone }}
3333
</span>
3434
<template v-if="endDate">
3535
<span> - </span>
3636
{{ endDate }}
37-
<span v-if="timezone.end" class="muted">{{ timezone.end }}</span>
37+
<span v-if="endTimezone" class="muted">{{ endTimezone }}</span>
3838
</template>
3939
</div>
4040
</div>
@@ -51,7 +51,7 @@
5151
<ul>
5252
<li v-for="{ name, isOrganizer } in attendees" :key="name">
5353
{{ name }}
54-
<span v-if="isOrganizer" class="muted">(organizer)</span>
54+
<span v-if="isOrganizer" class="muted">{{ t('mail', '(organizer)') }}</span>
5555
</li>
5656
</ul>
5757
</div>
@@ -62,7 +62,7 @@
6262
import AccountMultipleIcon from 'vue-material-design-icons/AccountMultiple'
6363
import CalendarIcon from 'vue-material-design-icons/Calendar'
6464
import MapMarkerIcon from 'vue-material-design-icons/MapMarker'
65-
import { AttendeeProperty, getReadableTimezoneName } from '@nextcloud/calendar-js'
65+
import { getReadableTimezoneName } from '@nextcloud/calendar-js'
6666
import moment from '@nextcloud/moment'
6767
import { removeMailtoPrefix } from '../../util/eventAttendee'
6868
@@ -79,6 +79,22 @@ function isSameDay(a, b) {
7979
&& a.getDate() === b.getDate()
8080
}
8181
82+
/**
83+
* Get a human readable timezone name from a DateTimeValue.
84+
* If timezone is floating, undefined will be returned.
85+
*
86+
* @param {DateTimeValue} date Date
87+
* @returns {string|undefined} Human readable timezone name or undefined
88+
*/
89+
function getTimezoneFromDate(date) {
90+
const timezoneId = date.timezoneId
91+
if (!timezoneId || timezoneId === 'floating') {
92+
return undefined
93+
}
94+
95+
return getReadableTimezoneName(timezoneId)
96+
}
97+
8298
export default {
8399
name: 'EventData',
84100
components: {
@@ -94,7 +110,6 @@ export default {
94110
},
95111
computed: {
96112
/**
97-
*
98113
* @returns {string}
99114
*/
100115
title() {
@@ -103,7 +118,6 @@ export default {
103118
},
104119
105120
/**
106-
*
107121
* @returns {string}
108122
*/
109123
startDate() {
@@ -115,7 +129,6 @@ export default {
115129
},
116130
117131
/**
118-
*
119132
* @returns {string|undefined}
120133
*/
121134
endDate() {
@@ -142,35 +155,27 @@ export default {
142155
},
143156
144157
/**
145-
*
146-
* @returns {{start: (string|undefined), end: (string|undefined)}}
158+
* @returns {string|undefined}
147159
*/
148-
timezone() {
149-
const getTimezone = (date) => {
150-
const timezoneId = date.timezoneId
151-
if (!timezoneId || timezoneId === 'floating') {
152-
return undefined
153-
}
154-
155-
return getReadableTimezoneName(timezoneId)
156-
}
160+
startTimezone() {
161+
return getTimezoneFromDate(this.event.startDate)
162+
},
157163
158-
return {
159-
start: getTimezone(this.event.startDate),
160-
end: getTimezone(this.event.endDate),
161-
}
164+
/**
165+
* @returns {string|undefined}
166+
*/
167+
endTimezone() {
168+
return getTimezoneFromDate(this.event.endDate)
162169
},
163170
164171
/**
165-
*
166172
* @returns {string|undefined|null}
167173
*/
168174
location() {
169175
return this.event.location
170176
},
171177
172178
/**
173-
*
174179
* @returns {{name: string, isOrganizer: boolean}[]}
175180
*/
176181
attendees() {

0 commit comments

Comments
 (0)