Skip to content

Commit

Permalink
fixup! refactor: Contacts menu to Vue
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Oct 3, 2023
1 parent f579f41 commit 0ff70f9
Show file tree
Hide file tree
Showing 4 changed files with 142 additions and 285 deletions.
265 changes: 0 additions & 265 deletions core/js/tests/specs/contactsmenuSpec.js

This file was deleted.

2 changes: 0 additions & 2 deletions core/src/OC/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ import {
PERMISSION_UPDATE,
TAG_FAVORITE,
} from './constants.js'
import ContactsMenu from './contactsmenu.js'
import { currentUser, getCurrentUser } from './currentuser.js'
import Dialogs from './dialogs.js'
import EventSource from './eventsource.js'
Expand Down Expand Up @@ -141,7 +140,6 @@ export default {
appConfig,
appswebroots,
Backbone,
ContactsMenu,
config: Config,
/**
* Currently logged in user or null if none
Expand Down
117 changes: 117 additions & 0 deletions core/src/components/ContactsMenu/Contact.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<!--
- @copyright 2023 Christoph Wurst <[email protected]>
-
- @author 2023 Christoph Wurst <[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>
<li class="contact">
<a v-if="contact.profileUrl && contact.avatar"
class="profile-link--avatar"
:href="contact.profileUrl">
<NcAvatar class="avatar"
:is-no-user="true"
:display-name="contact.avatarLabel"
:url="contact.avatar" />
</a>
<a v-else-if="contact.profileUrl"
class="profile-link--avatar"
:href="contact.profileUrl">
<NcAvatar class="avatar"
:is-no-user="true"
:display-name="contact.avatarLabel" />
</a>
<NcAvatar v-else-if="contact.avatar"
class="avatar"
:is-no-user="true"
:display-name="contact.avatarLabel"
:url="contact.avatar" />
<NcAvatar v-else
class="avatar"
:is-no-user="true"
:display-name="contact.avatarLabel" />

<a class="body"
:href="contact.profileUrl || contact.topAction?.hyperlink">
<div class="full-name">{{ contact.fullName }}</div>
<div class="last-message">{{ contact.lastMessage }}</div>
<div class="email-address">{{ contact.emailAddresses[0] }}</div>
</a>
<NcActions v-if="actions.length"
:inline="contact.topAction ? 1 : 0">
<template v-for="(action, idx) in actions"

Check failure on line 57 in core/src/components/ContactsMenu/Contact.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected no line breaks before closing bracket, but 1 line break found
>

Check failure on line 58 in core/src/components/ContactsMenu/Contact.vue

View workflow job for this annotation

GitHub Actions / eslint

Expected indentation of 3 tabs but found 4 tabs
<NcActionLink v-if="action.hyperlink !== '#'" :key="idx" :href="action.hyperlink" class="other-actions">

Check failure on line 59 in core/src/components/ContactsMenu/Contact.vue

View workflow job for this annotation

GitHub Actions / eslint

'class' should be on a new line
<template #icon>
<img class="contact__action__icon" :src="action.icon">
</template>
{{ action.title }}
</NcActionLink>
<NcActionText v-else :key="idx" class="other-actions">
<template #icon>
<img class="contact__action__icon" :src="action.icon">
</template>
{{ action.title }}
</NcActionText>
</template>
</NcActions>
</li>
</template>
<script>
import NcActionLink from '@nextcloud/vue/dist/Components/NcActionLink.js'
import NcActionText from '@nextcloud/vue/dist/Components/NcActionText.js'
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
export default {
name: 'Contact',
components: {
NcActionLink,
NcActionText,
NcActions,
NcAvatar,
},
props: {
contact: {
required: true,
type: Object,
},
},
computed: {
actions() {
if (this.contact.topAction) {
return [this.contact.topAction, ...this.contact.actions]
}
return this.contact.actions
},
},
}
</script>
<style scoped lang="scss">
.contact {
&__action {
&__icon {
width: 20px;
height: 20px;
padding: 12px;
}
}
}
</style>
Loading

0 comments on commit 0ff70f9

Please sign in to comment.