diff --git a/src/components/Settings/Settings.tsx b/src/components/Settings/Settings.tsx index f5cbddf0..0ef478b9 100644 --- a/src/components/Settings/Settings.tsx +++ b/src/components/Settings/Settings.tsx @@ -7,6 +7,7 @@ import { useAutoAnimate } from "@formkit/auto-animate/react"; import React, { ChangeEvent, Dispatch, SetStateAction, useEffect, useState } from "react"; import { Checkbox, NumberInput, Select, SelectOption } from "../Inputs"; import { settingsAreDefault } from "@/src/utils/utilities"; +import { YoutubePlayerSpeedRates } from "@/src/utils/constants"; export default function Settings({ settings, @@ -191,16 +192,7 @@ export default function Settings({ { label: "4320p", value: "highres" }, { label: "auto", value: "auto" } ].reverse(); - const YouTubePlayerSpeedOptions: SelectOption[] = [ - { label: "0.25", value: "0.25" }, - { label: "0.5", value: "0.5" }, - { label: "0.75", value: "0.75" }, - { label: "1", value: "1" }, - { label: "1.25", value: "1.25" }, - { label: "1.5", value: "1.5" }, - { label: "1.75", value: "1.75" }, - { label: "2", value: "2" } - ]; + const YouTubePlayerSpeedOptions: SelectOption[] = YoutubePlayerSpeedRates.map((rate) => ({ label: rate.toString(), value: rate.toString() })); const ScreenshotFormatOptions: SelectOption[] = [ { label: "PNG", value: "png" }, { label: "JPEG", value: "jpeg" }, diff --git a/src/types.ts b/src/types.ts index 9adf5158..2408eacd 100644 --- a/src/types.ts +++ b/src/types.ts @@ -19,7 +19,8 @@ export type YoutubePlayerQualityLevel = | "hd2880" | "highres" | "auto"; -export type YouTubePlayerSpeedRate = 0.25 | 0.5 | 0.75 | 1 | 1.25 | 1.5 | 1.75 | 2; +export type YouTubePlayerSpeedRateExpanded = 2.25 | 2.5 | 2.75 | 3 | 3.25 | 3.75 | 4; +export type YouTubePlayerSpeedRate = 0.25 | 0.5 | 0.75 | 1 | 1.25 | 1.5 | 1.75 | 2 | YouTubePlayerSpeedRateExpanded; export type ScreenshotType = "file" | "clipboard"; export type ScreenshotFormat = "png" | "jpeg" | "webp"; diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 1877ad55..09468b15 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -40,4 +40,4 @@ export const YoutubePlayerQualityLevels = [ "highres", "auto" ] as const; -export const YoutubePlayerSpeedRates = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2] as const; +export const YoutubePlayerSpeedRates = [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4] as const;