This commit is contained in:
Wolfgang Huß 2021-05-06 16:37:31 +02:00
parent 59dfb4662e
commit da951c6fb6
14 changed files with 25 additions and 151 deletions

View File

@ -2,10 +2,15 @@ import { v4 as uuid } from 'uuid'
export default { export default {
id: { type: 'string', primary: true, default: uuid }, id: { type: 'string', primary: true, default: uuid },
showDonations: { type: 'boolean' }, showDonations: { type: 'boolean', required: true },
goal: { type: 'number' }, goal: { type: 'number', required: true },
progress: { type: 'number' }, progress: { type: 'number', required: true },
createdAt: { type: 'string', isoDate: true, default: () => new Date().toISOString() }, createdAt: {
type: 'string',
isoDate: true,
required: true,
default: () => new Date().toISOString(),
},
updatedAt: { updatedAt: {
type: 'string', type: 'string',
isoDate: true, isoDate: true,

View File

@ -1,10 +1,10 @@
type Donations { type Donations {
id: ID! id: ID!
createdAt: String createdAt: String!
updatedAt: String updatedAt: String!
showDonations: Boolean! # Wolle make it required in the schema showDonations: Boolean!
goal: Int! # Wolle make it required in the schema goal: Int!
progress: Int! # Wolle make it required in the schema progress: Int!
} }
type Query { type Query {

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="donation-info"> <div class="donation-info">
<progress-bar :title="computedTitle" :label="label" :goal="goal" :progress="progress"> <progress-bar :label="label" :goal="goal" :progress="progress">
<a target="_blank" :href="links.DONATE"> <a target="_blank" :href="links.DONATE">
<base-button size="small" filled>{{ $t('donations.donate-now') }}</base-button> <base-button size="small" filled>{{ $t('donations.donate-now') }}</base-button>
</a> </a>
@ -10,7 +10,6 @@
<script> <script>
import links from '~/constants/links.js' import links from '~/constants/links.js'
// Wolle import { DonationsQuery } from '~/graphql/Donations'
import ProgressBar from '~/components/ProgressBar/ProgressBar.vue' import ProgressBar from '~/components/ProgressBar/ProgressBar.vue'
export default { export default {
@ -19,30 +18,15 @@ export default {
}, },
props: { props: {
title: { type: String, required: false, default: () => null }, title: { type: String, required: false, default: () => null },
goal: { goal: { type: Number, required: true },
type: Number, progress: { type: Number, required: true },
required: true,
},
progress: {
type: Number,
required: true,
},
}, },
data() { data() {
return { return {
links, links,
// Wolle goal: 15000,
// progress: 0,
} }
}, },
computed: { computed: {
computedTitle() {
// Wolle
if (this.title) return this.title
const today = new Date()
const month = today.toLocaleString(this.$i18n.locale(), { month: 'long' })
return `${this.$t('donations.donations-for')} ${month}`
},
label() { label() {
return this.$t('donations.amount-of-total', { return this.$t('donations.amount-of-total', {
amount: this.progress.toLocaleString(this.$i18n.locale()), amount: this.progress.toLocaleString(this.$i18n.locale()),
@ -50,37 +34,13 @@ export default {
}) })
}, },
}, },
// Wolle apollo: {
// Donations: {
// query() {
// return DonationsQuery()
// },
// update({ Donations }) {
// if (!Donations[0]) return
// const { goal, progress } = Donations[0] // Wolle showDonations
// this.goal = goal
// this.progress = progress
// },
// },
// },
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.donation-info { .donation-info {
// Wolle
display: flex; display: flex;
// align-items: flex-end;
// width: 100%;
// height: 100%;
flex: 1; flex: 1;
margin-bottom: $space-x-small; margin-bottom: $space-x-small;
// @media (max-width: 546px) {
// // width: 100%;
// height: 50%;
// // justify-content: flex-end;
// // margin-bottom: $space-x-small;
// }
} }
</style> </style>

View File

@ -29,17 +29,6 @@ describe('ProgessBar.vue', () => {
}) })
}) })
describe('given a title', () => {
beforeEach(() => {
propsData.title = 'This is progress'
})
// Wolle
it.skip('renders the title', () => {
expect(Wrapper().find('.progress-bar__title').text()).toBe('This is progress')
})
})
describe('given a label', () => { describe('given a label', () => {
beforeEach(() => { beforeEach(() => {
propsData.label = 'Going well' propsData.label = 'Going well'

View File

@ -1,10 +1,5 @@
<template> <template>
<div class="progress-bar-component"> <div class="progress-bar-component">
<!-- <h4 v-if="title" class="progress-bar__title">{{ title }}</h4> -->
<!-- <ds-flex :width="{ base: '300px' }"> -->
<!-- <ds-flex > -->
<!-- <ds-flex-item :width="{ base: '152px' }"> -->
<!-- <ds-flex-item> -->
<div class="progress-bar"> <div class="progress-bar">
<div class="progress-bar__goal"></div> <div class="progress-bar__goal"></div>
<div class="progress-bar__progress" :style="progressBarWidth"></div> <div class="progress-bar__progress" :style="progressBarWidth"></div>
@ -12,15 +7,9 @@
<span v-if="label" class="progress-bar__label">{{ label }}</span> <span v-if="label" class="progress-bar__label">{{ label }}</span>
</div> </div>
</div> </div>
<!-- </ds-flex-item> -->
<!-- <ds-flex-item :width="{ base: '100px' }"> -->
<!-- <ds-flex-item> -->
<div class="progress-bar-button"> <div class="progress-bar-button">
<slot /> <slot />
</div> </div>
<!-- </ds-flex-item> -->
<!-- </ds-flex> -->
<!-- <span v-if="label" class="progress-bar__label">{{ label }}</span> -->
</div> </div>
</template> </template>
@ -35,9 +24,6 @@ export default {
type: Number, type: Number,
required: true, required: true,
}, },
title: {
type: String,
},
label: { label: {
type: String, type: String,
}, },
@ -54,68 +40,22 @@ export default {
.progress-bar-component { .progress-bar-component {
height: 100%; height: 100%;
position: relative; position: relative;
// width: 150px;
// width: 100%;
// flex: 0 0 100%;
// align-self: stretch;
flex: 1; flex: 1;
display: flex; display: flex;
top: $space-xx-small; top: $space-xx-small;
// margin-right: $space-x-small;
// @media (max-width: 680px) {
// width: 180px;
// }
// @media (max-width: 546px) {
// flex-basis: 50%;
// flex-grow: 1;
// }
} }
.progress-bar { .progress-bar {
position: relative; position: relative;
height: 100%; height: 100%;
// width: 150px;
// width: 100%;
// flex: 0 0 100%;
// align-self: stretch;
flex: 1; flex: 1;
margin-right: $space-x-small; margin-right: $space-x-small;
// @media (max-width: 680px) {
// width: 180px;
// }
// @media (max-width: 546px) {
// flex-basis: 50%;
// flex-grow: 1;
// }
}
.progress-bar__title {
// Wolle
// position: absolute;
// top: -2px;
margin-left: $space-xxx-small;
// margin: 0;
@media (max-width: 546px) {
top: $space-xx-small;
}
@media (max-width: 350px) {
font-size: $font-size-small;
}
} }
.progress-bar__goal { .progress-bar__goal {
position: relative; position: relative;
height: 26px; // styleguide-button-size height: 26px; // styleguide-button-size
// Wolle width: 100%;
border: 1px solid $color-primary; border: 1px solid $color-primary;
// Wolle background-color: $color-neutral-100;
// background-color: $color-neutral-70;
background: repeating-linear-gradient(120deg, $color-neutral-80, $color-neutral-70); background: repeating-linear-gradient(120deg, $color-neutral-80, $color-neutral-70);
border-radius: $border-radius-base; border-radius: $border-radius-base;
} }
@ -126,11 +66,6 @@ export default {
left: 0px; left: 0px;
height: 26px; // styleguide-button-size height: 26px; // styleguide-button-size
max-width: 100%; max-width: 100%;
// Wolle background-color: $color-yellow;
// background: repeating-linear-gradient(60deg, $color-primary-light, $color-primary-light 35px, $color-primary 35px, $color-primary 70px);
// background: repeating-linear-gradient(60deg, $color-primary-light, $color-primary-light 35px, $color-primary 35px, $color-primary 50px);
// background: repeating-linear-gradient(60deg, $color-primary-light, $color-primary-light 25px, $color-primary 35px, $color-primary 50px, $color-primary-light, $color-primary, $color-primary);
// background: repeating-linear-gradient(120deg, $color-primary 0px, $color-primary 35px, $color-primary-light 45px, $color-primary-light 80px, $color-primary 90px);
background: repeating-linear-gradient( background: repeating-linear-gradient(
120deg, 120deg,
$color-primary 0px, $color-primary 0px,
@ -151,22 +86,15 @@ export default {
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
// Wolle border: 1px solid $color-primary;
border-radius: $border-radius-base; border-radius: $border-radius-base;
} }
.progress-bar__label { .progress-bar__label {
// Wolle
position: relative; position: relative;
// top: 8px;
// right: 8px;
// text-align: right;
float: right; float: right;
// margin-left: $space-xxx-small;
@media (max-width: 350px) { @media (max-width: 350px) {
font-size: $font-size-small; font-size: $font-size-small;
// top: 10px;
} }
} }

View File

@ -299,8 +299,7 @@
}, },
"donations": { "donations": {
"amount-of-total": "{amount} von {total} € erreicht", "amount-of-total": "{amount} von {total} € erreicht",
"donate-now": "Jetzt spenden", "donate-now": "Jetzt spenden"
"donations-for": "Spenden für"
}, },
"editor": { "editor": {
"embed": { "embed": {

View File

@ -299,8 +299,7 @@
}, },
"donations": { "donations": {
"amount-of-total": "{amount} of {total} € collected", "amount-of-total": "{amount} of {total} € collected",
"donate-now": "Donate now", "donate-now": "Donate now"
"donations-for": "Donations for"
}, },
"editor": { "editor": {
"embed": { "embed": {

View File

@ -245,8 +245,7 @@
}, },
"donations": { "donations": {
"amount-of-total": "{amount} de {total} € recaudados", "amount-of-total": "{amount} de {total} € recaudados",
"donate-now": "Donar ahora", "donate-now": "Donar ahora"
"donations-for": "Donaciones para"
}, },
"editor": { "editor": {
"embed": { "embed": {

View File

@ -245,8 +245,7 @@
}, },
"donations": { "donations": {
"amount-of-total": "{amount} de {total} € collectés", "amount-of-total": "{amount} de {total} € collectés",
"donate-now": "Faites un don", "donate-now": "Faites un don"
"donations-for": "Dons pour"
}, },
"editor": { "editor": {
"embed": { "embed": {

View File

@ -253,9 +253,7 @@
}, },
"donations": { "donations": {
"amount-of-total": "{amount} of {total} € collezionato", "amount-of-total": "{amount} of {total} € collezionato",
"donate-now": "Dona ora", "donate-now": "Dona ora" },
"donations-for": "Donazioni per"
},
"editor": { "editor": {
"embed": { "embed": {
"always_allow": null, "always_allow": null,

View File

@ -291,8 +291,7 @@
}, },
"donations": { "donations": {
"amount-of-total": "{amount} dos {total} € foram coletados", "amount-of-total": "{amount} dos {total} € foram coletados",
"donate-now": "Doe agora", "donate-now": "Doe agora"
"donations-for": "Doações para"
}, },
"editor": { "editor": {
"embed": { "embed": {

View File

@ -245,8 +245,7 @@
}, },
"donations": { "donations": {
"amount-of-total": "{amount} из {total} € собрано", "amount-of-total": "{amount} из {total} € собрано",
"donate-now": "Пожертвуйте сейчас", "donate-now": "Пожертвуйте сейчас"
"donations-for": "Пожертвования для"
}, },
"editor": { "editor": {
"embed": { "embed": {

View File

@ -30,7 +30,6 @@
:disabled="!showDonations" :disabled="!showDonations"
/> />
<base-button class="donations-info-button" filled type="submit"> <base-button class="donations-info-button" filled type="submit">
<!-- Wolle :disabled="formData.showDonations === null || !formData.goal || !formData.progress" -->
{{ $t('actions.save') }} {{ $t('actions.save') }}
</base-button> </base-button>
</ds-form> </ds-form>

View File

@ -5,6 +5,7 @@
<hashtags-filter :hashtag="hashtag" @clearSearch="clearSearch" /> <hashtags-filter :hashtag="hashtag" @clearSearch="clearSearch" />
</ds-grid-item> </ds-grid-item>
<!-- donation info --> <!-- donation info -->
<!-- Wolle test appearence or hiding -->
<ds-grid-item v-if="showDonations" class="top-info-bar" :row-span="1" column-span="fullWidth"> <ds-grid-item v-if="showDonations" class="top-info-bar" :row-span="1" column-span="fullWidth">
<donation-info :goal="goal" :progress="progress" /> <donation-info :goal="goal" :progress="progress" />
</ds-grid-item> </ds-grid-item>