Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions src/components/Editor/Invitees/AttendeeDetails.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
<!--
- SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
- SPDX-License-Identifier: AGPL-3.0-or-later
-->

<template>
<div class="attendee-details" :class="{ 'attendee-details--compact': hasMembers }">
<div class="attendee-details__name">
<slot name="displayname">
{{ displayName }}
</slot>
</div>
<span v-if="email && !hasMembers" :title="email" class="attendee-details__button-wrapper">
<NcButton
class="attendee-details__button"
variant="tertiary-no-background"
:aria-label="$t('calendar', 'Copy name and email address')"
@click="handleCopy">
<template #icon>
<ContentCopy :size="16" />
</template>
</NcButton>
</span>
</div>
</template>

<script>
import { showError, showSuccess } from '@nextcloud/dialogs'
import { NcButton } from '@nextcloud/vue'
import ContentCopy from 'vue-material-design-icons/ContentCopy.vue'

export default {
name: 'AttendeeDetails',
components: {
NcButton,
ContentCopy,
},

props: {
displayName: {
type: String,
required: true,
},

email: {
type: String,
required: true,
},

hasMembers: {
type: Boolean,
default: false,
},
},

methods: {
async handleCopy() {
try {
const text = `${this.displayName} <${this.email}>`
await navigator.clipboard.writeText(text)
showSuccess(this.$t('calendar', 'Copied to clipboard'))
} catch (e) {
showError(this.$t('calendar', 'Failed to copy'))
}
},
},
}
</script>

<style lang="scss" scoped>
.attendee-details {
display: flex;
align-items: center;
gap: 4px;
overflow: hidden;
margin-bottom: 17px;
margin-inline-start: calc(var(--default-grid-baseline) * 2);

&--compact {
margin-bottom: 0px;
}

&__name {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}

&__button-wrapper {
flex-shrink: 0;
display: flex;
}

&__button {
flex-shrink: 0;
}
}
</style>
47 changes: 26 additions & 21 deletions src/components/Editor/Invitees/InviteesListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,21 @@
:common-name="commonName"
:timezone="timezone"
:is-group="isGroup" />
<div
class="invitees-list-item__displayname"
:class="{ 'invitees-list-item__groupname': members.length }">
{{ commonName }}
<span
v-if="members.length"
class="invitees-list-item__member-count">
({{ $n('calendar', '%n member', '%n members', members.length) }})
</span>
</div>

<AttendeeDetails
:display-name="commonName"
:email="attendeeEmail"
:has-members="!!members.length">
<template #displayname>
{{ commonName }}
<span
v-if="members.length"
class="invitees-list-item__member-count">
({{ $n('calendar', '%n member', '%n members', members.length) }})
</span>
</template>
</AttendeeDetails>

<div class="invitees-list-item__actions">
<NcButton
v-if="members.length"
Expand Down Expand Up @@ -116,6 +121,7 @@ import ChevronDown from 'vue-material-design-icons/ChevronDown.vue'
import ChevronUp from 'vue-material-design-icons/ChevronUp.vue'
import Delete from 'vue-material-design-icons/TrashCanOutline.vue'
import AvatarParticipationStatus from '../AvatarParticipationStatus.vue'
import AttendeeDetails from './AttendeeDetails.vue'
import { getAttendeeDetails } from '../../../services/attendeeDetails.js'
import useCalendarObjectInstanceStore from '../../../store/calendarObjectInstance.js'
import { removeMailtoPrefix } from '../../../utils/attendee.js'
Expand All @@ -132,6 +138,7 @@ export default {
NcButton,
ChevronDown,
ChevronUp,
AttendeeDetails,
},

props: {
Expand Down Expand Up @@ -207,6 +214,15 @@ export default {
return ''
},

/**
* Email address without the 'mailto:' prefix
*
* @return {string}
*/
attendeeEmail() {
return this.attendee.uri ? removeMailtoPrefix(this.attendee.uri) : ''
},

radioName() {
return this._uid + '-role-radio-input-group'
},
Expand Down Expand Up @@ -302,17 +318,6 @@ export default {
display: flex;
}

.invitees-list-item__displayname {
margin-bottom: 17px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}

.invitees-list-item__groupname {
margin-bottom: 0px;
}

.avatar-participation-status {
margin-top: 5px;
}
Expand Down
26 changes: 16 additions & 10 deletions src/components/Editor/Invitees/OrganizerListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
:organizer-display-name="commonName"
:schedule-status="organizer.attendeeProperty.getParameterFirstValue('SCHEDULE-STATUS')"
participation-status="ACCEPTED" />
<div class="invitees-list-item__displayname">
{{ commonName }}
</div>

<AttendeeDetails
:display-name="commonName"
:email="organizerEmail" />

<div class="invitees-list-item__organizer-hint">
{{ $t('calendar', '(organizer)') }}
</div>
Expand Down Expand Up @@ -54,11 +56,13 @@ import NcActionButton from '@nextcloud/vue/components/NcActionButton'
import NcActions from '@nextcloud/vue/components/NcActions'
import Crown from 'vue-material-design-icons/CrownOutline.vue'
import AvatarParticipationStatus from '../AvatarParticipationStatus.vue'
import AttendeeDetails from './AttendeeDetails.vue'
import { removeMailtoPrefix } from '../../../utils/attendee.js'

export default {
name: 'OrganizerListItem',
components: {
AttendeeDetails,
AvatarParticipationStatus,
Crown,
NcActions,
Expand Down Expand Up @@ -117,6 +121,15 @@ export default {
return ''
},

/**
* Email address without the 'mailto:' prefix
*
* @return {string}
*/
organizerEmail() {
return this.organizer.uri ? removeMailtoPrefix(this.organizer.uri) : ''
},

isResource() {
// The organizer does not have a tooltip
return false
Expand All @@ -139,13 +152,6 @@ export default {
</script>

<style lang="scss" scoped>
.invitees-list-item__displayname {
margin-bottom: 13px;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}

.invitees-list-item__organizer-hint {
margin-bottom: 14px;
}
Expand Down
Loading