Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/CameraControls/CameraHomeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const CameraHomeButton: React.FC<CameraHomeButtonProps> = ({
tooltipText={"Home view (H)"}
tooltipPlacement="left"
icon={getIconGlyphClasses(IconGlyphs.Reset)}
clickHandler={resetCamera}
onClick={resetCamera}
/>
);
};
Expand Down
14 changes: 7 additions & 7 deletions src/components/CameraControls/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ const CameraControls = ({
tooltipText="Zoom in ( &uarr; )"
tooltipPlacement="left"
icon={ZoomIn}
clickHandler={zoomIn}
onClick={zoomIn}
/>
<ViewportButton
tooltipText="Zoom out ( &darr; )"
tooltipPlacement="left"
icon={ZoomOut}
clickHandler={zoomOut}
onClick={zoomOut}
/>
</div>
<div className={styles.radioGroup}>
Expand All @@ -176,23 +176,23 @@ const CameraControls = ({
tooltipPlacement="left"
icon={getIconGlyphClasses(IconGlyphs.Rotate)}
radioGroupPosition={"top"}
clickHandler={() => setMode(ROTATE)}
onClick={() => setMode(ROTATE)}
active={mode === ROTATE}
/>
<ViewportButton
tooltipText={mode === PAN ? "Pan" : "Pan (hold SHIFT)"}
tooltipPlacement="left"
icon={getIconGlyphClasses(IconGlyphs.Pan)}
radioGroupPosition={"bottom"}
clickHandler={() => setMode(PAN)}
onClick={() => setMode(PAN)}
active={mode === PAN}
/>
</div>
<ViewportButton
tooltipText={"Focus (F)"}
tooltipPlacement="left"
icon={getIconGlyphClasses(IconGlyphs.Focus)}
clickHandler={() => {
onClick={() => {
saveFocusMode(!isFocused);
}}
active={isFocused}
Expand All @@ -203,7 +203,7 @@ const CameraControls = ({
tooltipPlacement="left"
icon={getIconGlyphClasses(IconGlyphs.Orthographic)}
radioGroupPosition={"top"}
clickHandler={() => {
onClick={() => {
setCameraProjectionType(ORTHOGRAPHIC);
}}
active={cameraProjectionType === ORTHOGRAPHIC}
Expand All @@ -213,7 +213,7 @@ const CameraControls = ({
tooltipPlacement="left"
icon={getIconGlyphClasses(IconGlyphs.Perspective)}
radioGroupPosition={"bottom"}
clickHandler={() => {
onClick={() => {
setCameraProjectionType(PERSPECTIVE);
}}
active={cameraProjectionType === PERSPECTIVE}
Expand Down
2 changes: 1 addition & 1 deletion src/components/CustomDropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const CustomDropdown: React.FC<CustomDropdownProps> = ({
titleText={titleText}
icon={icon}
buttonType={buttonType}
clickHandler={buttonClickHandler}
onClick={buttonClickHandler}
onKeyDown={handleKeyDown}
onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeaveWithDelay}
Expand Down
2 changes: 1 addition & 1 deletion src/components/DownloadTrajectoryMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const DownloadTrajectoryMenu = ({
<NavButtonWithTooltip
titleText="Download"
icon={Download}
clickHandler={downloadFile}
onClick={downloadFile}
isDisabled={isDisabled}
tooltipText={{
default: "Download trajectory",
Expand Down
2 changes: 1 addition & 1 deletion src/components/HelpMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const HelpMenu = (): JSX.Element => {
label: (
<NavButton
titleText={"Version info"}
clickHandler={() => {
onClick={() => {
setModalVisible(!modalVisible);
}}
buttonType={ButtonClass.DropdownItem}
Expand Down
2 changes: 1 addition & 1 deletion src/components/LoadFileMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const LoadFileMenu = ({
label: (
<NavButton
titleText={"Simularium file"}
clickHandler={showModal}
onClick={showModal}
buttonType={ButtonClass.DropdownItem}
/>
),
Expand Down
5 changes: 2 additions & 3 deletions src/components/NavButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export interface NavButtonProps extends ButtonProps {
titleText?: string;
buttonType?: string;
icon?: ReactNode;
clickHandler?: () => void;
isDisabled?: boolean;
}

Expand All @@ -19,7 +18,7 @@ const NavButton = forwardRef<HTMLButtonElement, NavButtonProps>(
titleText,
buttonType = ButtonClass.Action,
icon,
clickHandler,
onClick,
isDisabled,
...props
},
Expand All @@ -37,7 +36,7 @@ const NavButton = forwardRef<HTMLButtonElement, NavButtonProps>(
{...props}
ref={ref}
className={buttonClassNames}
onClick={!isDisabled ? clickHandler : undefined}
onClick={!isDisabled ? onClick : undefined}
>
{titleText} {icon}
</Button>
Expand Down
6 changes: 3 additions & 3 deletions src/components/NavButtonWithTooltip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const NavButtonWithTooltip: React.FC<NavButtonWithTooltipProps> = ({
tooltipPlacement,
buttonType,
icon,
clickHandler,
onClick,
isDisabled = false,
...props
}) => {
Expand Down Expand Up @@ -53,7 +53,7 @@ const NavButtonWithTooltip: React.FC<NavButtonWithTooltipProps> = ({
icon,
buttonType,
isDisabled,
clickHandler,
onClick,
onMouseEnter,
onMouseLeave,
};
Expand All @@ -69,7 +69,7 @@ const NavButtonWithTooltip: React.FC<NavButtonWithTooltipProps> = ({
trigger={["hover", "focus"]}
open={tooltipVisible}
>
<NavButton {...navButtonProps} onClick={clickHandler} />
<NavButton {...navButtonProps} onClick={onClick} />
</Tooltip>
);
};
Expand Down
8 changes: 4 additions & 4 deletions src/components/PlaybackControls/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const PlayBackControls = ({
tooltipText={isPlaying ? "Pause" : "Play"}
tooltipPlacement="top"
icon={isPlaying ? Pause : Play}
clickHandler={isPlaying ? pauseHandler : playHandler}
onClick={isPlaying ? () => pauseHandler() : () => playHandler()}
disabled={loading || isEmpty}
loading={loading}
/>
Expand Down Expand Up @@ -169,7 +169,7 @@ const PlayBackControls = ({
tooltipText="Skip 1 frame back"
tooltipPlacement="top"
icon={getIconGlyphClasses(IconGlyphs.StepBack)}
clickHandler={prevHandler}
onClick={prevHandler}
disabled={isStepBackDisabled || loading || isEmpty}
loading={loading}
/>
Expand All @@ -178,7 +178,7 @@ const PlayBackControls = ({
tooltipText="Skip 1 frame ahead"
tooltipPlacement="top"
icon={getIconGlyphClasses(IconGlyphs.StepForward)}
clickHandler={nextHandler}
onClick={nextHandler}
disabled={isStepForwardDisabled || loading || isEmpty}
loading={loading}
/>
Expand All @@ -204,7 +204,7 @@ const PlayBackControls = ({
tooltipText={isLooping ? "Turn off looping" : "Turn on looping"}
tooltipPlacement="top"
icon={getIconGlyphClasses(IconGlyphs.Loop)}
clickHandler={loopHandler}
onClick={loopHandler}
disabled={isEmpty}
active={isLooping}
loading={loading}
Expand Down
2 changes: 1 addition & 1 deletion src/components/RecordMoviesComponent/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const RecordMovieComponent = (props: RecordMovieComponentProps) => {
tooltipWhenDisabled={true}
tooltipText={getTooltipText()}
icon={getIcon()}
clickHandler={isRecording ? stop : start}
onClick={isRecording ? stop : start}
disabled={!supportedBrowser}
onMouseEnter={() => setIsHovering(true)}
onMouseLeave={() => setIsHovering(false)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/ShareTrajectoryButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const ShareTrajectoryButton = ({
tooltipPlacement="bottomLeft"
titleText="Share"
icon={Share}
clickHandler={handleShare}
onClick={handleShare}
isDisabled={isDisabled}
tooltipText={{
default: "Share trajectory",
Expand Down
7 changes: 3 additions & 4 deletions src/components/ViewportButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ interface ViewportButtonProps extends ButtonProps {
*/
icon?: ReactNode | string;
radioGroupPosition?: "top" | "bottom";
clickHandler?: () => void;
disabled?: boolean;
active?: boolean;
loading?: boolean;
Expand All @@ -28,7 +27,7 @@ const ViewportButton: React.FC<ViewportButtonProps> = ({
tooltipPlacement,
tooltipWhenDisabled,
icon,
clickHandler,
onClick,
disabled,
loading,
active,
Expand Down Expand Up @@ -61,7 +60,7 @@ const ViewportButton: React.FC<ViewportButtonProps> = ({
const getTooltip = () =>
!disabled || tooltipWhenDisabled ? tooltipText : "";

const getClickHandler = () => (!disabled ? clickHandler : undefined);
const onClickProp = !disabled ? onClick : undefined;

const buttonClassNames = classNames([
className,
Expand All @@ -79,7 +78,7 @@ const ViewportButton: React.FC<ViewportButtonProps> = ({
<Button
{...props}
className={buttonClassNames}
onClick={getClickHandler()}
onClick={onClickProp}
loading={loading}
icon={getIcon()}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/AppHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const AppHeader: React.FC<AppHeaderProps> = ({
<NavButton
className={styles.simulariumHome}
titleText="SIMULARIUM HOME"
clickHandler={() => {
onClick={() => {
history.push("/");
}}
/>
Expand Down
2 changes: 1 addition & 1 deletion src/containers/ViewerPanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ class ViewerPanel extends React.Component<ViewerPanelProps, ViewerPanelState> {
? ExitFullScreen
: FullScreen
}
clickHandler={this.toggleIsFullScreen}
onClick={this.toggleIsFullScreen}
/>
)}
</div>
Expand Down
Loading