Skip to content

Commit

Permalink
refactor: hide Open At Login in Settings on Linux machines
Browse files Browse the repository at this point in the history
since Electron doesn't support open at login on Linux machines
  • Loading branch information
roldanjr committed Jul 3, 2023
1 parent 5d754cc commit 74f2f09
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
4 changes: 3 additions & 1 deletion app/renderer/src/components/Toggler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ export type TogglerProps = {
onChange?:
| ((event: React.ChangeEvent<HTMLInputElement>) => void)
| undefined;
style?: React.CSSProperties;
};

const Toggler: React.FC<TogglerProps> = ({
id,
label,
checked,
onChange,
style,
}) => {
return (
<StyledTogglerWrapper>
<StyledTogglerWrapper style={style}>
<StyledTogglerLabel htmlFor={id}>{label}</StyledTogglerLabel>
<StyledTogglerSwitch
type="checkbox"
Expand Down
27 changes: 18 additions & 9 deletions app/renderer/src/routes/Settings/FeatureSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Toggler, TogglerProps, Collapse, Radio } from "components";
import { ThemeContext } from "contexts";

import SettingSection from "./SettingSection";
import { detectOS } from "utils";

const FeatureSection: React.FC = () => {
const settings: SettingTypes = useSelector(
Expand Down Expand Up @@ -134,6 +135,11 @@ const FeatureSection: React.FC = () => {
onChange: useCallback(() => {
dispatch(setOpenAtLogin(!settings.openAtLogin));
}, [dispatch, settings.openAtLogin]),
style: {
...(detectOS() === "Linux" && {
display: "none",
}),
},
},
];

Expand All @@ -146,15 +152,18 @@ const FeatureSection: React.FC = () => {

return (
<SettingSection heading="App Features">
{featureList.map(({ id, label, checked, onChange }, index) => (
<Toggler
id={id}
label={label}
checked={checked}
onChange={onChange}
key={index}
/>
))}
{featureList.map(
({ id, label, checked, onChange, ...rest }, index) => (
<Toggler
id={id}
key={index}
label={label}
checked={checked}
onChange={onChange}
{...rest}
/>
)
)}
<Collapse>
<Radio
id="none"
Expand Down

0 comments on commit 74f2f09

Please sign in to comment.