Files
habitica/website/client/src/components/group-plans/groupPlanCreationModal.vue
Sabe Jones 91b47e56ff Squashed commit of the following:
commit 04fbddfd9a
Author: Sabe Jones <sabe@habitica.com>
Date:   Fri Aug 30 16:55:12 2024 -0500

    fix(groups): remove outdated group FAQ modal

commit a7ffdc9593
Author: Sabe Jones <sabe@habitica.com>
Date:   Fri Aug 30 16:34:03 2024 -0500

    fix(groups): don't spawn Justin during Groups onboarding

commit c8205de6c7
Author: Sabe Jones <sabe@habitica.com>
Date:   Fri Aug 30 16:03:03 2024 -0500

    fix(groups): correct static page account creation flow

commit 700718bd54
Author: Sabe Jones <sabe@habitica.com>
Date:   Fri Aug 23 17:47:28 2024 -0500

    chore(payments): start retiring Amazon Payments

commit 0df75b771a
Author: Sabe Jones <sabe@habitica.com>
Date:   Tue Aug 20 10:34:28 2024 -0500

    fix(groups): don't use DO NOT USE modal

commit aed7ff5f47
Author: Sabe Jones <sabe@habitica.com>
Date:   Mon Aug 19 19:40:46 2024 -0500

    refactor(groups): rearrange some CSS for better semantics

commit fd743265cf
Author: Sabe Jones <sabe@habitica.com>
Date:   Fri Aug 16 18:11:47 2024 -0500

    fix(groups): add missing upgrade workflow pieces

commit ae4469703d
Author: Sabe Jones <sabe@habitica.com>
Date:   Thu Aug 15 10:32:36 2024 -0500

    WIP(groups): style and HTML corrections
    Also workflows for static and non-upgrade logged-in scenarios

commit c6a468dabc
Author: Sabe Jones <sabe@habitica.com>
Date:   Tue Aug 13 10:58:43 2024 -0500

    WIP(groups): refactored and revised landing designs
2024-09-11 15:02:10 -05:00

277 lines
6.0 KiB
Vue

<template>
<b-modal
id="create-group"
:title="$t('createGroupTitle')"
:hide-footer="true"
:hide-header="true"
size="md"
@hide="onHide()"
>
<div class="col-12">
<!-- HEADER -->
<div
class="modal-close"
>
<span
class="cancel-text"
@click="close()"
>
{{ $t('cancel') }}
</span>
<button
class="btn btn-primary next-button"
:value="$t('next')"
:disabled="!newGroupIsReady"
@click="stripeGroup({ group: newGroup })"
>
{{ $t('next') }}
</button>
</div>
<h2>{{ $t('createGroup') }}</h2>
<!-- FORM -->
<div class="form-group">
<lockable-label
:text="$t('nameStar')"
/>
<input
id="new-group-name"
v-model="newGroup.name"
class="form-control input-medium option-content name-input"
required="required"
type="text"
:placeholder="$t('nameStarText')"
>
</div>
<div class="form-group">
<lockable-label
for="new-group-description"
:text="$t('descriptionOptional')"
class="description-label"
/>
<div class="characters-remaining">
{{ $t('charactersRemaining', {characters: charactersRemaining}) }}
</div>
<textarea
id="new-group-description"
v-model="newGroup.description"
class="form-control option-content description-input"
cols="3"
:placeholder="$t('descriptionOptionalText')"
maxlength="250"
></textarea>
</div>
<div class="form-group">
<div class="custom-control custom-checkbox">
<input
id="create-group-leaderOnlyChallenges-checkbox"
v-model="newGroup.leaderOnly.challenges"
class="custom-control-input"
type="checkbox"
>
<label
class="custom-control-label"
for="create-group-leaderOnlyChallenges-checkbox"
>{{ $t('leaderOnlyChallenges') }}</label>
</div>
</div>
<div class="form-group">
<lockable-label
:text="$t('groupUse')"
/>
<select-translated-array
:items="[
'groupParentChildren',
'groupCouple',
'groupFriends',
'groupCoworkers',
'groupManager',
'groupTeacher'
]"
class="group-input"
:placeholder="'groupUseDefault'"
:value="newGroup.demographics"
@select="newGroup.demographics = $event"
/>
</div>
<div class="form-group">
<button
class="btn btn-primary btn-lg btn-block btn-payment"
:disabled="!newGroupIsReady"
@click="stripeGroup({ group: newGroup })"
>
{{ $t('nextPaymentMethod') }}
</button>
</div>
</div>
</b-modal>
</template>
<style lang="scss" scoped>
@import '~@/assets/scss/colors.scss';
h2 {
color: $purple-300;
font-size: 1.25rem;
height: 28px;
width: 120px;
margin-top: 24px;
align-self: center;
}
.cancel-text {
color: $blue-10;
font-size: 0.875rem;
margin-right: 16px;
text-align: center;
cursor: pointer;
}
.next-button {
align-self: center;
}
.form-control::placeholder {
color: $gray-50;
height: 32px;
}
.description-label {
margin-bottom: -24px;
}
.name-input, .description-input, .group-input {
margin-top: -4px;
}
.characters-remaining {
color: $gray-100;
font-size: 0.75rem;
line-height: 1.33;
text-align: right;
margin-bottom: 12px;
}
.description-input {
height: 56px;
}
.spacer {
margin-bottom: 16px !important;
}
.btn-payment {
margin: 24px 112px 24px 112px;
width: 177px;
}
.payments {
padding: 24px;
}
.payment-options {
margin-bottom: 4em;
.purple-box {
background-color: #4f2a93;
color: #fff;
padding: .5em;
border-radius: 8px;
width: 200px;
height: 215px;
.number {
font-size: 60px;
}
.name {
width: 100px;
margin-left: .3em;
}
div {
display: inline-block;
}
}
.box, .purple-box {
display: inline-block;
vertical-align: bottom;
}
}
</style>
<style lang="scss">
@import '~@/assets/scss/mixins.scss';
#create-group {
.modal-dialog {
max-width: 448px;
}
.modal-content {
width: 448px;
max-height: 436px;
border-radius: 8px;
box-shadow: 0 14px 28px 0 rgba(26, 24, 29, 0.24), 0 10px 10px 0 rgba(26, 24, 29, 0.28);
}
.modal-body{
padding: 0px;
margin-left: 12px;
margin-right: 12px;
}
.modal-close {
position: absolute;
right: 16px;
cursor: pointer;
top: 0px;
}
}
</style>
<script>
import paymentsMixin from '../../mixins/payments';
import { mapState } from '@/libs/store';
import selectTranslatedArray from '@/components/tasks/modal-controls/selectTranslatedArray';
import lockableLabel from '@/components/tasks/modal-controls/lockableLabel';
export default {
components: {
selectTranslatedArray,
lockableLabel,
},
mixins: [paymentsMixin],
data () {
return {
newGroup: {
type: 'guild',
privacy: 'private',
name: '',
description: '',
leaderOnly: {
challenges: false,
},
demographics: null,
user: '',
},
type: 'guild',
};
},
computed: {
...mapState({ user: 'user.data' }),
newGroupIsReady () {
return Boolean(this.newGroup.name) && Boolean(this.newGroup.demographics);
},
charactersRemaining () {
const currentLength = this.newGroup.description ? this.newGroup.description.length : 0;
return 250 - currentLength;
},
},
methods: {
close () {
this.$root.$emit('bv::hide::modal', 'create-group');
},
onHide () {
this.sendingInProgress = false;
},
},
};
</script>