WIP fix values

This commit is contained in:
negue
2023-01-11 22:41:05 +01:00
parent 6fef3d0579
commit 1f16819bc1
3 changed files with 112 additions and 7 deletions
@@ -62,11 +62,7 @@
</h2>
<table class="table">
<tr>
<td colspan="3">
Fix Values TODO
</td>
</tr>
<fix-values-setting />
<class-setting />
<tr>
<td colspan="3">
@@ -120,9 +116,11 @@ import DateFormatSetting from './inlineSettings/dateFormatSetting';
import DayStartAdjustmentSetting from './inlineSettings/dayStartAdjustmentSetting.vue';
import AudioThemeSetting from '@/pages/settings/inlineSettings/audioThemeSetting.vue';
import ClassSetting from '@/pages/settings/inlineSettings/classSetting.vue';
import FixValuesSetting from '@/pages/settings/inlineSettings/fixValuesSetting.vue';
export default {
components: {
FixValuesSetting,
ClassSetting,
AudioThemeSetting,
DayStartAdjustmentSetting,
@@ -0,0 +1,107 @@
<template>
<fragment>
<tr
v-if="!modalVisible"
>
<td class="settings-label">
{{ $t("fixValues") }}
</td>
<td class="settings-value">
</td>
<td class="settings-button">
<a
class="edit-link"
@click.prevent="openModal()"
>
{{ $t('edit') }}
</a>
</td>
</tr>
<tr
v-if="modalVisible"
class="expanded"
>
<td
colspan="3"
novalidate="novalidate"
>
<div
v-once
class="dialog-title"
>
{{ $t("fixValues") }}
</div>
<div
v-once
class="dialog-disclaimer"
>
<span v-html="$t('fixValuesText1')"></span>
<br>
<br>
<span v-html="$t('fixValuesText2')"></span>
</div>
TODO
<save-cancel-buttons
:disable-save="inputsInvalid || true"
@saveClicked="changePassword( passwordUpdates)"
@cancelClicked="requestCloseModal()"
/>
</td>
</tr>
</fragment>
</template>
<style lang="scss" scoped>
@import '~@/assets/scss/colors.scss';
.input-group {
position: relative;
background: white;
}
</style>
<script>
import axios from 'axios';
import SaveCancelButtons from '../components/saveCancelButtons.vue';
import { InlineSettingMixin } from '../components/inlineSettingMixin';
export default {
components: { SaveCancelButtons },
mixins: [InlineSettingMixin],
data () {
return {
passwordUpdates: {
password: '',
newPassword: '',
confirmPassword: '',
},
};
},
computed: {
inputsInvalid () {
if (!this.passwordUpdates.password) {
return true;
}
return this.passwordUpdates.newPassword !== this.passwordUpdates.confirmPassword;
},
},
methods: {
async changePassword (updates) {
await axios.put('/api/v4/user/auth/update-password', updates);
this.passwordUpdates = {};
this.$store.dispatch('snackbars:add', {
title: 'Habitica',
text: this.$t('passwordSuccess'),
type: 'success',
timeout: true,
});
},
},
};
</script>
+2 -2
View File
@@ -93,8 +93,8 @@
"resetDo": "Do it, reset my account!",
"resetComplete": "Reset complete!",
"fixValues": "Fix Values",
"fixValuesText1": "If you've encountered a bug or made a mistake that unfairly changed your character (damage you shouldn't have taken, Gold you didn't really earn, etc.), you can manually correct your numbers here. Yes, this makes it possible to cheat: use this feature wisely, or you'll sabotage your own habit-building!",
"fixValuesText2": "Note that you cannot restore Streaks on individual tasks here. To do that, edit the Daily and go to Advanced Settings, where you will find a Restore Streak field.",
"fixValuesText1": "If you&apos;ve encountered an issue that unfairly changed your character (damage you shouldn&apos;t have taken, Gold you didn&apos;t really earn, etc.), you can manually correct those values here. Yes, this makes it possible to cheat: use this feature wisely, or you&apos;ll sabotage your own habit-building!",
"fixValuesText2": "<b>Note</b>: To restore Streaks on individual Tasks, edit the Task and use the Restore Streak field.",
"fix21Streaks": "21-Day Streaks",
"discardChanges": "Discard Changes",
"deleteDo": "Do it, delete my account!",