sidebar: fix dashboard media types

This commit is contained in:
2 * r + 2 * t 2025-03-26 21:04:26 +11:00
parent 8772a05a90
commit 62b6bd20c5
2 changed files with 5 additions and 5 deletions

View file

@ -120,7 +120,7 @@
} }
} }
.media { .dashboard .media {
@include lib.spacing(15); @include lib.spacing(15);
.cover-art { .cover-art {

View file

@ -58,7 +58,7 @@ const User = () => {
); );
}; };
const Media = ({ player }: { player: AstalMpris.Player }) => { const Media = ({ player }: { player: AstalMpris.Player | null }) => {
const position = player const position = player
? Variable.derive([bind(player, "position"), bind(player, "length")], (p, l) => p / l) ? Variable.derive([bind(player, "position"), bind(player, "length")], (p, l) => p / l)
: Variable(0); : Variable(0);
@ -84,14 +84,14 @@ const Media = ({ player }: { player: AstalMpris.Player }) => {
hexpand hexpand
sensitive={player ? bind(player, "canGoPrevious") : false} sensitive={player ? bind(player, "canGoPrevious") : false}
cursor="pointer" cursor="pointer"
onClicked={() => player.next()} onClicked={() => player?.next()}
label="󰒮" label="󰒮"
/> />
<button <button
hexpand hexpand
sensitive={player ? bind(player, "canControl") : false} sensitive={player ? bind(player, "canControl") : false}
cursor="pointer" cursor="pointer"
onClicked={() => player.play_pause()} onClicked={() => player?.play_pause()}
label={ label={
player player
? bind(player, "playbackStatus").as(s => ? bind(player, "playbackStatus").as(s =>
@ -104,7 +104,7 @@ const Media = ({ player }: { player: AstalMpris.Player }) => {
hexpand hexpand
sensitive={player ? bind(player, "canGoNext") : false} sensitive={player ? bind(player, "canGoNext") : false}
cursor="pointer" cursor="pointer"
onClicked={() => player.next()} onClicked={() => player?.next()}
label="󰒭" label="󰒭"
/> />
</box> </box>