Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
linuz90 committed Oct 23, 2023
1 parent 78fd0d0 commit ae1d7ec
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
Binary file modified bundle/chrome.zip
Binary file not shown.
Binary file modified bundle/firefox.zip
Binary file not shown.
9 changes: 5 additions & 4 deletions popup/components/sections/NavigationSection.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
KeyUnreadCountBadge,
KeyVerifiedOrgsButton,
KeyXPremiumButton,
defaultPreferences,
} from "../../../storage-keys";
import SectionLabel from "../ui/SectionLabel";

Expand Down Expand Up @@ -171,12 +172,12 @@ const TypefullyGrow = () => (
);

const NavigationSection = () => {
const showLabels = useStorageValue(KeyNavigationButtonsLabels);
const [labelsShown, setLabelsShown] = useState(false);
const initialShowLabels = useStorageValue(KeyNavigationButtonsLabels);
const [labelsShown, setLabelsShown] = useState(defaultPreferences[KeyNavigationButtonsLabels] === "on");

useEffect(() => {
setLabelsShown(showLabels);
}, [showLabels]);
setLabelsShown(initialShowLabels === "on");
}, [initialShowLabels]);

return (
<section className="flex flex-col gap-y-2">
Expand Down
3 changes: 1 addition & 2 deletions popup/components/ui/SwitchControl.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import * as SwitchPrimitive from "@radix-ui/react-switch";
import { styled } from "@stitches/react";

import useStorageKeyState from "../../utilities/useStorageKeyState";

export default function SwitchControl({ label, disabled, storageKey, onChange }) {
const [checked, setChecked, loaded] = useStorageKeyState(storageKey);

return (
<div className={"flex items-center justify-between w-full" + (disabled ? " opacity-50 pointer-events-none" : "")}>
<div className={"flex items-center justify-between w-full" + (disabled ? " opacity-40 pointer-events-none" : "")}>
<label htmlFor={storageKey} className="text-[15px] font-medium">
{label}
</label>
Expand Down
3 changes: 2 additions & 1 deletion popup/utilities/useStorageKeyState.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useRef, useState } from "react";
import { defaultPreferences } from "../../storage-keys";
import { getStorage, setStorage } from "./chromeStorage";

export default function useStorageKeyState(storageKey) {
Expand Down Expand Up @@ -44,7 +45,7 @@ export default function useStorageKeyState(storageKey) {
}

export function useStorageValue(storageKey) {
const [value, setValue] = useState(null);
const [value, setValue] = useState(defaultPreferences[storageKey]);

useEffect(() => {
const getInitialState = async () => {
Expand Down

0 comments on commit ae1d7ec

Please sign in to comment.