mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
* calculate distance between current user and queried user * fix query for unset location * use database to calculate distance * rename distance to distance to me, 100% calculation done in DB * distanceToMe tests * lint fixes * remove comments * Show user teaser popover with badges, Desktop * Refactor UserTeaser and add mobile popover support * Avoid click propagation (WIP) * Prevent event propagation * Adjust alignment and font sizes * More spacing for statistics * Add distance, simplify user link * Refactor location info into own component * Add tests for UserTeaserPopup * Refactor and test LocationInfo * Query distanceToMe, rename distance to distanceToMe * Update test * Improve tests for UserTeaser, WIP * Fix tests * DistanceToMe on User instead of Location * Revert "DistanceToMe on User instead of Location" This reverts commit 96c9db00a44cd120e47bfe9534d3e066a194744c. * Fix notifications * Refactor UserTeaser and fix location info * Fix group member crash * Show 0 distance * Fit in popover on small screens * Allow access to profile on desktop * Revert backend changes * Load user teaser popover data only when needed * Fix type mismatch * Refactor for clarity and accessibility * Litte refactorings and improvements * Fix popover test * Adapt and fix tests * Fix tests and bugs * Add placeholder * cypress: adapt user teaser locator to changes * Remove delays and scrolling * Disable popovers in notification list and fix layout * Remove flickering * Make overlay catch all pointer events on touch devices * Re-add attribute for E2E test * Fix test, return to mouseover * fix snapshot --------- Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de> Co-authored-by: Wolfgang Huß <wolle.huss@pjannto.com> Co-authored-by: mahula <lenzmath@posteo.de>
124 lines
2.6 KiB
Vue
124 lines
2.6 KiB
Vue
<template>
|
|
<div class="user-teaser" v-if="displayAnonymous">
|
|
<profile-avatar v-if="showAvatar" size="small" />
|
|
<span class="info anonymous">{{ $t('profile.userAnonym') }}</span>
|
|
</div>
|
|
<div v-else :class="[{ 'disabled-content': user.disabled }]" placement="top-start">
|
|
<!-- isTouchDevice only supported on client-->
|
|
<client-only>
|
|
<user-teaser-non-anonymous
|
|
v-if="user"
|
|
:link-to-profile="linkToProfile"
|
|
:user="user"
|
|
:group="group"
|
|
:wide="wide"
|
|
:show-avatar="showAvatar"
|
|
:date-time="dateTime"
|
|
:show-popover="showPopover"
|
|
@close="closeMenu"
|
|
/>
|
|
</client-only>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapGetters } from 'vuex'
|
|
|
|
import ProfileAvatar from '~/components/_new/generic/ProfileAvatar/ProfileAvatar'
|
|
import UserTeaserNonAnonymous from './UserTeaserNonAnonymous'
|
|
|
|
export default {
|
|
name: 'UserTeaser',
|
|
components: {
|
|
ProfileAvatar,
|
|
UserTeaserNonAnonymous,
|
|
},
|
|
props: {
|
|
linkToProfile: { type: Boolean, default: true },
|
|
user: { type: Object, default: null },
|
|
group: { type: Object, default: null },
|
|
wide: { type: Boolean, default: false },
|
|
showAvatar: { type: Boolean, default: true },
|
|
dateTime: { type: [Date, String], default: null },
|
|
showPopover: { type: Boolean, default: true },
|
|
},
|
|
computed: {
|
|
...mapGetters({
|
|
isModerator: 'auth/isModerator',
|
|
}),
|
|
displayAnonymous() {
|
|
const { user, isModerator } = this
|
|
return !user || user.deleted || (user.disabled && !isModerator)
|
|
},
|
|
},
|
|
methods: {
|
|
closeMenu() {
|
|
this.$emit('close')
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
.user-teaser {
|
|
display: flex;
|
|
flex-wrap: nowrap;
|
|
|
|
.trigger {
|
|
max-width: 100%;
|
|
display: flex !important;
|
|
justify-content: center;
|
|
align-items: center;
|
|
}
|
|
|
|
.profile-avatar {
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.info {
|
|
padding-left: $space-xx-small;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
|
|
&.anonymous {
|
|
font-size: $font-size-base;
|
|
}
|
|
|
|
.slug {
|
|
color: $color-primary;
|
|
font-size: calc(1.15 * $font-size-base);
|
|
}
|
|
|
|
.name {
|
|
color: $text-color-soft;
|
|
font-size: $font-size-base;
|
|
}
|
|
}
|
|
|
|
.flex-direction-column {
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: center;
|
|
align-items: flex-start;
|
|
}
|
|
|
|
.flex-direction-row {
|
|
display: flex;
|
|
flex-direction: row;
|
|
justify-content: center;
|
|
padding-left: 2px;
|
|
}
|
|
|
|
.text {
|
|
overflow: hidden;
|
|
white-space: nowrap;
|
|
text-overflow: ellipsis;
|
|
|
|
> .ds-text {
|
|
display: inline;
|
|
}
|
|
}
|
|
}
|
|
</style>
|