diff --git a/webapp/components/User/User.story.js b/webapp/components/User/User.story.js
new file mode 100644
index 000000000..e7a66de3f
--- /dev/null
+++ b/webapp/components/User/User.story.js
@@ -0,0 +1,74 @@
+import { storiesOf } from '@storybook/vue'
+import { withA11y } from '@storybook/addon-a11y'
+import User from '~/components/User/User.vue'
+import helpers from '~/storybook/helpers'
+
+helpers.init()
+
+const user = {
+ id: 'u6',
+ slug: 'louie',
+ name: 'Louie',
+ avatar: 'https://s3.amazonaws.com/uifaces/faces/twitter/designervzm/128.jpg',
+ about:
+ 'Illum in et velit soluta voluptatem architecto consequuntur enim placeat. Eum excepturi est ratione rerum in voluptatum corporis. Illum consequatur minus. Modi incidunt velit.',
+ disabled: false,
+ deleted: false,
+ locationName: null,
+ location: null,
+ createdAt: '2019-09-18T14:16:01.695Z',
+ badges: [],
+ badgesCount: 0,
+ shoutedCount: 1,
+ commentedCount: 2,
+ contributionsCount: 5,
+ followingCount: 1,
+ following: [
+ {
+ id: 'u3',
+ slug: 'jenny-rostock',
+ name: 'Jenny Rostock',
+ avatar: 'https://s3.amazonaws.com/uifaces/faces/twitter/bowbrick/128.jpg',
+ disabled: false,
+ deleted: false,
+ followedByCount: 2,
+ followedByCurrentUser: false,
+ contributionsCount: 1,
+ commentedCount: 3,
+ badges: [
+ {
+ id: 'indiegogo_en_bear',
+ icon: '/img/badges/indiegogo_en_bear.svg',
+ },
+ ],
+ location: {
+ name: 'Paris',
+ },
+ },
+ ],
+ followedByCount: 0,
+ followedByCurrentUser: false,
+ isBlocked: false,
+ followedBy: [],
+ socialMedia: [],
+}
+
+storiesOf('User', module)
+ .addDecorator(withA11y)
+ .addDecorator(helpers.layout)
+ .add('available user', () => ({
+ components: { User },
+ store: helpers.store,
+ data: () => ({
+ user,
+ }),
+ template: '',
+ }))
+ .add('anonymous user', () => ({
+ components: { User },
+ store: helpers.store,
+ data: () => ({
+ user: null,
+ }),
+ template: '',
+ }))
diff --git a/webapp/components/User/User.vue b/webapp/components/User/User.vue
index 7c97c5755..f139ce6b9 100644
--- a/webapp/components/User/User.vue
+++ b/webapp/components/User/User.vue
@@ -11,17 +11,20 @@
- {{ userName | truncate(18) }}
-
-
-
-
-
-
-
-
+
+ {{ userName | truncate(18) }}
+
+
+
+
+
+
+
+
+ {{ userSlug }}
+
@@ -126,6 +129,10 @@ export default {
if (!(id && slug)) return ''
return { name: 'profile-id-slug', params: { slug, id } }
},
+ userSlug() {
+ const { slug } = this.user || {}
+ return slug && `@${slug}`
+ },
userName() {
const { name } = this.user || {}
return name || this.$t('profile.userAnonym')
diff --git a/webapp/pages/profile/_id/_slug.vue b/webapp/pages/profile/_id/_slug.vue
index d7f4e2f39..0d04e8ca7 100644
--- a/webapp/pages/profile/_id/_slug.vue
+++ b/webapp/pages/profile/_id/_slug.vue
@@ -27,7 +27,12 @@
/>
- {{ userName }}
+
+ {{ userName }}
+
+
+ {{ userSlug }}
+
{{ user.location.name }}
@@ -143,7 +148,7 @@
- {{ $t('profile.socialMedia') }} {{ user.name | truncate(15) }}?
+ {{ $t('profile.socialMedia') }} {{ userName | truncate(15) }}?
@@ -336,6 +341,10 @@ export default {
const { name } = this.user || {}
return name || this.$t('profile.userAnonym')
},
+ userSlug() {
+ const { slug } = this.user || {}
+ return slug && `@${slug}`
+ },
},
watch: {
User(val) {
diff --git a/webapp/storybook/helpers.js b/webapp/storybook/helpers.js
index eb4ef4556..6a479034f 100644
--- a/webapp/storybook/helpers.js
+++ b/webapp/storybook/helpers.js
@@ -5,6 +5,8 @@ import Styleguide from '@human-connection/styleguide'
import Filters from '~/plugins/vue-filters'
import layout from './layout.vue'
+import '~/plugins/v-tooltip'
+
const helpers = {
init(options = {}) {
Vue.use(Vuex)
@@ -25,6 +27,9 @@ const helpers = {
auth: {
namespaced: true,
getters: {
+ isModerator() {
+ return false
+ },
user(state) {
return { id: 1, name: 'admin' }
},
diff --git a/webapp/storybook/webpack.config.js b/webapp/storybook/webpack.config.js
index 80c0358e7..95c4c75a6 100644
--- a/webapp/storybook/webpack.config.js
+++ b/webapp/storybook/webpack.config.js
@@ -1,7 +1,6 @@
const path = require('path')
-const nuxtConf = require('../nuxt.config')
-const srcDir = `../${nuxtConf.srcDir || ''}`
-const rootDir = `../${nuxtConf.rootDir || ''}`
+const srcDir = '..'
+const rootDir = '..'
// Export a function. Accept the base config as the only param.
module.exports = async ({ config, mode }) => {