From 03d90db62090e636419d032646cb8a90ea22fbab Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Thu, 22 Aug 2024 14:57:13 +0200 Subject: [PATCH] feat(waybar): hide groups based on screen size --- src/components/Music/index.tsx | 10 ++ src/components/Responsive.tsx | 31 +++++++ src/components/Waybar/WaybarWidgetGroup.tsx | 2 +- .../Waybar/Widgets/WaybarCPUWidget.tsx | 2 +- .../Waybar/Widgets/WaybarTitleWidget.tsx | 2 +- src/components/Waybar/index.tsx | 91 +++++++++++-------- 6 files changed, 95 insertions(+), 43 deletions(-) create mode 100644 src/components/Responsive.tsx diff --git a/src/components/Music/index.tsx b/src/components/Music/index.tsx index 54048c2..9871492 100644 --- a/src/components/Music/index.tsx +++ b/src/components/Music/index.tsx @@ -3,10 +3,14 @@ import { type IAudioMetadata, parseBlob } from "music-metadata-browser"; import { Kitty } from "../Kitty"; import { SpotifyPlayer } from "./SpotifyPlayer"; import { Cava } from "./Cava"; +import { useApp } from "~/hooks/useApp"; +import { Responsive } from "../Responsive"; const song = "/audio/asinine-vivement-quoi.mp3"; export const Music = () => { + const { volume } = useApp(); + const audio = useRef(null); const [metadata, setMetadata] = useState(); @@ -40,6 +44,12 @@ export const Music = () => { }); }, [metadata]); + useEffect(() => { + if (audio.current) { + audio.current.volume = volume / 400; + } + }, [volume]); + return (
);