Explorar o código

ref: made arrowKeySkipBy a slider and go up to 30 instead of 60 seconds

Sv443 hai 7 meses
pai
achega
8b1ad9a015
Modificáronse 2 ficheiros con 15 adicións e 11 borrados
  1. 13 9
      src/config.ts
  2. 2 2
      src/features/index.ts

+ 13 - 9
src/config.ts

@@ -1,4 +1,4 @@
-import { DataStore, compress, type DataMigrationsDict, decompress, type LooseUnion } from "@sv443-network/userutils";
+import { DataStore, compress, type DataMigrationsDict, decompress, type LooseUnion, clamp } from "@sv443-network/userutils";
 import { disableBeforeUnload, featInfo } from "./features/index.js";
 import { compressionSupported, error, getVideoTime, info, log, t } from "./utils/index.js";
 import { emitSiteEvent } from "./siteEvents.js";
@@ -94,14 +94,18 @@ export const migrations: DataMigrationsDict = {
   // TODO(v2.2): set autoLikeChannels to true on migration once feature is fully implemented
 
   // 6 -> 7 (v2.2)
-  7: (oldData: FeatureConfig) => useNewDefaultIfUnchanged(
-    useDefaultConfig(oldData, [
-      "showToastOnGenericError", "sponsorBlockIntegration",
-      "themeSongIntegration", "themeSongLightness",
-    ]), [
-      { key: "toastDuration", oldDefault: 3 },
-    ]
-  ),
+  7: (oldData: FeatureConfig) => {
+    const newData = useNewDefaultIfUnchanged(
+      useDefaultConfig(oldData, [
+        "showToastOnGenericError", "sponsorBlockIntegration",
+        "themeSongIntegration", "themeSongLightness",
+      ]), [
+        { key: "toastDuration", oldDefault: 3 },
+      ]
+    );
+    newData.arrowKeySkipBy = clamp(newData.arrowKeySkipBy, 0.5, 30);
+    return newData;
+  },
 } as const satisfies DataMigrationsDict;
 
 /** Uses the default config as the base, then overwrites all values with the passed {@linkcode baseData}, then sets all passed {@linkcode resetKeys} to their default values */

+ 2 - 2
src/features/index.ts

@@ -474,10 +474,10 @@ export const featInfo = {
     enable: noop,
   },
   arrowKeySkipBy: {
-    type: "number",
+    type: "slider",
     category: "input",
     min: 0.5,
-    max: 60,
+    max: 30,
     step: 0.5,
     default: 5,
     reloadRequired: false,