Ocelot-Social/webapp/components/Registration/RegistrationSlideInvite.vue
Wolfgang Huß 569485bc4c
🧘🏼 [Simulation] Brand reformer network first step – v2, Login etc. Branding (#8448)
* Refine locals of some internal pages headlines

* Create page 'legacy information'

* Move filter button into menu

* Refine page 'legacy information'

* Create internal page 'code-of-conduct.html'

* Refine internal page 'code-of-conduct.html'

* Refine page 'legacy information'

* Create internal page 'imprint.html'

* Create internal page 'faq.html'

* Create internal page 'support.html'

* Refine internal page 'faq.html'

* Refine internal page 'imprint.html'

* Move parts of internal page 'data-privacy.html' to 'terms-and-conditions.html'

* Refine internal page 'data-privacy.html'

* Fix tool tip text

* Fix 'email' -> 'e-mail'

* Rename title of organization footer item

- Remove donation page from footer

* Change 'Reformer.Network' to 'Reformer.network'

* Create internal page 'organization.html'

* Refine internal pages

* Translate internal pages

* Change brandings $secondary-color from 'rgb(244, 142, 0)' to 'rgb(239, 123, 0)'

* Change branding $color-primary-active from 'rgb(95, 97, 92)' to 'rgb(135, 135, 135)'

* Move commented font commands in '_branding.scss'

* Set $color-tertiary-light and ribbon colors in '_branding.scss'

* Refactor branding of post ribbons

* Refactor Logos

* Change branding $secondary-color from 'rgb(239, 123, 0)' to 'rgb(239, 124, 0)'

* Refactor colors after the designer suggestions - first step

* Change diverse collorings

- Change border color
- Change plus button
- Change hashtag color
- Change footer link hover
- Change number count color
- Change input border color

* Add font Inter

* Use font Inter

* Make font branding work

* Hover effect for user teaser

* Syncronize 'metadata.ts' with webapp

* Refine e-mail notifications

* Adjust notification settings buttons

* Refine third party setting

* Fix post teaser counter icon tooltips translations

* Refine e-mail notifications

* Refine third party setting

* Add link hover to all internal pages

* Set font family to Inter

- Cleanup

* Set background, color, and font weight of user avatar

* Make login, registration, password-reset layout brandable

- Rename some variables related to this

* Set background images for Login etc.

* Set layout for Login etc. to be 'blank'

* Add login etc. background images

* - first fix for login, registration and password-reset

* - fixed background (including jumping)

* - removing quote block by css
- adding text block by css

* - set font weight

* - added approach also for registration page

* removed registration hack

---------

Co-authored-by: Maximilian Harz <maxharz@gmail.com>
Co-authored-by: Sebastian Stein <sebastian@codepassion.de>
Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>
2025-04-29 10:21:14 +02:00

162 lines
4.5 KiB
Vue

<template>
<ds-form
class="enter-invite"
v-model="formData"
:schema="formSchema"
@input="handleInput"
@input-valid="handleInputValid"
>
<ds-input
:placeholder="$t('components.registration.invite-code.form.invite-code')"
model="inviteCode"
name="inviteCode"
id="inviteCode"
icon="question-circle"
/>
<ds-text>
{{ $t('components.registration.invite-code.form.description') }}
</ds-text>
<slot></slot>
<ds-space margin="xxx-small" />
</ds-form>
</template>
<script>
import gql from 'graphql-tag'
import registrationConstants from '~/constants/registration'
export const isValidInviteCodeQuery = gql`
query ($code: ID!) {
isValidInviteCode(code: $code)
}
`
export default {
name: 'RegistrationSlideInvite',
props: {
sliderData: { type: Object, required: true },
},
data() {
return {
formData: {
inviteCode: '',
},
formSchema: {
inviteCode: {
type: 'string',
min: registrationConstants.INVITE_CODE_LENGTH,
max: registrationConstants.INVITE_CODE_LENGTH,
required: true,
message: this.$t('components.registration.invite-code.form.validations.length', {
inviteCodeLength: registrationConstants.INVITE_CODE_LENGTH,
}),
},
},
dbRequestInProgress: false,
}
},
mounted: function () {
this.$nextTick(function () {
// Code that will run only after the entire view has been rendered
this.formData.inviteCode = this.sliderData.collectedInputData.inviteCode
? this.sliderData.collectedInputData.inviteCode
: ''
this.sendValidation()
this.sliderData.setSliderValuesCallback(this.validInput, {
sliderSettings: { buttonSliderCallback: this.onNextClick },
})
})
},
computed: {
sliderIndex() {
return this.sliderData.sliderIndex // to have a shorter notation
},
validInput() {
return this.formData.inviteCode.length === 6
},
},
methods: {
async sendValidation() {
const { inviteCode } = this.formData
this.sliderData.setSliderValuesCallback(null, { collectedInputData: { inviteCode } })
let dbValidated = false
if (this.validInput) {
await this.handleSubmitVerify()
dbValidated = this.sliderData.sliders[this.sliderIndex].data.response.isValidInviteCode
}
this.sliderData.setSliderValuesCallback(dbValidated)
},
async handleInput() {
this.sendValidation()
},
async handleInputValid() {
this.sendValidation()
},
isVariablesRequested(variables) {
return (
this.sliderData.sliders[this.sliderIndex].data.request &&
this.sliderData.sliders[this.sliderIndex].data.request.variables &&
this.sliderData.sliders[this.sliderIndex].data.request.variables.code === variables.code
)
},
async handleSubmitVerify() {
const { inviteCode } = this.sliderData.collectedInputData
const variables = { code: inviteCode }
if (!this.isVariablesRequested(variables) && !this.dbRequestInProgress) {
try {
this.dbRequestInProgress = true
const response = await this.$apollo.query({ query: isValidInviteCodeQuery, variables })
this.sliderData.setSliderValuesCallback(null, {
sliderData: {
request: { variables },
response: response.data,
},
})
if (this.sliderData.sliders[this.sliderIndex].data.response) {
if (this.sliderData.sliders[this.sliderIndex].data.response.isValidInviteCode) {
this.$toast.success(
this.$t('components.registration.invite-code.form.validations.success', {
inviteCode,
}),
)
} else {
this.$toast.error(
this.$t('components.registration.invite-code.form.validations.error', {
inviteCode,
}),
)
}
}
} catch (err) {
this.sliderData.setSliderValuesCallback(false, {
sliderData: { response: { isValidInviteCode: false } },
})
const { message } = err
this.$toast.error(message)
} finally {
this.dbRequestInProgress = false
}
}
},
onNextClick() {
return true
},
},
}
</script>
<style lang="scss">
.enter-invite {
display: flex;
flex-direction: column;
margin: $space-large 0 $space-xxx-small 0;
}
</style>