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>
104 lines
2.2 KiB
Vue
104 lines
2.2 KiB
Vue
<template>
|
|
<div class="placeholder" v-if="!user" />
|
|
<div class="user-teaser-popover" v-else>
|
|
<badges
|
|
v-if="$env.BADGES_ENABLED && user.badgeVerification"
|
|
:badges="[user.badgeVerification, ...user.badgeTrophiesSelected]"
|
|
/>
|
|
<location-info v-if="user.location" :location-data="user.location" class="location-info" />
|
|
<ul class="statistics">
|
|
<li>
|
|
<ds-number :count="user.followedByCount" :label="$t('profile.followers')" />
|
|
</li>
|
|
<li>
|
|
<ds-number
|
|
:count="user.contributionsCount"
|
|
:label="$t('common.post', null, user.contributionsCount)"
|
|
/>
|
|
</li>
|
|
<li>
|
|
<ds-number
|
|
:count="user.commentedCount"
|
|
:label="$t('common.comment', null, user.commentedCount)"
|
|
/>
|
|
</li>
|
|
</ul>
|
|
<nuxt-link v-if="isTouchDevice && userLink" :to="userLink" class="link">
|
|
<ds-button primary>{{ $t('user-teaser.popover.open-profile') }}</ds-button>
|
|
</nuxt-link>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import Badges from '~/components/Badges.vue'
|
|
import LocationInfo from '~/components/UserTeaser/LocationInfo.vue'
|
|
import { isTouchDevice } from '~/components/utils/isTouchDevice'
|
|
import { userTeaserQuery } from '~/graphql/User.js'
|
|
|
|
export default {
|
|
name: 'UserTeaserPopover',
|
|
components: {
|
|
Badges,
|
|
LocationInfo,
|
|
},
|
|
props: {
|
|
userId: { type: String },
|
|
userLink: { type: Object },
|
|
},
|
|
computed: {
|
|
isTouchDevice() {
|
|
return isTouchDevice()
|
|
},
|
|
user() {
|
|
return (this.User && this.User[0]) ?? null
|
|
},
|
|
},
|
|
apollo: {
|
|
User: {
|
|
query() {
|
|
return userTeaserQuery(this.$i18n)
|
|
},
|
|
variables() {
|
|
return { id: this.userId }
|
|
},
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.placeholder {
|
|
height: 200px;
|
|
width: 200px;
|
|
}
|
|
.user-teaser-popover {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
padding: 16px;
|
|
gap: 16px;
|
|
min-width: 200px;
|
|
}
|
|
|
|
@media (max-height: 800px) {
|
|
.user-teaser-popover {
|
|
padding: 0;
|
|
gap: 0;
|
|
}
|
|
}
|
|
|
|
.location-info {
|
|
margin-bottom: 12px;
|
|
}
|
|
|
|
.link {
|
|
margin-top: 16px;
|
|
}
|
|
|
|
.statistics {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
width: 100%;
|
|
}
|
|
</style>
|