Implement 'location' on group profile

This commit is contained in:
Wolfgang Huß 2022-09-17 01:00:50 +02:00
parent 58bdb33e95
commit a4575f3ad0
4 changed files with 46 additions and 34 deletions

View File

@ -131,35 +131,41 @@ export const changeGroupMemberRoleMutation = gql`
// ------ queries // ------ queries
export const groupQuery = gql` export const groupQuery = (i18n) => {
query ($isMember: Boolean, $id: ID, $slug: String) { const lang = i18n.locale().toUpperCase()
Group(isMember: $isMember, id: $id, slug: $slug) { return gql`
id query ($isMember: Boolean, $id: ID, $slug: String) {
name Group(isMember: $isMember, id: $id, slug: $slug) {
slug
createdAt
updatedAt
disabled
deleted
about
description
descriptionExcerpt
groupType
actionRadius
categories {
id id
slug
name name
icon slug
createdAt
updatedAt
disabled
deleted
about
description
descriptionExcerpt
groupType
actionRadius
categories {
id
slug
name
icon
}
avatar {
url
}
locationName
location {
name: name${lang}
}
myRole
} }
avatar {
url
}
locationName # test this as result
myRole
} }
} `
` }
export const groupMembersQuery = gql` export const groupMembersQuery = gql`
query ($id: ID!) { query ($id: ID!) {

View File

@ -40,10 +40,10 @@
{{ groupSlug }} {{ groupSlug }}
</ds-text> </ds-text>
<!-- Group location --> <!-- Group location -->
<!-- <ds-text v-if="user.location" align="center" color="soft" size="small"> <ds-text v-if="group && group.location" align="center" color="soft" size="small">
<base-icon name="map-marker" /> <base-icon name="map-marker" />
{{ user.location.name }} {{ group && group.location ? group.location.name : '' }}
</ds-text> --> </ds-text>
<!-- Group created at --> <!-- Group created at -->
<ds-text align="center" color="soft" size="small"> <ds-text align="center" color="soft" size="small">
{{ $t('group.foundation') }} {{ group.createdAt | date('MMMM yyyy') }} {{ $t('group.foundation') }} {{ group.createdAt | date('MMMM yyyy') }}
@ -141,6 +141,7 @@
}} }}
</ds-chip> </ds-chip>
</div> </div>
<ds-space margin="x-small" />
</ds-space> </ds-space>
<!-- Group categories --> <!-- Group categories -->
<template v-if="categoriesActive"> <template v-if="categoriesActive">
@ -155,8 +156,13 @@
) )
}} }}
</ds-text> </ds-text>
<ds-space margin="xx-small" />
<div class="categories"> <div class="categories">
<div v-for="category in group.categories" :key="category.id" align="center"> <div
v-for="(category, index) in group.categories"
:key="category.id"
align="center"
>
<category <category
:icon="category.icon" :icon="category.icon"
:name="$t(`contribution.category.name.${category.slug}`)" :name="$t(`contribution.category.name.${category.slug}`)"
@ -165,7 +171,7 @@
placement: 'bottom-start', placement: 'bottom-start',
}" }"
/> />
<ds-space margin="xxx-small" /> <ds-space v-if="index < group.categories.length - 1" margin="xxx-small" />
</div> </div>
</div> </div>
</ds-space> </ds-space>
@ -177,6 +183,7 @@
<ds-text class="centered-text hyphenate-text" color="soft" size="small"> <ds-text class="centered-text hyphenate-text" color="soft" size="small">
{{ $t('group.goal') }} {{ $t('group.goal') }}
</ds-text> </ds-text>
<ds-space margin="xx-small" />
<div class="chip" align="center"> <div class="chip" align="center">
<ds-chip>{{ group ? group.about : '' }}</ds-chip> <ds-chip>{{ group ? group.about : '' }}</ds-chip>
</div> </div>
@ -564,8 +571,7 @@ export default {
// }, // },
Group: { Group: {
query() { query() {
// return groupQuery(this.$i18n) // language will be needed for locations return groupQuery(this.$i18n)
return groupQuery
}, },
variables() { variables() {
return { return {

View File

@ -51,7 +51,7 @@ export default {
Group: [group], Group: [group],
}, },
} = await client.query({ } = await client.query({
query: groupQuery, query: groupQuery(this.$i18n),
variables: { id }, variables: { id },
}) })
if (group.myRole !== 'owner') { if (group.myRole !== 'owner') {

View File

@ -27,7 +27,7 @@ export default {
async groupListQuery() { async groupListQuery() {
try { try {
const response = await this.$apollo.query({ const response = await this.$apollo.query({
query: groupQuery, query: groupQuery(this.$i18n),
}) })
this.responseGroupListQuery = response.data.Group this.responseGroupListQuery = response.data.Group
} catch (error) { } catch (error) {