Skip to content

Commit

Permalink
implement AvatarParticipationStatus component
Browse files Browse the repository at this point in the history
Signed-off-by: Georg Ehrke <[email protected]>
  • Loading branch information
georgehrke committed Oct 19, 2019
1 parent 8b90b4d commit c6e6339
Show file tree
Hide file tree
Showing 4 changed files with 150 additions and 2 deletions.
1 change: 1 addition & 0 deletions css/icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
@include icon-black-white('color-picker', 'calendar', 1);
@include icon-black-white('embed', 'calendar', 1);
@include icon-black-white('eye', 'calendar', 3);
@include icon-black-white('invitees-no-response', 'calendar', 5);
@include icon-black-white('leftarrow', 'calendar', 1);
@include icon-black-white('random', 'calendar', 1);
@include icon-black-white('reminder', 'calendar', 1);
Expand Down
5 changes: 5 additions & 0 deletions img/LICENSES.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
- License: CC-BY
- Link: https://thenounproject.com/search/?q=eye&i=428971

# invitees-no-response.svg
- Created by: [Alena](https://thenounproject.com/joyeyes)
- License: CC-BY
- Link: https://thenounproject.com/search/?q=question%20mark&i=1156193

## repeat.svg
- Created by: [Brandy Bora](https://thenounproject.com/brandy.bora/)
- License: CC-BY
Expand Down
1 change: 1 addition & 0 deletions img/invitees-no-response.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
145 changes: 143 additions & 2 deletions src/components/Editor/Invitees/AvatarParticipationStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,156 @@
-->

<template>
<div />
<div v-tooltip="tooltip" class="avatar-participation-status-wrapper">
<Avatar
:disable-menu="true"
:disable-tooltip="true"
:user="avatarLink"
/>
<div class="participation-status" :class="className" />
</div>
</template>

<script>
import {
Avatar
} from 'nextcloud-vue'

export default {
name: 'AvatarParticipationStatus'
name: 'AvatarParticipationStatus',
components: {
Avatar
},
props: {
avatarLink: {
type: String,
required: true
},
participationStatus: {
type: String,
required: true
},
commonName: {
type: String,
required: true
},
isViewedByOrganizer: {
type: Boolean,
required: true
},
attendeeIsOrganizer: {
type: Boolean,
required: true
},
organizerDisplayName: {
type: String,
required: true
}
},
computed: {
tooltip() {
if (this.isViewedByOrganizer && this.attendeeIsOrganizer) {
return null
}

if (this.participationStatus === 'ACCEPTED' && this.isViewedByOrganizer) {
return t('calendar', '{name} accepted your invitation.', {
name: this.commonName
})
}
if (this.participationStatus === 'ACCEPTED' && !this.isViewedByOrganizer) {
return t('calendar', '{name} accepted {organizerName}\'s invitation.', {
name: this.commonName,
organizerName: this.organizerDisplayName
})
}

if (this.participationStatus === 'DECLINED' && this.isViewedByOrganizer) {
return t('calendar', '{name} declined your invitation.', {
name: this.commonName
})
}
if (this.participationStatus === 'DECLINED' && !this.isViewedByOrganizer) {
return t('calendar', '{name} declined {organizerName}\'s invitation.', {
name: this.commonName,
organizerName: this.organizerDisplayName
})
}

if (this.participationStatus === 'DELEGATED') {
return t('calendar', '{name} has delegated their invitation.', {
name: this.commonName
})
}
if (this.participationStatus === 'TENTATIVE') {
return t('calendar', '{name} marked their participation as tentative.', {
name: this.commonName
})
}

if (this.isViewedByOrganizer) {
return t('calendar', '{name} did not respond to your invitation yet.', {
name: this.commonName
})
} else {
return t('calendar', '{name} did not respond to {organizerName}\'s invitation yet.', {
name: this.commonName,
organizerName: this.organizerDisplayName
})
}
},
className() {
if (this.participationStatus === 'ACCEPTED') {
return ['accepted', 'icon', 'icon-checkmark-white']
}
if (this.participationStatus === 'DECLINED') {
return ['declined', 'icon', 'icon-close-white']
}
if (this.participationStatus === 'TENTATIVE') {
return ['tentative', 'icon', 'icon-checkmark-white']
}
if (this.participationStatus === 'DELEGATED') {
return ['delegated', 'icon', 'icon-confirm-white']
}

return ['no-response', 'icon', 'icon-invitees-no-response-white']
}
}
}
</script>

<style scoped>
.avatar-participation-status-wrapper {
position: relative;
height: 38px;
width: 38px;
}

.participation-status {
position: absolute;
bottom: 0;
right: 0;
background-size: 10px;
height: 15px;
width: 15px;
box-shadow: 0 0 3px grey;
border-radius: 50%;
}

.participation-status.accepted {
background-color: #2fb130;
}

.participation-status.declined {
background-color: #ff0000;
}

.participation-status.tentative {
background-color: #ffa704;
}

.participation-status.delegated,
.participation-status.no-response {
background-color: grey;
}
</style>

0 comments on commit c6e6339

Please sign in to comment.