first implementation - unclear if specifications are correct

This commit is contained in:
Ulf Gebhardt 2019-04-10 13:35:24 +02:00
parent cece32f55d
commit c70e6227ba
No known key found for this signature in database
GPG Key ID: 44C888923CC8E7F3
8 changed files with 67 additions and 161 deletions

View File

@ -1,6 +1,7 @@
import createOrUpdateLocations from './nodes/locations'
import dotenv from 'dotenv' import dotenv from 'dotenv'
import createOrUpdateLocations from './nodes/locations'
dotenv.config() dotenv.config()
export default { export default {

View File

@ -15,7 +15,8 @@
"followers": "Folgen", "followers": "Folgen",
"following": "Folgt", "following": "Folgt",
"shouted": "Empfohlen", "shouted": "Empfohlen",
"commented": "Kommentiert" "commented": "Kommentiert",
"userAnonym": "Anonymus"
}, },
"search": { "search": {
"placeholder": "Suchen", "placeholder": "Suchen",
@ -27,6 +28,7 @@
"data": { "data": {
"name": "Deine Daten", "name": "Deine Daten",
"labelName": "Dein Name", "labelName": "Dein Name",
"namePlaceholder": "Anonymus",
"labelCity": "Deine Stadt oder Region", "labelCity": "Deine Stadt oder Region",
"labelBio": "Über dich" "labelBio": "Über dich"
}, },
@ -202,4 +204,4 @@
"shoutButton": { "shoutButton": {
"shouted": "empfohlen" "shouted": "empfohlen"
} }
} }

View File

@ -15,7 +15,8 @@
"followers": "Followers", "followers": "Followers",
"following": "Following", "following": "Following",
"shouted": "Shouted", "shouted": "Shouted",
"commented": "Commented" "commented": "Commented",
"userAnonym": "Anonymous"
}, },
"search": { "search": {
"placeholder": "Search", "placeholder": "Search",
@ -27,6 +28,7 @@
"data": { "data": {
"name": "Your data", "name": "Your data",
"labelName": "Your Name", "labelName": "Your Name",
"namePlaceholder": "Anonymous",
"labelCity": "Your City or Region", "labelCity": "Your City or Region",
"labelBio": "About You" "labelBio": "About You"
}, },
@ -202,4 +204,4 @@
"shoutButton": { "shoutButton": {
"shouted": "shouted" "shouted": "shouted"
} }
} }

View File

@ -15,13 +15,15 @@
"followers": "Seguenti", "followers": "Seguenti",
"following": "Seguendo", "following": "Seguendo",
"shouted": "Gridato", "shouted": "Gridato",
"commented": "Commentato" "commented": "Commentato",
"userAnonym": "Anonymous"
}, },
"settings": { "settings": {
"name": "Impostazioni", "name": "Impostazioni",
"data": { "data": {
"name": "I tuoi dati", "name": "I tuoi dati",
"labelName": "Nome", "labelName": "Nome",
"namePlaceholder": "Anonymous",
"labelCity": "La tua città o regione", "labelCity": "La tua città o regione",
"labelBio": "Su di te" "labelBio": "Su di te"
}, },

View File

@ -15,13 +15,15 @@
"followers": "Obserwujący", "followers": "Obserwujący",
"following": "Obserwowani", "following": "Obserwowani",
"shouted": "Krzyknij", "shouted": "Krzyknij",
"commented": "Skomentuj" "commented": "Skomentuj",
"userAnonym": "Anonymous"
}, },
"settings": { "settings": {
"name": "Ustawienia", "name": "Ustawienia",
"data": { "data": {
"name": "Twoje dane", "name": "Twoje dane",
"labelName": "Twoje dane", "labelName": "Twoje dane",
"namePlaceholder": "Anonymous",
"labelCity": "Twoje miasto lub region", "labelCity": "Twoje miasto lub region",
"labelBio": "O Tobie" "labelBio": "O Tobie"
}, },

View File

@ -15,13 +15,15 @@
"followers": "Seguidores", "followers": "Seguidores",
"following": "Seguindo", "following": "Seguindo",
"shouted": "Aclamou", "shouted": "Aclamou",
"commented": "Comentou" "commented": "Comentou",
"userAnonym": "Anonymous"
}, },
"settings": { "settings": {
"name": "Configurações", "name": "Configurações",
"data": { "data": {
"name": "Seus dados", "name": "Seus dados",
"labelName": "Seu nome", "labelName": "Seu nome",
"namePlaceholder": "Anonymous",
"labelCity": "Sua cidade ou estado", "labelCity": "Sua cidade ou estado",
"labelBio": "Sobre você" "labelBio": "Sobre você"
}, },

View File

@ -3,23 +3,14 @@
<ds-card v-if="user && user.image"> <ds-card v-if="user && user.image">
<p>PROFILE IMAGE</p> <p>PROFILE IMAGE</p>
</ds-card> </ds-card>
<ds-space /> <ds-space/>
<ds-flex <ds-flex v-if="user" :width="{ base: '100%' }" gutter="base">
v-if="user"
:width="{ base: '100%' }"
gutter="base"
>
<ds-flex-item :width="{ base: '100%', sm: 2, md: 2, lg: 1 }"> <ds-flex-item :width="{ base: '100%', sm: 2, md: 2, lg: 1 }">
<ds-card <ds-card
:class="{'disabled-content': user.disabled}" :class="{'disabled-content': user.disabled}"
style="position: relative; height: auto;" style="position: relative; height: auto;"
> >
<ds-avatar <ds-avatar :image="user.avatar" :name="userName()" class="profile-avatar" size="120px"/>
:image="user.avatar"
:name="user.name || 'Anonymus'"
class="profile-avatar"
size="120px"
/>
<no-ssr> <no-ssr>
<content-menu <content-menu
placement="bottom-end" placement="bottom-end"
@ -29,62 +20,37 @@
/> />
</no-ssr> </no-ssr>
<ds-space margin="small"> <ds-space margin="small">
<ds-heading <ds-heading tag="h3" align="center" no-margin>{{ userName() }}</ds-heading>
tag="h3" <ds-text v-if="user.location" align="center" color="soft" size="small">
align="center" <ds-icon name="map-marker"/>
no-margin {{ user.location.name }}
>
{{ user.name }}
</ds-heading>
<ds-text
v-if="user.location"
align="center"
color="soft"
size="small"
>
<ds-icon name="map-marker" /> {{ user.location.name }}
</ds-text> </ds-text>
<ds-text <ds-text
align="center" align="center"
color="soft" color="soft"
size="small" size="small"
> >{{ $t('profile.memberSince') }} {{ user.createdAt | date('MMMM yyyy') }}</ds-text>
{{ $t('profile.memberSince') }} {{ user.createdAt | date('MMMM yyyy') }}
</ds-text>
</ds-space> </ds-space>
<ds-space <ds-space v-if="user.badges && user.badges.length" margin="x-small">
v-if="user.badges && user.badges.length" <hc-badges :badges="user.badges"/>
margin="x-small"
>
<hc-badges
:badges="user.badges"
/>
</ds-space> </ds-space>
<ds-flex> <ds-flex>
<ds-flex-item> <ds-flex-item>
<no-ssr> <no-ssr>
<ds-number :label="$t('profile.followers')"> <ds-number :label="$t('profile.followers')">
<hc-count-to <hc-count-to slot="count" :end-val="followedByCount"/>
slot="count"
:end-val="followedByCount"
/>
</ds-number> </ds-number>
</no-ssr> </no-ssr>
</ds-flex-item> </ds-flex-item>
<ds-flex-item> <ds-flex-item>
<no-ssr> <no-ssr>
<ds-number :label="$t('profile.following')"> <ds-number :label="$t('profile.following')">
<hc-count-to <hc-count-to slot="count" :end-val="Number(user.followingCount) || 0"/>
slot="count"
:end-val="Number(user.followingCount) || 0"
/>
</ds-number> </ds-number>
</no-ssr> </no-ssr>
</ds-flex-item> </ds-flex-item>
</ds-flex> </ds-flex>
<ds-space <ds-space margin="small">
margin="small"
>
<hc-follow-button <hc-follow-button
v-if="!myProfile" v-if="!myProfile"
:follow-id="user.id" :follow-id="user.id"
@ -95,122 +61,61 @@
</ds-space> </ds-space>
<template v-if="user.about"> <template v-if="user.about">
<hr> <hr>
<ds-space <ds-space margin-top="small" margin-bottom="small">
margin-top="small" <ds-text color="soft" size="small">{{ user.about }}</ds-text>
margin-bottom="small"
>
<ds-text
color="soft"
size="small"
>
{{ user.about }}
</ds-text>
</ds-space> </ds-space>
</template> </template>
</ds-card> </ds-card>
<ds-space /> <ds-space/>
<ds-heading <ds-heading tag="h3" soft style="text-align: center; margin-bottom: 10px;">Netzwerk</ds-heading>
tag="h3"
soft
style="text-align: center; margin-bottom: 10px;"
>
Netzwerk
</ds-heading>
<ds-card style="position: relative; height: auto;"> <ds-card style="position: relative; height: auto;">
<ds-space <ds-space v-if="user.following && user.following.length" margin="x-small">
v-if="user.following && user.following.length" <ds-text tag="h5" color="soft">Wem folgt {{ userName(15) }}?</ds-text>
margin="x-small"
>
<ds-text
tag="h5"
color="soft"
>
Wem folgt {{ user.name | truncate(15) }}?
</ds-text>
</ds-space> </ds-space>
<template v-if="user.following && user.following.length"> <template v-if="user.following && user.following.length">
<ds-space <ds-space v-for="follow in uniq(user.following)" :key="follow.id" margin="x-small">
v-for="follow in uniq(user.following)"
:key="follow.id"
margin="x-small"
>
<!-- TODO: find better solution for rendering errors --> <!-- TODO: find better solution for rendering errors -->
<no-ssr> <no-ssr>
<user <user :user="follow" :trunc="15"/>
:user="follow"
:trunc="15"
/>
</no-ssr> </no-ssr>
</ds-space> </ds-space>
<ds-space <ds-space v-if="user.followingCount - user.following.length" margin="small">
v-if="user.followingCount - user.following.length"
margin="small"
>
<ds-text <ds-text
size="small" size="small"
color="softer" color="softer"
> >und {{ user.followingCount - user.following.length }} weitere</ds-text>
und {{ user.followingCount - user.following.length }} weitere
</ds-text>
</ds-space> </ds-space>
</template> </template>
<template v-else> <template v-else>
<p style="text-align: center; opacity: .5;"> <p style="text-align: center; opacity: .5;">{{ userName() }} folgt niemandem</p>
{{ user.name }} folgt niemandem
</p>
</template> </template>
</ds-card> </ds-card>
<ds-space /> <ds-space/>
<ds-card style="position: relative; height: auto;"> <ds-card style="position: relative; height: auto;">
<ds-space <ds-space v-if="user.followedBy && user.followedBy.length" margin="x-small">
v-if="user.followedBy && user.followedBy.length" <ds-text tag="h5" color="soft">Wer folgt {{ userName(15) }}?</ds-text>
margin="x-small"
>
<ds-text
tag="h5"
color="soft"
>
Wer folgt {{ user.name | truncate(15) }}?
</ds-text>
</ds-space> </ds-space>
<template v-if="user.followedBy && user.followedBy.length"> <template v-if="user.followedBy && user.followedBy.length">
<ds-space <ds-space v-for="follow in uniq(user.followedBy)" :key="follow.id" margin="x-small">
v-for="follow in uniq(user.followedBy)"
:key="follow.id"
margin="x-small"
>
<!-- TODO: find better solution for rendering errors --> <!-- TODO: find better solution for rendering errors -->
<no-ssr> <no-ssr>
<user <user :user="follow" :trunc="15"/>
:user="follow"
:trunc="15"
/>
</no-ssr> </no-ssr>
</ds-space> </ds-space>
<ds-space <ds-space v-if="user.followedByCount - user.followedBy.length" margin="small">
v-if="user.followedByCount - user.followedBy.length"
margin="small"
>
<ds-text <ds-text
size="small" size="small"
color="softer" color="softer"
> >und {{ user.followedByCount - user.followedBy.length }} weitere</ds-text>
und {{ user.followedByCount - user.followedBy.length }} weitere
</ds-text>
</ds-space> </ds-space>
</template> </template>
<template v-else> <template v-else>
<p style="text-align: center; opacity: .5;"> <p style="text-align: center; opacity: .5;">niemand folgt {{ userName() }}</p>
niemand folgt {{ user.name }}
</p>
</template> </template>
</ds-card> </ds-card>
</ds-flex-item> </ds-flex-item>
<ds-flex-item :width="{ base: '100%', sm: 3, md: 5, lg: 3 }"> <ds-flex-item :width="{ base: '100%', sm: 3, md: 5, lg: 3 }">
<ds-flex <ds-flex :width="{ base: '100%' }" gutter="small">
:width="{ base: '100%' }"
gutter="small"
>
<ds-flex-item class="profile-top-navigation"> <ds-flex-item class="profile-top-navigation">
<ds-card class="ds-tab-nav"> <ds-card class="ds-tab-nav">
<ds-flex> <ds-flex>
@ -219,10 +124,7 @@
<!-- TODO: find better solution for rendering errors --> <!-- TODO: find better solution for rendering errors -->
<no-ssr> <no-ssr>
<ds-number :label="$t('common.post', null, user.contributionsCount)"> <ds-number :label="$t('common.post', null, user.contributionsCount)">
<hc-count-to <hc-count-to slot="count" :end-val="user.contributionsCount"/>
slot="count"
:end-val="user.contributionsCount"
/>
</ds-number> </ds-number>
</no-ssr> </no-ssr>
</ds-space> </ds-space>
@ -232,10 +134,7 @@
<!-- TODO: find better solution for rendering errors --> <!-- TODO: find better solution for rendering errors -->
<no-ssr> <no-ssr>
<ds-number :label="$t('profile.commented')"> <ds-number :label="$t('profile.commented')">
<hc-count-to <hc-count-to slot="count" :end-val="user.commentsCount"/>
slot="count"
:end-val="user.commentsCount"
/>
</ds-number> </ds-number>
</no-ssr> </no-ssr>
</ds-space> </ds-space>
@ -245,10 +144,7 @@
<!-- TODO: find better solution for rendering errors --> <!-- TODO: find better solution for rendering errors -->
<no-ssr> <no-ssr>
<ds-number :label="$t('profile.shouted')"> <ds-number :label="$t('profile.shouted')">
<hc-count-to <hc-count-to slot="count" :end-val="user.shoutedCount"/>
slot="count"
:end-val="user.shoutedCount"
/>
</ds-number> </ds-number>
</no-ssr> </no-ssr>
</ds-space> </ds-space>
@ -273,25 +169,16 @@
:key="post.id" :key="post.id"
:width="{ base: '100%', md: '100%', xl: '50%' }" :width="{ base: '100%', md: '100%', xl: '50%' }"
> >
<hc-post-card <hc-post-card :post="post"/>
:post="post"
/>
</ds-flex-item> </ds-flex-item>
</template> </template>
<template v-else> <template v-else>
<ds-flex-item :width="{ base: '100%' }"> <ds-flex-item :width="{ base: '100%' }">
<hc-empty <hc-empty margin="xx-large" icon="file"/>
margin="xx-large"
icon="file"
/>
</ds-flex-item> </ds-flex-item>
</template> </template>
</ds-flex> </ds-flex>
<hc-load-more <hc-load-more v-if="hasMore" :loading="$apollo.loading" @click="showMoreContributions"/>
v-if="hasMore"
:loading="$apollo.loading"
@click="showMoreContributions"
/>
</ds-flex-item> </ds-flex-item>
</ds-flex> </ds-flex>
</div> </div>
@ -395,6 +282,14 @@ export default {
}, },
fetchPolicy: 'cache-and-network' fetchPolicy: 'cache-and-network'
}) })
},
userName(maxLength) {
// Return Anonymous if no Username is given
if (!this.user.name) {
return this.$t('profile.userAnonym')
}
// Return full Username or truncated Username
return maxLength ? this.user.name.substring(0, maxLength) : this.user.name
} }
}, },
apollo: { apollo: {

View File

@ -9,7 +9,7 @@
model="name" model="name"
icon="user" icon="user"
:label="$t('settings.data.labelName')" :label="$t('settings.data.labelName')"
:placeholder="$t('settings.data.labelName')" :placeholder="$t('settings.data.namePlaceholder')"
/> />
<!-- eslint-disable vue/use-v-on-exact --> <!-- eslint-disable vue/use-v-on-exact -->
<ds-select <ds-select