-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display info message regarding wheel zoom
Also renamed Settings component to UserSettings since it is not as tightly linked to Settings in redux as you might expect from the name. Added setting to regret clicking do not display again on wheel zoom info message.
- Loading branch information
1 parent
d3ed396
commit 19f5963
Showing
21 changed files
with
294 additions
and
70 deletions.
There are no files selected for viewing
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
File renamed without changes
5 changes: 5 additions & 0 deletions
5
src/browser/icons/iconsToBeFetchedFromNDL/information-circle.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
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
61 changes: 61 additions & 0 deletions
61
src/browser/modules/D3Visualization/components/WheelZoomInfoOverlay.tsx
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,61 @@ | ||
import React, { ChangeEvent, useState } from 'react' | ||
|
||
import { | ||
StyledZoomInfo, | ||
StyledZoomInfoCheckbox, | ||
StyledZoomInfoCheckboxLabel, | ||
StyledZoomInfoIconContainer, | ||
StyledZoomInfoOverlay, | ||
StyledZoomInfoText, | ||
StyledZoomInfoTextContainer | ||
} from './styled' | ||
import { InfoIcon } from 'browser-components/icons/Icons' | ||
|
||
const getModKeyString = () => { | ||
const isOnMacComputer = navigator.appVersion.indexOf('Mac') !== -1 | ||
if (isOnMacComputer) { | ||
return 'Cmd' | ||
} else { | ||
return 'Ctrl or Shift' | ||
} | ||
} | ||
|
||
type WheelZoomInfoProps = { | ||
hide: boolean | ||
onShouldShowUpdate: (show: boolean) => void | ||
} | ||
export const WheelZoomInfoOverlay = ({ | ||
hide, | ||
onShouldShowUpdate | ||
}: WheelZoomInfoProps) => { | ||
const [doNotShowAgain, setDoNotShowAgain] = useState<boolean>(false) | ||
const handleCheckBoxChange = (event: ChangeEvent<HTMLInputElement>) => { | ||
const doNotShow = event.currentTarget.checked | ||
setDoNotShowAgain(doNotShow) | ||
onShouldShowUpdate(!doNotShow) | ||
} | ||
return ( | ||
<StyledZoomInfoOverlay> | ||
<StyledZoomInfo hide={hide}> | ||
<StyledZoomInfoTextContainer> | ||
<StyledZoomInfoIconContainer> | ||
<InfoIcon /> | ||
</StyledZoomInfoIconContainer> | ||
<StyledZoomInfoText>{`Use ${getModKeyString()} + scroll to zoom`}</StyledZoomInfoText> | ||
</StyledZoomInfoTextContainer> | ||
|
||
<StyledZoomInfoCheckbox> | ||
<input | ||
type="checkbox" | ||
id="wheelZoomInfoCheckbox" | ||
checked={doNotShowAgain} | ||
onChange={handleCheckBoxChange} | ||
/> | ||
<StyledZoomInfoCheckboxLabel htmlFor="wheelZoomInfoCheckbox"> | ||
{`Don't show again`} | ||
</StyledZoomInfoCheckboxLabel> | ||
</StyledZoomInfoCheckbox> | ||
</StyledZoomInfo> | ||
</StyledZoomInfoOverlay> | ||
) | ||
} |
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.