diff --git a/hwe/ts/PageFront.vue b/hwe/ts/PageFront.vue index e30c644c..9bca2a15 100644 --- a/hwe/ts/PageFront.vue +++ b/hwe/ts/PageFront.vue @@ -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);