-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1710: Start using modern Redux
- Loading branch information
Showing
13 changed files
with
191 additions
and
97 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import React from "react"; | ||
import { useSelector } from "react-redux"; | ||
import { useAppDispatch } from "../../hooks"; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import Toggle from "./toggle"; | ||
import { togglePanelDisplay } from "../../actions/panelDisplay"; | ||
import { RootState } from "../../store"; | ||
|
||
export default function PanelToggles() { | ||
const dispatch = useAppDispatch(); | ||
const { t } = useTranslation(); | ||
|
||
const panelsAvailable = useSelector((state: RootState) => state.controls.panelsAvailable); | ||
const panelsToDisplay = useSelector((state: RootState) => state.controls.panelsToDisplay); | ||
const showTreeToo = useSelector((state: RootState) => state.controls.showTreeToo); | ||
|
||
const panels = panelsAvailable.slice(); | ||
if (showTreeToo && panels.indexOf("map") !== -1) { | ||
panels.splice(panels.indexOf("map"), 1); | ||
} | ||
return <> | ||
{panels.map((n) => ( | ||
<Toggle | ||
key={n} | ||
display | ||
on={panelsToDisplay.indexOf(n) !== -1} | ||
callback={() => dispatch(togglePanelDisplay(n))} | ||
label={t("sidebar:Show " + n)} | ||
style={{ paddingBottom: "10px" }} | ||
/> | ||
))} | ||
</> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux' | ||
import type { RootState, AppDispatch } from './store' | ||
|
||
|
||
export const useAppDispatch: () => AppDispatch = useDispatch | ||
export const useAppSelector: TypedUseSelectorHook<RootState> = useSelector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.