Skip to content
This repository has been archived by the owner on Aug 14, 2024. It is now read-only.

Fixing Flight Mode #803

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/components/taskbar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,25 @@ const Taskbar = () => {
dispatch({ type: "TASKPHIDE" });
};

const [conectivityToggle, setConectivityToggle] = useState("wifi");
const sidepane = useSelector((state) => state.sidepane);

useEffect(() => {
const wifi = document.querySelector('[data-payload="network.wifi.state"]');
let wifiState = wifi.getAttribute('data-state');

if (sidepane.quicks[2].ui === false) {
setConectivityToggle("airplane");
wifiState = "false";
} else {
setConectivityToggle("wifi");
wifiState = "true";
}

// Update the data-state attribute of the wifi element
wifi.setAttribute('data-state', wifiState);
}, [sidepane.quicks[2].ui]);

const clickDispatch = (event) => {
var action = {
type: event.target.dataset.action,
Expand Down Expand Up @@ -143,7 +162,7 @@ const Taskbar = () => {
onClick={clickDispatch}
data-action="PANETOGG"
>
<Icon className="taskIcon" src="wifi" ui width={16} />
<Icon className="taskIcon" src={conectivityToggle} ui width={16} />
<Icon
className="taskIcon"
src={"audio" + tasks.audio}
Expand Down
4 changes: 4 additions & 0 deletions src/reducers/sidepane.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ const paneReducer = (state = defState, action) => {
var tmpState = { ...state };
tmpState.quicks[4].src = action.payload;
return tmpState;
} else if (action.type == "STNGTOGG" && action.payload === "network.airplane") {
var tmpState = { ...state };
tmpState.quicks[2].ui = !tmpState.quicks[2].ui;
return tmpState;
} else if (action.type == "BANDTOGG") {
return { ...state, banhide: !state.banhide };
} else if (action.type == "BANDHIDE") {
Expand Down
3 changes: 2 additions & 1 deletion src/utils/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ const apps = [
{
name: "Blue",
icon: "win/user",
type: "short",
type: "app",
action: "EXPLORER",
},
{
name: "Alarms",
Expand Down