Wolfgang Huß c1a05bc73b
feat(webapp): add location distance in group profile (#8846)
* Add distance to group profile if location is defined

* Fix snapshot tests in 'webapp/pages/groups/_id/_slug.spec.js'

* Fix prop Vue warning in test 'webapp/pages/groups/_id/_slug.spec.js'

* reuse locationFragement for groups

* use better order on locationFragement parameters

* moved LocationInfo Component to correct place as its used in Group & User related context

* use size prop

* reduce changeset

* update snapshots

* remove computed property & simplify component

* more tests & updated snapshots

---------

Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>
2025-08-26 10:34:30 +02:00

204 lines
4.1 KiB
JavaScript

import gql from 'graphql-tag'
import {
userFragment,
postFragment,
commentFragment,
postCountsFragment,
userCountsFragment,
locationFragment,
badgesFragment,
tagsCategoriesAndPinnedFragment,
} from './Fragments'
export default (i18n) => {
const lang = i18n.locale().toUpperCase()
return gql`
${userFragment}
${userCountsFragment}
${locationFragment('User', lang)}
${badgesFragment}
${postFragment}
${postCountsFragment}
${tagsCategoriesAndPinnedFragment}
${commentFragment}
query Post($id: ID!) {
Post(id: $id) {
postType
eventStart
eventEnd
eventVenue
eventLocationName
eventIsOnline
...post
...postCounts
...tagsCategoriesAndPinned
author {
...user
...userCounts
...location
...badges
blocked
}
comments(orderBy: createdAt_asc) {
...comment
author {
...user
...userCounts
...location
...badges
}
}
group {
id
name
slug
groupType
}
}
}
`
}
export const filterPosts = (i18n) => {
const lang = i18n.locale().toUpperCase()
return gql`
${userFragment}
${userCountsFragment}
${locationFragment('User', lang)}
${badgesFragment}
${postFragment}
${postCountsFragment}
${tagsCategoriesAndPinnedFragment}
query Post($filter: _PostFilter, $first: Int, $offset: Int, $orderBy: [_PostOrdering]) {
Post(filter: $filter, first: $first, offset: $offset, orderBy: $orderBy) {
postType
eventStart
eventEnd
eventVenue
eventLocationName
eventLocation {
lng
lat
}
eventIsOnline
...post
...postCounts
...tagsCategoriesAndPinned
author {
...user
...userCounts
...location
...badges
}
group {
id
name
slug
groupType
}
}
}
`
}
export const profilePagePosts = (i18n) => {
const lang = i18n.locale().toUpperCase()
return gql`
${userFragment}
${userCountsFragment}
${locationFragment('User', lang)}
${badgesFragment}
${postFragment}
${postCountsFragment}
${tagsCategoriesAndPinnedFragment}
query profilePagePosts(
$filter: _PostFilter
$first: Int
$offset: Int
$orderBy: [_PostOrdering]
) {
profilePagePosts(filter: $filter, first: $first, offset: $offset, orderBy: $orderBy) {
postType
eventStart
eventVenue
eventLocationName
...post
...postCounts
...tagsCategoriesAndPinned
author {
...user
...userCounts
...location
...badges
}
group {
id
name
slug
groupType
}
}
}
`
}
export const PostsEmotionsByCurrentUser = () => {
return gql`
query PostsEmotionsByCurrentUser($postId: ID!) {
PostsEmotionsByCurrentUser(postId: $postId)
}
`
}
export const relatedContributions = (i18n) => {
const lang = i18n.locale().toUpperCase()
return gql`
${userFragment}
${userCountsFragment}
${locationFragment('User', lang)}
${badgesFragment}
${postFragment}
${postCountsFragment}
${tagsCategoriesAndPinnedFragment}
query Post($slug: String!) {
Post(slug: $slug) {
...post
...postCounts
...tagsCategoriesAndPinned
author {
...user
...userCounts
...location
...badges
}
relatedContributions(first: 2) {
...post
...postCounts
...tagsCategoriesAndPinned
author {
...user
...userCounts
...location
...badges
}
}
}
}
`
}
export const postsPinnedCountsQuery = () => {
return gql`
query {
PostsPinnedCounts {
maxPinnedPosts
currentlyPinnedPosts
}
}
`
}