Skip to content

Commit

Permalink
Merge remote-tracking branch 'delta/negue/ui/setting' into negue/ui/s…
Browse files Browse the repository at this point in the history
…etting
  • Loading branch information
CuriousMagpie committed Sep 5, 2023
2 parents 5655a33 + ea8563c commit 962e88a
Show file tree
Hide file tree
Showing 27 changed files with 78 additions and 81 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ import * as quests from '@/../../common/script/content/quests';
import { hasCompletedOnboarding } from '@/../../common/script/libs/onboarding';
import notificationsIcon from '@/assets/svg/notifications.svg';
import MenuDropdown from '../ui/customMenuDropdown';
import MessageCount from './messageCount.vue';
import MessageCount from './messageCount.functional.vue';
import { CONSTANTS, getLocalSetting, setLocalSetting } from '@/libs/userlocalManager';
import successImage from '@/assets/svg/success.svg';
import starBadge from '@/assets/svg/star-badge.svg';
// Notifications
import CARD_RECEIVED from './notifications/cardReceived';
import CHALLENGE_INVITATION from './notifications/challengeInvitation.vue';
import CHALLENGE_INVITATION from './notifications/challengeInvitation.functional.vue';
import GIFT_ONE_GET_ONE from './notifications/g1g1';
import GROUP_TASK_ASSIGNED from './notifications/groupTaskAssigned';
import GROUP_TASK_CLAIMED from './notifications/groupTaskClaimed';
Expand Down
2 changes: 1 addition & 1 deletion website/client/src/components/header/userDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
import { mapState } from '@/libs/store';
import userIcon from '@/assets/svg/user.svg';
import MenuDropdown from '../ui/customMenuDropdown';
import MessageCount from './messageCount.vue';
import MessageCount from './messageCount.functional.vue';
import { EVENTS } from '@/libs/events';
import { PAGES } from '@/libs/consts';
Expand Down
2 changes: 0 additions & 2 deletions website/client/src/components/static/home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -880,8 +880,6 @@ export default {
},
mounted () {
hello.init({
facebook: process.env.FACEBOOK_KEY, // eslint-disable-line
// windows: WINDOWS_CLIENT_ID,
google: process.env.GOOGLE_CLIENT_ID, // eslint-disable-line
});
this.$store.dispatch('common:setTitle', {
Expand Down
4 changes: 0 additions & 4 deletions website/client/src/components/ui/informationIcon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,3 @@ export default {
},
};
</script>

<style scoped>
</style>
29 changes: 16 additions & 13 deletions website/client/src/pages/settings/components/inlineSettingMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@ export const sharedInlineSettingStore = reactive({
export const InlineSettingMixin = {
data () {
return {
// todo before merge use mixinData property
modalVisible: false,
sharedState: sharedInlineSettingStore,
mixinData: {
inlineSettingMixin: {
modalVisible: false,
sharedState: sharedInlineSettingStore,
},
},
};
},
methods: {
openModal () {
if (this.sharedState.inlineSettingAlreadyOpen) {
if (this.sharedState.inlineSettingUnsavedValues) {
if (this.mixinData.inlineSettingMixin.sharedState.inlineSettingAlreadyOpen) {
if (this.mixinData.inlineSettingMixin.sharedState.inlineSettingUnsavedValues) {
if (window.confirm(this.$t('confirmCancelChanges'))) {
this._hidePrevious();
this._openIt();
Expand All @@ -43,22 +46,22 @@ export const InlineSettingMixin = {
this._openIt();
},
_openIt () {
this.sharedState.markAsOpened(this);
this.modalVisible = true;
this.mixinData.inlineSettingMixin.sharedState.markAsOpened(this);
this.mixinData.inlineSettingMixin.modalVisible = true;

this.$el.scrollTo({
behavior: 'smooth',
});
},
_hidePrevious () {
this.sharedState.instanceOfCurrentlyOpened.resetControls();
this.sharedState.instanceOfCurrentlyOpened.closeModal();
this.mixinData.inlineSettingMixin.sharedState.instanceOfCurrentlyOpened.resetControls();
this.mixinData.inlineSettingMixin.sharedState.instanceOfCurrentlyOpened.closeModal();
},
/**
* This is just for the cancel buttons - so that they also ask if there are unchanged values
*/
requestCloseModal () {
if (this.sharedState.inlineSettingUnsavedValues && !window.confirm(this.$t('confirmCancelChanges'))) {
if (this.mixinData.inlineSettingMixin.sharedState.inlineSettingUnsavedValues && !window.confirm(this.$t('confirmCancelChanges'))) {
return;
}

Expand All @@ -69,11 +72,11 @@ export const InlineSettingMixin = {
* This is for the save methods to call it after they are done
*/
closeModal () {
this.modalVisible = false;
this.sharedState.markAsClosed();
this.mixinData.inlineSettingMixin.modalVisible = false;
this.mixinData.inlineSettingMixin.sharedState.markAsClosed();
},
modalValuesChanged (value = true) {
this.sharedState.inlineSettingUnsavedValues = value;
this.mixinData.inlineSettingMixin.sharedState.inlineSettingUnsavedValues = value;
},
resetControls () {},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,26 @@
<script>
export default {
name: 'SaveCancelButtons',
props: ['hideSave', 'hideCancel', 'disableSave', 'primaryButtonLabel', 'primaryButtonColor', 'noPadding'],
props: {
hideSave: {
type: Boolean,
},
hideCancel: {
type: Boolean,
},
disableSave: {
type: Boolean,
},
noPadding: {
type: Boolean,
},
primaryButtonLabel: {
type: String,
},
primaryButtonColor: {
type: String,
},
},
};
</script>
Expand Down
12 changes: 3 additions & 9 deletions website/client/src/pages/settings/promoCode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
>
<input
v-model="couponCode"
class="form-control"
class="form-control w-100"
type="text"
:placeholder="$t('promoPlaceholder')"
>
Expand All @@ -41,15 +41,15 @@
<div class="form-group">
<input
v-model="codes.event"
class="form-control"
class="form-control w-100"
type="text"
placeholder="Event code (eg, 'wondercon')"
>
</div>
<div class="form-group">
<input
v-model="codes.count"
class="form-control"
class="form-control w-100"
type="number"
placeholder="Number of codes to generate (eg, 250)"
>
Expand All @@ -74,12 +74,6 @@
</div>
</template>

<style scoped>
.form-control {
width: 100%;
}
</style>

<script>
import axios from 'axios';
import { mapState } from '@/libs/store';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<fragment>
<tr
v-if="!modalVisible"
v-if="!mixinData.inlineSettingMixin.modalVisible"
>
<td
v-once
Expand All @@ -22,7 +22,7 @@
</td>
</tr>
<tr
v-if="modalVisible"
v-if="mixinData.inlineSettingMixin.modalVisible"
class="expanded"
>
<td colspan="3">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<fragment v-if="allowedToChangeClass">
<tr
v-if="!modalVisible"
v-if="!mixinData.inlineSettingMixin.modalVisible"
>
<td class="settings-label">
{{ $t("changeClassSetting") }}
Expand All @@ -22,7 +22,7 @@
</td>
</tr>
<tr
v-if="modalVisible"
v-if="mixinData.inlineSettingMixin.modalVisible"
class="expanded"
>
<td colspan="3">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<fragment>
<tr
v-if="!modalVisible"
v-if="!mixinData.inlineSettingMixin.modalVisible"
>
<td class="settings-label">
{{ $t("dateFormat") }}
Expand All @@ -19,7 +19,7 @@
</td>
</tr>
<tr
v-if="modalVisible"
v-if="mixinData.inlineSettingMixin.modalVisible"
class="expanded"
>
<td colspan="3">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<fragment>
<tr
v-if="!modalVisible"
v-if="!mixinData.inlineSettingMixin.modalVisible"
>
<td class="settings-label">
{{ $t("dayStartAdjustment") }}
Expand All @@ -19,7 +19,7 @@
</td>
</tr>
<tr
v-if="modalVisible"
v-if="mixinData.inlineSettingMixin.modalVisible"
class="expanded"
>
<td colspan="3">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<fragment>
<tr
v-if="!modalVisible"
v-if="!mixinData.inlineSettingMixin.modalVisible"
>
<td class="settings-label">
{{ $t("deleteAccount") }}
Expand All @@ -18,7 +18,7 @@
</td>
</tr>
<tr
v-if="modalVisible"
v-if="mixinData.inlineSettingMixin.modalVisible"
class="expanded"
>
<td colspan="3">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<fragment>
<tr
v-if="!modalVisible"
v-if="!mixinData.inlineSettingMixin.modalVisible"
>
<td class="settings-label">
{{ $t("displayName") }}
Expand All @@ -19,7 +19,7 @@
</td>
</tr>
<tr
v-if="modalVisible"
v-if="mixinData.inlineSettingMixin.modalVisible"
class="expanded"
>
<td colspan="3">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<fragment>
<tr
v-if="!modalVisible"
v-if="!mixinData.inlineSettingMixin.modalVisible"
>
<td class="settings-label">
{{ $t("fixValues") }}
Expand All @@ -18,7 +18,7 @@
</td>
</tr>
<tr
v-if="modalVisible"
v-if="mixinData.inlineSettingMixin.modalVisible"
class="expanded"
>
<td
Expand Down Expand Up @@ -76,7 +76,7 @@
</div>

<save-cancel-buttons
:disable-save="!sharedState.inlineSettingUnsavedValues"
:disable-save="!mixinData.inlineSettingMixin.sharedState.inlineSettingUnsavedValues"
class="mt-4"
@saveClicked="save()"
@cancelClicked="requestCloseModal()"
Expand Down Expand Up @@ -241,10 +241,6 @@ export default {
this.restoreValues.exp = 0;
}
// todo
// this.user.stats = clone(this.restoreValues.stats);
// this.user.achievements.streak = clone(this.restoreValues.achievements.streak);
const settings = {
'stats.hp': Number(this.restoreValues.hp),
'stats.exp': Number(this.restoreValues.exp),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<fragment>
<tr
v-if="!modalVisible"
v-if="!mixinData.inlineSettingMixin.modalVisible"
>
<td class="settings-label">
{{ $t("language") }}
Expand All @@ -19,7 +19,7 @@
</td>
</tr>
<tr
v-if="modalVisible"
v-if="mixinData.inlineSettingMixin.modalVisible"
class="expanded"
>
<td colspan="3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export default {
});
hello.init({
facebook: process.env.FACEBOOK_KEY, // eslint-disable-line no-process-env
google: process.env.GOOGLE_CLIENT_ID, // eslint-disable-line no-process-env
}, {
redirect_uri: '', // eslint-disable-line
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<fragment>
<tr
v-if="!modalVisible"
v-if="!mixinData.inlineSettingMixin.modalVisible"
>
<td class="settings-label">
{{ $t("password") }}
Expand All @@ -17,7 +17,7 @@
</td>
</tr>
<tr
v-if="modalVisible"
v-if="mixinData.inlineSettingMixin.modalVisible"
class="expanded"
>
<td
Expand Down Expand Up @@ -111,10 +111,6 @@ input {
color: $green-50;
}
.form-group {
margin-bottom: 1.5rem;
}
</style>

<script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<fragment>
<tr
v-if="!modalVisible"
v-if="!mixinData.inlineSettingMixin.modalVisible"
>
<td class="settings-label">
{{ $t("resetAccount") }}
Expand All @@ -19,7 +19,7 @@
</td>
</tr>
<tr
v-if="modalVisible"
v-if="mixinData.inlineSettingMixin.modalVisible"
class="expanded"
>
<td colspan="3">
Expand Down
Loading

0 comments on commit 962e88a

Please sign in to comment.