diff --git a/frontend/__tests__/root/config-metadata.spec.ts b/frontend/__tests__/root/config-metadata.spec.ts index d8db8f348d75..ea60ec416152 100644 --- a/frontend/__tests__/root/config-metadata.spec.ts +++ b/frontend/__tests__/root/config-metadata.spec.ts @@ -163,6 +163,19 @@ describe("ConfigMeta", () => { { value: false, given: { tapeMode: "word" } }, { value: true, given: { tapeMode: "word" }, fail: true }, ], + monkey: [ + { value: false, given: { liveSpeedStyle: "text" } }, + { value: true, given: { liveSpeedStyle: "text" }, fail: true }, + { value: true, given: { liveAccStyle: "text" }, fail: true }, + ], + liveSpeedStyle: [ + { value: "mini", given: { monkey: true } }, + { value: "text", given: { monkey: true }, fail: true }, + ], + liveAccStyle: [ + { value: "mini", given: { monkey: true } }, + { value: "text", given: { monkey: true }, fail: true }, + ], }; it.for( diff --git a/frontend/__tests__/root/config.spec.ts b/frontend/__tests__/root/config.spec.ts index d8c881e5588f..fd3572b135b2 100644 --- a/frontend/__tests__/root/config.spec.ts +++ b/frontend/__tests__/root/config.spec.ts @@ -109,6 +109,28 @@ describe("Config", () => { expect(Config.setConfig("showAllLines", true)).toBe(false); }); + it("shows a notice when monkey conflicts with live text stats", () => { + //GIVEN + replaceConfig({ liveSpeedStyle: "text", monkey: false }); + + //WHEN / THEN + expect(Config.setConfig("monkey", true)).toBe(false); + expect(notificationAddMock).toHaveBeenCalledWith( + "Monkey can't be enabled while live speed or live accuracy is set to text.", + ); + }); + + it("shows a notice when live speed text conflicts with monkey", () => { + //GIVEN + replaceConfig({ monkey: true, liveSpeedStyle: "off" }); + + //WHEN / THEN + expect(Config.setConfig("liveSpeedStyle", "text")).toBe(false); + expect(notificationAddMock).toHaveBeenCalledWith( + "Live speed can't be set to text while monkey is enabled.", + ); + }); + it("should use overrideValue", () => { //WHEN Config.setConfig("customLayoutfluid", ["3l", "ABNT2", "3l"]); diff --git a/frontend/src/ts/config/metadata.ts b/frontend/src/ts/config/metadata.ts index 481faf990236..7e53f5e9c6da 100644 --- a/frontend/src/ts/config/metadata.ts +++ b/frontend/src/ts/config/metadata.ts @@ -620,6 +620,15 @@ export const configMetadata: ConfigMetadataObject = { displayString: "live speed style", changeRequiresRestart: false, group: "appearance", + isBlocked: ({ value, currentConfig }) => { + if (value === "text" && currentConfig.monkey) { + showNoticeNotification( + "Live speed can't be set to text while monkey is enabled.", + ); + return true; + } + return false; + }, }, liveAccStyle: { key: "liveAccStyle", @@ -627,6 +636,15 @@ export const configMetadata: ConfigMetadataObject = { displayString: "live accuracy style", changeRequiresRestart: false, group: "appearance", + isBlocked: ({ value, currentConfig }) => { + if (value === "text" && currentConfig.monkey) { + showNoticeNotification( + "Live accuracy can't be set to text while monkey is enabled.", + ); + return true; + } + return false; + }, }, liveBurstStyle: { key: "liveBurstStyle", @@ -1005,6 +1023,19 @@ export const configMetadata: ConfigMetadataObject = { displayString: "monkey", changeRequiresRestart: false, group: "hidden", + isBlocked: ({ value, currentConfig }) => { + if ( + value && + (currentConfig.liveSpeedStyle === "text" || + currentConfig.liveAccStyle === "text") + ) { + showNoticeNotification( + "Monkey can't be enabled while live speed or live accuracy is set to text.", + ); + return true; + } + return false; + }, }, monkeyPowerLevel: { key: "monkeyPowerLevel",