Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feat] Hubble gl integration (#1899)
- Loading branch information
1 parent
d31fe64
commit 6c51a2a
Showing
17 changed files
with
414 additions
and
263 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ package-lock.json | |
/index.html | ||
|
||
npm-debug.log | ||
.history/ | ||
|
||
.pnp.* | ||
.yarn/* | ||
|
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
68 changes: 68 additions & 0 deletions
68
src/components/common/animation-control/animation-window-control.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,68 @@ | ||
import React, {useCallback} from 'react'; | ||
import {FormattedMessage} from 'localization'; | ||
import {ReactComponentLike} from 'prop-types'; | ||
import IconButton from '../icon-button'; | ||
import {Tooltip} from 'components/common/styled-components'; | ||
|
||
export interface AnimationItem { | ||
id: string; | ||
icon: ReactComponentLike; | ||
tooltip: string; | ||
} | ||
interface AnimationWindowControlProps { | ||
animationWindow?: string; | ||
setFilterAnimationWindow: (id: string) => void; | ||
toggleAnimationWindowControl: () => void; | ||
height?: string; | ||
animationItems: {[key: string]: AnimationItem}; | ||
btnStyle; | ||
showAnimationWindowControl: boolean; | ||
} | ||
|
||
function AnimationWindowControlFactory(): React.FC<AnimationWindowControlProps> { | ||
const AnimationWindowControl = ({ | ||
animationWindow, | ||
setFilterAnimationWindow, | ||
toggleAnimationWindowControl, | ||
height, | ||
animationItems, | ||
btnStyle = {}, | ||
showAnimationWindowControl | ||
}: AnimationWindowControlProps) => { | ||
const onSelectAnimationControl = useCallback( | ||
item => { | ||
setFilterAnimationWindow(item.id); | ||
toggleAnimationWindowControl(); | ||
}, | ||
[setFilterAnimationWindow, toggleAnimationWindowControl] | ||
); | ||
|
||
return showAnimationWindowControl ? ( | ||
<div className="animation-window-control"> | ||
{Object.values(animationItems) | ||
.filter(item => item.id !== animationWindow) | ||
.map(item => ( | ||
<IconButton | ||
key={item.id} | ||
data-tip | ||
data-for={`${item.id}-tooltip`} | ||
className="playback-control-button" | ||
onClick={() => onSelectAnimationControl(item)} | ||
{...btnStyle} | ||
> | ||
<item.icon height={height} /> | ||
{item.tooltip ? ( | ||
<Tooltip id={`${item.id}-tooltip`} effect="solid" place="top"> | ||
<FormattedMessage id={item.tooltip} /> | ||
</Tooltip> | ||
) : null} | ||
</IconButton> | ||
))} | ||
</div> | ||
) : null; | ||
}; | ||
|
||
return AnimationWindowControl; | ||
} | ||
|
||
export default AnimationWindowControlFactory; |
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,44 @@ | ||
import React from 'react'; | ||
import classnames from 'classnames'; | ||
import {FormattedMessage} from 'localization'; | ||
import {Tooltip} from 'components/common/styled-components'; | ||
import IconButton from '../icon-button'; | ||
|
||
const DELAY_SHOW = 500; | ||
|
||
function PlayControlFactory() { | ||
const PlayControl = ({ | ||
showAnimationWindowControl, | ||
isAnimating, | ||
pauseAnimation, | ||
startAnimation, | ||
isSpeedControlVisible, | ||
btnStyle, | ||
playbackIcons, | ||
buttonHeight | ||
}) => { | ||
return showAnimationWindowControl ? null : ( | ||
<IconButton | ||
data-tip | ||
data-for="animate-play-pause" | ||
className={classnames('playback-control-button', {active: isAnimating})} | ||
onClick={isAnimating ? pauseAnimation : startAnimation} | ||
hide={isSpeedControlVisible} | ||
{...btnStyle} | ||
> | ||
{isAnimating ? ( | ||
<playbackIcons.pause height={buttonHeight} /> | ||
) : ( | ||
<playbackIcons.play height={buttonHeight} /> | ||
)} | ||
<Tooltip id="animate-play-pause" place="top" delayShow={DELAY_SHOW} effect="solid"> | ||
<FormattedMessage id={isAnimating ? 'tooltip.pause' : 'tooltip.play'} /> | ||
</Tooltip> | ||
</IconButton> | ||
); | ||
}; | ||
|
||
return PlayControl; | ||
} | ||
|
||
export default PlayControlFactory; |
Oops, something went wrong.