Skip to content

Commit

Permalink
starred group
Browse files Browse the repository at this point in the history
  • Loading branch information
Avinash Gusain committed Jun 21, 2023
1 parent 33060a4 commit 070ebab
Show file tree
Hide file tree
Showing 17 changed files with 345 additions and 25 deletions.
3 changes: 2 additions & 1 deletion l10n/de.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ OC.L10N.register(
"An error has occurred in circle(s). Check the console for more details." : "Es ist ein Fehler in Kreis(en) ist aufgetreten. Weitere Informationen findest du in der Konsole.",
"Unable to create circle {circleName}" : "Kreis {circleName} konnte nicht erstellt werden",
"Unable to delete circle {circleId}" : "Kontakt konnte nicht gelöscht werden",
"Unable to delete contact" : "Kontakt konnte nicht gelöscht werden"
"Unable to delete contact" : "Kontakt konnte nicht gelöscht werden",
"Favorites" : "Favoriten"
},
"nplurals=2; plural=(n != 1);");
3 changes: 2 additions & 1 deletion l10n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,7 @@
"An error has occurred in circle(s). Check the console for more details." : "Es ist ein Fehler in Kreis(en) ist aufgetreten. Weitere Informationen findest du in der Konsole.",
"Unable to create circle {circleName}" : "Kreis {circleName} konnte nicht erstellt werden",
"Unable to delete circle {circleId}" : "Kontakt konnte nicht gelöscht werden",
"Unable to delete contact" : "Kontakt konnte nicht gelöscht werden"
"Unable to delete contact" : "Kontakt konnte nicht gelöscht werden",
"Favorites" : "Favoriten"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
3 changes: 2 additions & 1 deletion l10n/de_DE.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ OC.L10N.register(
"An error has occurred in circle(s). Check the console for more details." : "In Kreis(en) ist ein Fehler aufgetreten. Weitere Informationen finden Sie in der Konsole.",
"Unable to create circle {circleName}" : "Fehler beim Erstellen des Kreises {circleName}",
"Unable to delete circle {circleId}" : "Fehler beim Löschen des Kreises {circleId}",
"Unable to delete contact" : "Kontakt konnte nicht gelöscht werden"
"Unable to delete contact" : "Kontakt konnte nicht gelöscht werden",
"Favorites" : "Favoriten"
},
"nplurals=2; plural=(n != 1);");
3 changes: 2 additions & 1 deletion l10n/de_DE.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@
"An error has occurred in circle(s). Check the console for more details." : "In Kreis(en) ist ein Fehler aufgetreten. Weitere Informationen finden Sie in der Konsole.",
"Unable to create circle {circleName}" : "Fehler beim Erstellen des Kreises {circleName}",
"Unable to delete circle {circleId}" : "Fehler beim Löschen des Kreises {circleId}",
"Unable to delete contact" : "Kontakt konnte nicht gelöscht werden"
"Unable to delete contact" : "Kontakt konnte nicht gelöscht werden",
"Favorites" : "Favoriten"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
3 changes: 2 additions & 1 deletion l10n/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ OC.L10N.register(
"An error has occurred in circle(s). Check the console for more details." : "Ha ocurrido un error en uno o varios circles. Chequee la consola para más detalles.",
"Unable to create circle {circleName}" : "No se pudo crear el círculo {circleName}",
"Unable to delete circle {circleId}" : "No se pudo eliminar el círculo {circleId}",
"Unable to delete contact" : "No se ha podido eliminar el contacto"
"Unable to delete contact" : "No se ha podido eliminar el contacto",
"Favorites" : "Favoritos"
},
"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;");
3 changes: 2 additions & 1 deletion l10n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@
"An error has occurred in circle(s). Check the console for more details." : "Ha ocurrido un error en uno o varios circles. Chequee la consola para más detalles.",
"Unable to create circle {circleName}" : "No se pudo crear el círculo {circleName}",
"Unable to delete circle {circleId}" : "No se pudo eliminar el círculo {circleId}",
"Unable to delete contact" : "No se ha podido eliminar el contacto"
"Unable to delete contact" : "No se ha podido eliminar el contacto",
"Favorites" : "Favoritos"
},"pluralForm" :"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"
}
3 changes: 2 additions & 1 deletion l10n/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ OC.L10N.register(
"An error has occurred in circle(s). Check the console for more details." : "Une erreur est survenue dans le·s cercle·s. Vérifiez la console pour plus de détails.",
"Unable to create circle {circleName}" : "Impossible de créer le cercle {circleName}",
"Unable to delete circle {circleId}" : "Impossible de supprimer le cercle {circleId}",
"Unable to delete contact" : "Impossible de supprimer le contact."
"Unable to delete contact" : "Impossible de supprimer le contact.",
"Favorites" : "Favoris"
},
"nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;");
3 changes: 2 additions & 1 deletion l10n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@
"An error has occurred in circle(s). Check the console for more details." : "Une erreur est survenue dans le·s cercle·s. Vérifiez la console pour plus de détails.",
"Unable to create circle {circleName}" : "Impossible de créer le cercle {circleName}",
"Unable to delete circle {circleId}" : "Impossible de supprimer le cercle {circleId}",
"Unable to delete contact" : "Impossible de supprimer le contact."
"Unable to delete contact" : "Impossible de supprimer le contact.",
"Favorites" : "Favoris"
},"pluralForm" :"nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"
}
3 changes: 2 additions & 1 deletion l10n/it.js
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ OC.L10N.register(
"_{failed} contact failed to be read_::_{failed} contacts failed to be read_" : ["lettura di {failed} contatto non riuscita","lettura di {failed} contatti non riuscita","lettura di {failed} contatti non riuscita"],
"Unable to create circle {circleName}" : "Impossibile creare la cerchia {circleName}",
"Unable to delete circle {circleId}" : "Impossibile eliminare la cerchia {circleId}",
"Unable to delete contact" : "Impossibile eliminare il contatto"
"Unable to delete contact" : "Impossibile eliminare il contatto",
"Favorites" : "Preferiti"
},
"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;");
3 changes: 2 additions & 1 deletion l10n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@
"_{failed} contact failed to be read_::_{failed} contacts failed to be read_" : ["lettura di {failed} contatto non riuscita","lettura di {failed} contatti non riuscita","lettura di {failed} contatti non riuscita"],
"Unable to create circle {circleName}" : "Impossibile creare la cerchia {circleName}",
"Unable to delete circle {circleId}" : "Impossibile eliminare la cerchia {circleId}",
"Unable to delete contact" : "Impossibile eliminare il contatto"
"Unable to delete contact" : "Impossibile eliminare il contatto",
"Favorites" : "Preferiti"
},"pluralForm" :"nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;"
}
14 changes: 12 additions & 2 deletions src/components/AppNavigation/GroupNavigationItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
<template>
<AppNavigationItem :key="group.key"
:to="group.router"
:title="group.name">
:title="getTitle(group)">
<template #icon>
<IconContact :size="20" />
<IconStar v-if="group.name ==='starred'" :size="20" />
<IconContact v-else :size="20" />
</template>
<template slot="actions">
<ActionButton :close-after-click="true"
Expand Down Expand Up @@ -77,6 +78,7 @@ import IconContact from 'vue-material-design-icons/AccountMultiple.vue'
import IconAdd from 'vue-material-design-icons/Plus.vue'
import IconDownload from 'vue-material-design-icons/Download.vue'
import IconEmail from 'vue-material-design-icons/Email.vue'
import IconStar from 'vue-material-design-icons/Star.vue'

export default {
name: 'GroupNavigationItem',
Expand All @@ -89,6 +91,7 @@ export default {
IconAdd,
IconDownload,
IconEmail,
IconStar,
},

props: {
Expand Down Expand Up @@ -180,6 +183,13 @@ export default {
// have to explicitly set the "to:" or "bcc:" header.
window.location.href = `mailto:?${mode}=${emails.map(encodeURIComponent).join(',')}`
},
getTitle(group) {
if (group.name === 'starred') {
return t('contacts', 'Favorites')
} else {
return group.name
}
},

},
}
Expand Down
19 changes: 15 additions & 4 deletions src/components/ContactDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@

<template v-else>
<!-- contact header -->
<DetailsHeader>
<DetailsHeader :contact="contact"
@group-updated="updatedValue">
<!-- avatar and upload photo -->
<ContactAvatar slot="avatar"
:contact="contact"
@update-local-contact="updateLocalContact" />
<ContactDetailsStarred slot="starred"
:contact="contact"
:is-read-only="isReadOnly"
:reload-bus="reloadBus"
@update-local-contact="updateLocalContact" />

<!-- fullname -->
<template #title>
<div v-if="isReadOnly">
Expand Down Expand Up @@ -306,6 +309,7 @@ import validate from '../services/validate.js'
import AddNewProp from './ContactDetails/ContactDetailsAddNewProp.vue'
import ContactAvatar from './ContactDetails/ContactDetailsAvatar.vue'
import ContactDetailsProperty from './ContactDetails/ContactDetailsProperty.vue'
import ContactDetailsStarred from './ContactDetails/ContactDetailsStarred.vue'
import DetailsHeader from './DetailsHeader.vue'
import PropertyGroups from './Properties/PropertyGroups.vue'
import PropertyRev from './Properties/PropertyRev.vue'
Expand All @@ -321,6 +325,7 @@ export default {
AppContentDetails,
ContactAvatar,
ContactDetailsProperty,
ContactDetailsStarred,
DetailsHeader,
EmptyContent,
IconContact,
Expand Down Expand Up @@ -373,8 +378,8 @@ export default {
qrcode: '',
showPickAddressbookModal: false,
pickedAddressbook: null,
groupValue: '',
editMode: false,

contactDetailsSelector: '.contact-details',
excludeFromBirthdayKey: 'x-nc-exclude-from-birthday-calendar',

Expand Down Expand Up @@ -595,7 +600,6 @@ export default {
// unbind capture ctrl+s
document.removeEventListener('keydown', this.onCtrlSave)
},

methods: {
/**
* Send the local clone of contact to the store
Expand Down Expand Up @@ -835,6 +839,10 @@ export default {
this.pickedAddressbook = null
},

updatedValue(newValue) {
this.groupValue = newValue
},

/**
* Should display the property
*
Expand Down Expand Up @@ -911,4 +919,7 @@ section.contact-details {
}
}
}
.header-icon{
display: none;
}
</style>
120 changes: 120 additions & 0 deletions src/components/ContactDetails/ContactDetailsStarred.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<!--
- @copyright Copyright (c) 2023 Avinash Gusain <avinash.gusain.ext@murena.com>
-
- @author Avinash Gusain <[email protected]>
-
- @license GNU AGPL version 3 or any later version
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-->

<template>
<div class="contact-header-starred__wrapper">
<ActionButton :disabled="isLoading" @click="callValidateGroup('starred')">
<template #icon>
<IconStar :class="{ 'starred-icon': starred }" :size="24" />
</template>
</ActionButton>
</div>
</template>

<script>
import ActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
import IconStar from 'vue-material-design-icons/Star.vue'

export default {
name: 'ContactDetailsStarred',

components: {
ActionButton,
IconStar,
},

props: {
contact: {
type: Object,
required: true,
},
},

data() {
return {
starred: false,
isLoading: false,
}
},
created() {
this.handleStarred = (response) => {
this.starred = response
this.isLoading = false
}
this.handleIsStarred = (response) => {
if (this.contact.key === response.contact.key) {
this.starred = response.starred
}
}
this.$root.$on('starred-response', this.handleStarred)
this.$root.$on('is-starred', this.handleIsStarred)
},
methods: {
/**
* Dispatch contact addition to group
*
* @param {string} groupName the group name
*/
callValidateGroup(groupName) {
this.$nextTick(() => {
this.isLoading = true
this.starred = !this.starred
this.$root.$emit('starred-update', groupName, this.starred)
})
},

},

}
</script>
<style lang="scss" scoped>
.contact-header-starred {
&__wrapper {
position: relative;
height: 75px;
li {
list-style-type:none;
width:24px;
margin: 0 16px;
height: 36px;
line-height: 36px;
.starred-icon {
::v-deep .material-design-icon__svg {
fill: #FC0;
path {
stroke: #FC0;
stroke-width: 1px;
}
}
}
::v-deep .material-design-icon__svg {
fill: var(--color-primary-text);
path {
stroke: var(--icon-inactive-color);
stroke-width: 1px;
}
}
}
}
}

</style>
Loading

0 comments on commit 070ebab

Please sign in to comment.