feat: 갱신 버튼 클릭 시 갱신 완료 메시지

This commit is contained in:
2023-03-09 02:20:23 +09:00
parent 6395f73f6a
commit 601163175b
+23 -7
View File
@@ -207,6 +207,7 @@ import { scrollHardTo } from "./util/scrollHardTo";
import MainControlBar from "./components/MainControlBar.vue";
import GlobalMenu from "./components/GlobalMenu.vue";
import GameInfo from "./components/GameInfo.vue";
import { formatDate } from "@vueuse/shared";
const { serverName, serverNick, serverID } = staticValues;
@@ -374,19 +375,23 @@ watch(refreshCounter, async () => {
const recentRecord = response.recentRecord;
const recordIter = [
['flushGeneral', generalRecords, 'general'],
['flushGlobal', globalRecords, 'global'],
['flushHistory', worldHistory, 'history'],
['flushGeneral', generalRecords, 'general', lastGeneralRecordID],
['flushGlobal', globalRecords, 'global', lastGeneralRecordID],
['flushHistory', worldHistory, 'history', lastWorldHistoryID],
] as const;
for(const [flushKey, recordRef, recordKey] of recordIter) {
let haveNewRecord = false;
for(const [flushKey, recordRef, recordKey, lastRecordID] of recordIter) {
if (recentRecord[flushKey]) {
recordRef.value = new Denque<[number, string]>();
}
if (recentRecord[recordKey].length) {
lastGeneralRecordID.value = Math.max(lastGeneralRecordID.value, recentRecord[recordKey][0][0]);
haveNewRecord = true;
}
const subRecord = recentRecord[recordKey];
if (subRecord.length) {
lastRecordID.value = Math.max(lastRecordID.value, subRecord[0][0]);
haveNewRecord = true;
}
while(subRecord.length){
const [id, record] = unwrap(subRecord.pop());
if(!recordRef.value.isEmpty() && id <= unwrap(recordRef.value.get(0))[0]){
@@ -398,6 +403,17 @@ watch(refreshCounter, async () => {
recordRef.value.unshift([id, formatLog(record)]);
}
}
if(haveNewRecord){
toasts.info({
title: '갱신 완료',
body: `동향 변경이 있습니다.`,
});
}
else{
toasts.success({
title: '갱신 완료',
});
}
} catch (e) {
generalInfoLock = false;
console.error(e);