From 33eb76b84dba8b0ee79b0af6370d157caff544a4 Mon Sep 17 00:00:00 2001 From: hensm Date: Wed, 24 Aug 2022 06:18:35 +0100 Subject: [PATCH] Hide cast buttons when no media types are available --- ext/src/ui/popup/Popup.svelte | 6 ++++-- ext/src/ui/popup/Receiver.svelte | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/ext/src/ui/popup/Popup.svelte b/ext/src/ui/popup/Popup.svelte index f01c8da..feab0d6 100644 --- a/ext/src/ui/popup/Popup.svelte +++ b/ext/src/ui/popup/Popup.svelte @@ -171,8 +171,8 @@ if (browserWindow?.id === undefined) return; browser.windows.update(browserWindow.id, { height: Math.ceil( - (document.body.clientHeight + - (window.outerHeight - window.innerHeight)) + document.body.clientHeight + + (window.outerHeight - window.innerHeight) ) }); } @@ -417,6 +417,8 @@ {port} {device} {isMediaTypeAvailable} + isAnyMediaTypeAvailable={availableMediaTypes !== + ReceiverSelectorMediaType.None} isAnyConnecting={isConnecting} on:cast={ev => onReceiverCast(ev.detail.device)} on:stop={ev => onReceiverStop(ev.detail.device)} diff --git a/ext/src/ui/popup/Receiver.svelte b/ext/src/ui/popup/Receiver.svelte index 9868b88..0a878ac 100644 --- a/ext/src/ui/popup/Receiver.svelte +++ b/ext/src/ui/popup/Receiver.svelte @@ -23,6 +23,8 @@ export let isAnyConnecting: boolean; /** Whether the selected media type is available for this receiver. */ export let isMediaTypeAvailable: boolean; + /** Whether any media types are available for this receiver. */ + export let isAnyMediaTypeAvailable: boolean; /** Receiver device to display. */ export let device: ReceiverDevice; @@ -98,7 +100,7 @@ > {_("popupStopButtonTitle")} - {:else} + {:else if isAnyMediaTypeAvailable}