mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Remove disabled action icons and use deviceManager default action state
This commit is contained in:
@@ -8,8 +8,6 @@ const ACTION_ICON_DEFAULT_LIGHT = "icons/cast-default-light.svg";
|
|||||||
const ACTION_ICON_CONNECTING_DARK = "icons/cast-connecting-dark.svg";
|
const ACTION_ICON_CONNECTING_DARK = "icons/cast-connecting-dark.svg";
|
||||||
const ACTION_ICON_CONNECTING_LIGHT = "icons/cast-connecting-light.svg";
|
const ACTION_ICON_CONNECTING_LIGHT = "icons/cast-connecting-light.svg";
|
||||||
const ACTION_ICON_CONNECTED = "icons/cast-connected.svg";
|
const ACTION_ICON_CONNECTED = "icons/cast-connected.svg";
|
||||||
const ACTION_ICON_DISABLED_DARK = "icons/cast-disabled-dark.svg";
|
|
||||||
const ACTION_ICON_DISABLED_LIGHT = "icons/cast-disabled-light.svg";
|
|
||||||
|
|
||||||
const isDarkTheme = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
const isDarkTheme = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
||||||
|
|
||||||
@@ -23,13 +21,16 @@ export enum ActionState {
|
|||||||
/** Updates action details depending on given state. */
|
/** Updates action details depending on given state. */
|
||||||
export function updateActionState(state: ActionState, tabId?: number) {
|
export function updateActionState(state: ActionState, tabId?: number) {
|
||||||
let title: string;
|
let title: string;
|
||||||
let path: string;
|
let path = isDarkTheme
|
||||||
|
? ACTION_ICON_DEFAULT_LIGHT
|
||||||
|
: ACTION_ICON_DEFAULT_DARK;
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case ActionState.Default:
|
case ActionState.Default:
|
||||||
title = _("actionTitleDefault");
|
title = _("actionTitleDefault");
|
||||||
path = isDarkTheme
|
break;
|
||||||
? ACTION_ICON_DEFAULT_LIGHT
|
case ActionState.Disabled:
|
||||||
: ACTION_ICON_DEFAULT_DARK;
|
title = _("actionTitleDisabled");
|
||||||
break;
|
break;
|
||||||
case ActionState.Connecting:
|
case ActionState.Connecting:
|
||||||
title = _("actionTitleConnecting");
|
title = _("actionTitleConnecting");
|
||||||
@@ -41,12 +42,6 @@ export function updateActionState(state: ActionState, tabId?: number) {
|
|||||||
title = _("actionTitleConnected");
|
title = _("actionTitleConnected");
|
||||||
path = ACTION_ICON_CONNECTED;
|
path = ACTION_ICON_CONNECTED;
|
||||||
break;
|
break;
|
||||||
case ActionState.Disabled:
|
|
||||||
title = _("actionTitleDisabled");
|
|
||||||
path = isDarkTheme
|
|
||||||
? ACTION_ICON_DISABLED_LIGHT
|
|
||||||
: ACTION_ICON_DISABLED_DARK;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state === ActionState.Disabled) {
|
if (state === ActionState.Disabled) {
|
||||||
@@ -62,8 +57,6 @@ export function updateActionState(state: ActionState, tabId?: number) {
|
|||||||
export function initAction() {
|
export function initAction() {
|
||||||
logger.info("init (action)");
|
logger.info("init (action)");
|
||||||
|
|
||||||
updateActionState(ActionState.Default);
|
|
||||||
|
|
||||||
browser.browserAction.onClicked.addListener(async tab => {
|
browser.browserAction.onClicked.addListener(async tab => {
|
||||||
if (tab.id === undefined) {
|
if (tab.id === undefined) {
|
||||||
logger.error("Tab ID not found in browser action handler.");
|
logger.error("Tab ID not found in browser action handler.");
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="rgba(12, 12, 13, 0.8)" fill-opacity="0.5">
|
|
||||||
<path d="M12 1H4a3 3 0 0 0-3 3v2h2V4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-2v2h2a3 3 0 0 0 3-3V4a3 3 0 0 0-3-3z"/>
|
|
||||||
<path d="M1 15v-2a2 2 0 0 1 2 2H1zM7 15h2a8 8 0 0 0-8-8v2a6 6 0 0 1 6 6z"/>
|
|
||||||
<path d="M1 12a3 3 0 0 1 3 3h2a5 5 0 0 0-5-5z"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 377 B |
@@ -1,5 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="rgba(249, 249, 250, 0.8)" fill-opacity="0.5">
|
|
||||||
<path d="M12 1H4a3 3 0 0 0-3 3v2h2V4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v8a1 1 0 0 1-1 1h-2v2h2a3 3 0 0 0 3-3V4a3 3 0 0 0-3-3z"/>
|
|
||||||
<path d="M1 15v-2a2 2 0 0 1 2 2H1zM7 15h2a8 8 0 0 0-8-8v2a6 6 0 0 1 6 6z"/>
|
|
||||||
<path d="M1 12a3 3 0 0 1 3 3h2a5 5 0 0 0-5-5z"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 380 B |
Reference in New Issue
Block a user