diff --git a/package.json b/package.json index 65d97f2e0..0fdda2659 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "stylelint": "^16.8.1", "stylelint-config-standard": "^36.0.1", "ts-patch": "^3.2.1", + "ts-pattern": "^5.3.1", "tsx": "^4.16.5", "type-fest": "^4.23.0", "typescript": "^5.5.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9567475fb..eaa6b537c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -116,6 +116,9 @@ importers: ts-patch: specifier: ^3.2.1 version: 3.2.1 + ts-pattern: + specifier: ^5.3.1 + version: 5.3.1 tsx: specifier: ^4.16.5 version: 4.16.5 @@ -2524,6 +2527,9 @@ packages: resolution: {integrity: sha512-hlR43v+GUIUy8/ZGFP1DquEqPh7PFKQdDMTAmYt671kCCA6AkDQMoeFaFmZ7ObPLYOmpMgyKUqL1C+coFMf30w==} hasBin: true + ts-pattern@5.3.1: + resolution: {integrity: sha512-1RUMKa8jYQdNfmnK4jyzBK3/PS/tnjcZ1CW0v1vWDeYe5RBklc/nquw03MEoB66hVBm4BnlCfmOqDVxHyT1DpA==} + tsconfig-paths@3.15.0: resolution: {integrity: sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==} @@ -5158,6 +5164,8 @@ snapshots: semver: 7.6.3 strip-ansi: 6.0.1 + ts-pattern@5.3.1: {} + tsconfig-paths@3.15.0: dependencies: '@types/json5': 0.0.29 diff --git a/src/plugins/_core/settings.tsx b/src/plugins/_core/settings.tsx index 3cc020836..be220db1a 100644 --- a/src/plugins/_core/settings.tsx +++ b/src/plugins/_core/settings.tsx @@ -64,7 +64,7 @@ export default definePlugin({ replace: (_, sectionTypes, commaOrSemi, elements, element) => `${commaOrSemi} $self.addSettings(${elements}, ${element}, ${sectionTypes}) ${commaOrSemi}` }, { - match: /({(?=.+?function (\i).{0,120}(\i)=\i\.useMemo.{0,30}return \i\.useMemo\(\(\)=>\i\(\3).+?function\(\){return )\2(?=})/, + match: /({(?=.+?function (\i).{0,120}(\i)=\i\.useMemo.{0,60}return \i\.useMemo\(\(\)=>\i\(\3).+?function\(\){return )\2(?=})/, replace: (_, rest, settingsHook) => `${rest}$self.wrapSettingsHook(${settingsHook})` } ] diff --git a/src/plugins/ignoreActivities/index.tsx b/src/plugins/ignoreActivities/index.tsx index bab69d89b..9e6c21bdd 100644 --- a/src/plugins/ignoreActivities/index.tsx +++ b/src/plugins/ignoreActivities/index.tsx @@ -26,6 +26,11 @@ interface IgnoredActivity { type: ActivitiesTypes; } +const enum FilterMode { + Whitelist, + Blacklist +} + const RunningGameStore = findStoreLazy("RunningGameStore"); const ShowCurrentGame = getUserSettingLazy("status", "showCurrentGame")!; @@ -70,14 +75,17 @@ function handleActivityToggle(e: React.MouseEvent if (ignoredActivityIndex === -1) settings.store.ignoredActivities = getIgnoredActivities().concat(activity); else settings.store.ignoredActivities = getIgnoredActivities().filter((_, index) => index !== ignoredActivityIndex); - // Trigger activities recalculation + recalculateActivities(); +} + +function recalculateActivities() { ShowCurrentGame.updateSetting(old => old); } function ImportCustomRPCComponent() { return ( - Import the application id of the CustomRPC plugin to the allowed list + Import the application id of the CustomRPC plugin to the filter list