From 62b6bd20c5c2225fc47e5d89e3e3d63a029640c2 Mon Sep 17 00:00:00 2001
From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com>
Date: Wed, 26 Mar 2025 21:04:26 +1100
Subject: sidebar: fix dashboard media types

---
 src/modules/sidebar/dashboard.tsx | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'src/modules/sidebar/dashboard.tsx')

diff --git a/src/modules/sidebar/dashboard.tsx b/src/modules/sidebar/dashboard.tsx
index d1d1185..c38d584 100644
--- a/src/modules/sidebar/dashboard.tsx
+++ b/src/modules/sidebar/dashboard.tsx
@@ -58,7 +58,7 @@ const User = () => {
     );
 };
 
-const Media = ({ player }: { player: AstalMpris.Player }) => {
+const Media = ({ player }: { player: AstalMpris.Player | null }) => {
     const position = player
         ? Variable.derive([bind(player, "position"), bind(player, "length")], (p, l) => p / l)
         : Variable(0);
@@ -84,14 +84,14 @@ const Media = ({ player }: { player: AstalMpris.Player }) => {
                         hexpand
                         sensitive={player ? bind(player, "canGoPrevious") : false}
                         cursor="pointer"
-                        onClicked={() => player.next()}
+                        onClicked={() => player?.next()}
                         label="󰒮"
                     />
                     <button
                         hexpand
                         sensitive={player ? bind(player, "canControl") : false}
                         cursor="pointer"
-                        onClicked={() => player.play_pause()}
+                        onClicked={() => player?.play_pause()}
                         label={
                             player
                                 ? bind(player, "playbackStatus").as(s =>
@@ -104,7 +104,7 @@ const Media = ({ player }: { player: AstalMpris.Player }) => {
                         hexpand
                         sensitive={player ? bind(player, "canGoNext") : false}
                         cursor="pointer"
-                        onClicked={() => player.next()}
+                        onClicked={() => player?.next()}
                         label="󰒭"
                     />
                 </box>
-- 
cgit v1.2.3-freya

