Fixed the bug that would cause the wifi name to not hide despite the option being selected.
This commit is contained in:
@@ -3,54 +3,60 @@ import options from "options";
|
|||||||
import { openMenu } from "../utils.js";
|
import { openMenu } from "../utils.js";
|
||||||
|
|
||||||
const Network = () => {
|
const Network = () => {
|
||||||
const wifiIndicator = [
|
const wifiIndicator = [
|
||||||
Widget.Icon({
|
Widget.Icon({
|
||||||
class_name: "bar-network-icon",
|
class_name: "bar-network-icon",
|
||||||
icon: network.wifi.bind("icon_name"),
|
icon: network.wifi.bind("icon_name"),
|
||||||
}),
|
}),
|
||||||
Widget.Label({
|
Widget.Label({
|
||||||
class_name: "bar-network-label",
|
class_name: "bar-network-label",
|
||||||
label: network.wifi
|
label: Utils.merge(
|
||||||
.bind("ssid")
|
[network.bind("wifi"), options.bar.network.label.bind("value")],
|
||||||
.as((ssid) => (ssid ? ` ${ssid}` : " --").substring(0, 7)),
|
(wifi, showLabel) => {
|
||||||
}),
|
if (showLabel) {
|
||||||
];
|
return wifi.ssid ? wifi.ssid.substring(0, 7) : " --";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
const wiredIndicator = [
|
const wiredIndicator = [
|
||||||
Widget.Icon({
|
Widget.Icon({
|
||||||
class_name: "bar-network-icon",
|
class_name: "bar-network-icon",
|
||||||
icon: network.wired.bind("icon_name"),
|
icon: network.wired.bind("icon_name"),
|
||||||
}),
|
}),
|
||||||
Widget.Label({
|
Widget.Label({
|
||||||
class_name: "bar-network-label",
|
class_name: "bar-network-label",
|
||||||
label: Utils.merge(
|
label: Utils.merge(
|
||||||
[network.bind("wired"), options.bar.network.label.bind("value")],
|
[network.bind("wired"), options.bar.network.label.bind("value")],
|
||||||
(_, showLabel) => {
|
(_, showLabel) => {
|
||||||
if (showLabel) {
|
if (showLabel) {
|
||||||
return " Wired";
|
return " Wired";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
},
|
||||||
|
),
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
|
return {
|
||||||
|
component: Widget.Box({
|
||||||
|
vpack: "center",
|
||||||
|
class_name: "bar-network",
|
||||||
|
children: network
|
||||||
|
.bind("primary")
|
||||||
|
.as((w) => (w === "wired" ? wiredIndicator : wifiIndicator)),
|
||||||
|
}),
|
||||||
|
isVisible: true,
|
||||||
|
boxClass: "network",
|
||||||
|
props: {
|
||||||
|
on_primary_click: (clicked, event) => {
|
||||||
|
openMenu(clicked, event, "networkmenu");
|
||||||
|
},
|
||||||
},
|
},
|
||||||
),
|
};
|
||||||
}),
|
|
||||||
];
|
|
||||||
|
|
||||||
return {
|
|
||||||
component: Widget.Box({
|
|
||||||
vpack: "center",
|
|
||||||
class_name: "bar-network",
|
|
||||||
children: network
|
|
||||||
.bind("primary")
|
|
||||||
.as((w) => (w === "wired" ? wiredIndicator : wifiIndicator)),
|
|
||||||
}),
|
|
||||||
isVisible: true,
|
|
||||||
boxClass: "network",
|
|
||||||
props: {
|
|
||||||
on_primary_click: (clicked, event) => {
|
|
||||||
openMenu(clicked, event, "networkmenu");
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export { Network };
|
export { Network };
|
||||||
|
|||||||
Reference in New Issue
Block a user