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