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

Commit

Permalink
Use feature flags to generate settings page list
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdstel committed Nov 21, 2021
1 parent 0c2a083 commit abcea65
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions overwolf/src/AppSettings/AppSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import DiscordButton from '@/DiscordButton';
import { globalLayers } from '@/globalLayers';
import CloseOIcon from '@/Icons/CloseOIcon';
import LanguagePicker from '@/LanguagePicker';
import { canDrawFriends, canDrawMarkers } from '@/logic/featureFlags';
import { SimpleStorageSetting, store } from '@/logic/storage';
import { makeStyles } from '@/theme';
import FriendSettingsPage from './pages/FriendChannelsSettingsPage';
Expand Down Expand Up @@ -180,12 +181,16 @@ const settingsPageMap = {
friendChannels: FriendSettingsPage,
} as const;

const settingsPages: (keyof typeof settingsPageMap)[] = [
'window',
'overlay',
'icon',
'friendChannels',
];
function* getSettingsPages(): Generator<keyof typeof settingsPageMap, void, void> {
yield 'window';
yield 'overlay';
if (canDrawMarkers) {
yield 'icon';
}
if (canDrawFriends) {
yield 'friendChannels';
}
}

export default function AppSettings(props: IProps) {
const {
Expand All @@ -196,6 +201,8 @@ export default function AppSettings(props: IProps) {
const { classes } = useStyles();
const { t } = useTranslation();

const settingsPages = [...getSettingsPages()];

const [currentPage, setCurrentPage] = useState(settingsPages[0]);
const [isPeeking, setIsPeeking] = useState(false);

Expand Down

0 comments on commit abcea65

Please sign in to comment.