mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 07:07:35 +01:00
improve updating UI when time traveling
This commit is contained in:
committed by
Sabe Jones
parent
593524905e
commit
962456204e
@@ -291,7 +291,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="ENABLE_TIME_TRAVEL && user.permissions.fullAccess">
|
v-if="ENABLE_TIME_TRAVEL && user.permissions.fullAccess"
|
||||||
|
:key="lastTimeJump">
|
||||||
<a
|
<a
|
||||||
class="btn btn-secondary mr-1"
|
class="btn btn-secondary mr-1"
|
||||||
@click="jumpTime(-1)">-1 Day</a>
|
@click="jumpTime(-1)">-1 Day</a>
|
||||||
@@ -302,7 +303,7 @@
|
|||||||
class="btn btn-secondary mr-1"
|
class="btn btn-secondary mr-1"
|
||||||
@click="jumpTime(-30)">-30 Days</a>
|
@click="jumpTime(-30)">-30 Days</a>
|
||||||
<div class="my-2">
|
<div class="my-2">
|
||||||
Time Traveling! It is {{ new Date().toLocaleString() }}
|
Time Traveling! It is {{ new Date().toLocaleDateString() }}
|
||||||
</div>
|
</div>
|
||||||
<a
|
<a
|
||||||
class="btn btn-secondary mr-1"
|
class="btn btn-secondary mr-1"
|
||||||
@@ -832,6 +833,7 @@ export default {
|
|||||||
debugMenuShown: false,
|
debugMenuShown: false,
|
||||||
IS_PRODUCTION,
|
IS_PRODUCTION,
|
||||||
ENABLE_TIME_TRAVEL,
|
ENABLE_TIME_TRAVEL,
|
||||||
|
lastTimeJump: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -895,12 +897,12 @@ export default {
|
|||||||
},
|
},
|
||||||
async jumpTime (amount) {
|
async jumpTime (amount) {
|
||||||
const response = await axios.post('/api/v4/debug/jump-time', { offsetDays: amount });
|
const response = await axios.post('/api/v4/debug/jump-time', { offsetDays: amount });
|
||||||
console.log(response.data.data);
|
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
Vue.config.clock.jump(amount * 24 * 60 * 60 * 1000);
|
Vue.config.clock.jump(amount * 24 * 60 * 60 * 1000);
|
||||||
} else {
|
} else {
|
||||||
Vue.config.clock.setSystemTime(moment().add(amount, 'days').toDate());
|
Vue.config.clock.setSystemTime(moment().add(amount, 'days').toDate());
|
||||||
}
|
}
|
||||||
|
this.lastTimeJump = response.data.data.time;
|
||||||
},
|
},
|
||||||
addExp () {
|
addExp () {
|
||||||
// @TODO: Name these variables better
|
// @TODO: Name these variables better
|
||||||
|
|||||||
Reference in New Issue
Block a user