mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
Add compact notice display mode
This commit is contained in:
31
index.js
31
index.js
@@ -496,6 +496,7 @@ const defaultSettings = {
|
||||
compressionEveryN: 10,
|
||||
|
||||
// UI 面板
|
||||
noticeDisplayMode: "normal", // normal|compact
|
||||
panelTheme: "crimson", // 面板主题 crimson|cyan|amber|violet
|
||||
};
|
||||
|
||||
@@ -1054,6 +1055,30 @@ function syncStageNoticeAbortAction(stage) {
|
||||
});
|
||||
}
|
||||
|
||||
function getStageNoticeDisplayMode(level = "info") {
|
||||
const configuredMode = getSettings()?.noticeDisplayMode;
|
||||
if (
|
||||
configuredMode === "compact" &&
|
||||
level !== "warning" &&
|
||||
level !== "error"
|
||||
) {
|
||||
return "compact";
|
||||
}
|
||||
return "normal";
|
||||
}
|
||||
|
||||
function refreshVisibleStageNotices() {
|
||||
for (const stage of Object.keys(stageNoticeHandles)) {
|
||||
const handle = stageNoticeHandles[stage];
|
||||
if (!handle || handle.isClosed?.()) continue;
|
||||
const status = getStageUiStatus(stage);
|
||||
if (!status) continue;
|
||||
updateStageNotice(stage, status.text, status.meta, status.level, {
|
||||
title: getStageNoticeTitle(stage),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function updateStageNotice(
|
||||
stage,
|
||||
text,
|
||||
@@ -1069,6 +1094,7 @@ function updateStageNotice(
|
||||
const input = {
|
||||
title,
|
||||
message,
|
||||
displayMode: options.displayMode || getStageNoticeDisplayMode(noticeLevel),
|
||||
level: noticeLevel,
|
||||
busy,
|
||||
persist,
|
||||
@@ -5483,6 +5509,7 @@ function updateModuleSettings(patch = {}) {
|
||||
"hideOldMessagesKeepLastN",
|
||||
]);
|
||||
const recallUiKeys = new Set(["recallCardUserInputDisplayMode"]);
|
||||
const noticeUiKeys = new Set(["noticeDisplayMode"]);
|
||||
const settings = getSettings();
|
||||
Object.assign(settings, patch);
|
||||
extension_settings[MODULE_NAME] = settings;
|
||||
@@ -5543,6 +5570,10 @@ function updateModuleSettings(patch = {}) {
|
||||
schedulePersistedRecallMessageUiRefresh(30);
|
||||
}
|
||||
|
||||
if (Object.keys(patch).some((key) => noticeUiKeys.has(key))) {
|
||||
refreshVisibleStageNotices();
|
||||
}
|
||||
|
||||
scheduleServerSettingsSave();
|
||||
return settings;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user