From 606acb8ac4a91237de525571bb0f4e3c94733ff3 Mon Sep 17 00:00:00 2001 From: mrjvs Date: Thu, 26 Oct 2023 20:11:31 +0200 Subject: [PATCH] make it possible to show unknown quality when available --- .../player/atoms/settings/QualityView.tsx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/player/atoms/settings/QualityView.tsx b/src/components/player/atoms/settings/QualityView.tsx index 34b97ad8..0ef6010c 100644 --- a/src/components/player/atoms/settings/QualityView.tsx +++ b/src/components/player/atoms/settings/QualityView.tsx @@ -12,6 +12,14 @@ import { } from "@/stores/player/utils/qualities"; import { useQualityStore } from "@/stores/quality"; +const alwaysVisibleQualities: Record = { + unknown: false, + "360": true, + "480": true, + "720": true, + "1080": true, +}; + export function QualityView({ id }: { id: string }) { const router = useOverlayRouter(id); const availableQualities = usePlayerStore((s) => s.qualities); @@ -40,7 +48,11 @@ export function QualityView({ id }: { id: string }) { if (newValue) enableAutomaticQuality(); }, [setAutomaticQuality, autoQuality, enableAutomaticQuality]); - const allVisibleQualities = allQualities.filter((t) => t !== "unknown"); + const visibleQualities = allQualities.filter((quality) => { + if (alwaysVisibleQualities[quality]) return true; + if (availableQualities.includes(quality)) return true; + return false; + }); return ( <> @@ -48,7 +60,7 @@ export function QualityView({ id }: { id: string }) { Quality - {allVisibleQualities.map((v) => ( + {visibleQualities.map((v) => (