Ulf Gebhardt 8cf405c549
feat(backend): badges (#8391)
* delete all old badges

* reward/unrewardBadge

* verification Badges

* name all badged accordingly

* more tests, lint

* seed badges

* profileBadge mechanic

* badgesUnusedCount

* seed profileBadges set

* configure profile badge count

* insert badges db:data:badges:default

* seed commands to seed default badges and allow to seed branding data

* copy data migrations when building docker

* typo

* correct data:branding command & document it

* test new functionality

* Update backend/src/db/seed/badges.ts

Co-authored-by: Max <maxharz@gmail.com>

* Update backend/src/db/seed/badges.ts

Co-authored-by: Max <maxharz@gmail.com>

* Update backend/src/db/seed/badges.ts

Co-authored-by: Max <maxharz@gmail.com>

* naming coventions

* final naming fix

lint

fix build

fix badge type in test

renamed badge_ to trophy_

lint fixes

small renameing

fixes

fix users spec

fix webapp queries

fix display

* expose badge description

---------

Co-authored-by: Max <maxharz@gmail.com>
2025-04-17 23:08:54 +00:00

154 lines
4.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { storiesOf } from '@storybook/vue'
import { withA11y } from '@storybook/addon-a11y'
import UserTeaser from '~/components/UserTeaser/UserTeaser.vue'
import helpers from '~/storybook/helpers'
helpers.init()
export const user = {
id: 'u6',
slug: 'louie',
name: 'Louie',
avatar: {
url: '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: {
url: 'https://s3.amazonaws.com/uifaces/faces/twitter/bowbrick/128.jpg',
},
disabled: false,
deleted: false,
followedByCount: 2,
followedByCurrentUser: false,
contributionsCount: 1,
commentedCount: 3,
badges: [
{
id: 'trophy_bear',
icon: '/img/badges/trophy_blue_bear.svg',
},
],
location: {
name: 'Paris',
},
},
],
followedByCount: 0,
followedByCurrentUser: false,
isMuted: false,
followedBy: [],
socialMedia: [],
}
export const group = {
id: 'g2',
name: 'Yoga Practice',
slug: 'yoga-practice',
about: null,
description: `<h3>What Is yoga?</h3><p>Yoga is not just about practicing asanas. It's about how we do it.</p><p class="">And practicing asanas doesn't have to be yoga, it can be more athletic than yogic.</p><h3>What makes practicing asanas yogic?</h3><p class="">The important thing is:</p><ul><li><p>Use the exercises (consciously) for your personal development.</p></li></ul>`,
descriptionExcerpt: `<h3>What Is yoga?</h3><p>Yoga is not just about practicing asanas. It's about how we do it.</p><p>And practicing asanas doesn't have to be yoga, it can be more athletic than yogic.</p><h3>What makes practicing asanas yogic?</h3><p>The important thing is:</p><ul><li><p>Use the exercises …</p></li></ul>`,
groupType: 'public',
actionRadius: 'interplanetary',
categories: [
{
id: 'cat4',
icon: 'psyche',
name: 'psyche',
slug: 'psyche',
description: 'Seele, Gefühle, Glück',
},
{
id: 'cat5',
icon: 'movement',
name: 'body-and-excercise',
slug: 'body-and-excercise',
description: 'Sport, Yoga, Massage, Tanzen, Entspannung',
},
{
id: 'cat17',
icon: 'spirituality',
name: 'spirituality',
slug: 'spirituality',
description: 'Religion, Werte, Ethik',
},
],
locationName: null,
location: null,
}
storiesOf('UserTeaser', module)
.addDecorator(withA11y)
.addDecorator(helpers.layout)
.add('user only', () => ({
components: { UserTeaser },
store: helpers.store,
data: () => ({
user,
}),
template: '<user-teaser :user="user" />',
}))
.add('with date', () => ({
components: { UserTeaser },
store: helpers.store,
data: () => ({
user,
}),
template: '<user-teaser :user="user" :date-time="new Date()" />',
}))
.add('has edited something', () => ({
components: { UserTeaser },
store: helpers.store,
data: () => ({
user,
}),
template: `
<user-teaser :user="user" :date-time="new Date()">
<template #dateTime>
- HEY! I'm edited
</template>
</user-teaser>
`,
}))
.add('anonymous', () => ({
components: { UserTeaser },
store: helpers.store,
data: () => ({
user: null,
}),
template: '<user-teaser :user="user" :date-time="new Date()" />',
}))
.add('with group and date', () => ({
components: { UserTeaser },
store: helpers.store,
data: () => ({
user,
group,
}),
template: '<user-teaser :user="user" :group="group" :date-time="new Date()" />',
}))
.add('with group and date wide', () => ({
components: { UserTeaser },
store: helpers.store,
data: () => ({
user,
group,
}),
template: '<user-teaser :user="user" :group="group" wide :date-time="new Date()" />',
}))