Last time joined instance timer

This commit is contained in:
Natsumi
2024-07-17 10:58:56 +12:00
parent e26aed5c6a
commit 85cea30e77
4 changed files with 86 additions and 0 deletions

View File

@@ -1101,6 +1101,39 @@ speechSynthesis.getVoices();
}
});
Vue.component('last-join', {
template:
'<span>' +
'<el-tooltip placement="top" style="margin-left:5px" v-if="lastJoin">' +
'<div slot="content">' +
'<span>{{ $t("dialog.user.info.last_join") }} <timer :epoch="lastJoin"></timer></span>' +
'</div>' +
'<i v-if="lastJoin" class="el-icon el-icon-location-outline" style="display:inline-block"></i>' +
'</el-tooltip>' +
'</span>',
props: {
location: String
},
data() {
return {
lastJoin: this.lastJoin
};
},
methods: {
parse() {
this.lastJoin = $app.instanceJoinHistory.get(this.location);
}
},
watch: {
locationobject() {
this.parse();
}
},
created() {
this.parse();
}
});
Vue.component('instance-info', {
template:
'<div style="display:inline-block;margin-left:5px">' +
@@ -10897,6 +10930,7 @@ speechSynthesis.getVoices();
}
break;
case 'location':
this.addInstanceJoinHistory(this.lastLocation, gameLog.dt);
var worldName = this.replaceBioSymbols(gameLog.worldName);
if (this.isGameRunning) {
this.lastLocationReset(gameLog.dt);
@@ -10916,6 +10950,7 @@ speechSynthesis.getVoices();
this.applyWorldDialogInstances();
this.applyGroupDialogInstances();
}
this.addInstanceJoinHistory(gameLog.location, gameLog.dt);
var L = API.parseLocation(gameLog.location);
var entry = {
created_at: gameLog.dt,
@@ -32919,6 +32954,34 @@ speechSynthesis.getVoices();
// #endregion
// #region instance join history
$app.data.instanceJoinHistory = new Map();
API.$on('LOGIN', function () {
$app.instanceJoinHistory = new Map();
$app.getInstanceJoinHistory();
});
$app.methods.getInstanceJoinHistory = async function () {
this.instanceJoinHistory = await database.getInstanceJoinHistory();
};
$app.methods.addInstanceJoinHistory = function (location, dateTime) {
if (!location || !dateTime) {
return;
}
if (this.instanceJoinHistory.has(location)) {
this.instanceJoinHistory.delete(location);
}
var epoch = new Date(dateTime).getTime();
this.instanceJoinHistory.set(location, epoch);
};
// #endregion
$app = new Vue($app);
window.$app = $app;
})();