* change(ui) - player - back button spacing * change(ui) - onboarding - changes * change(ui) - onboarding - changes * change(ui) - integrations gap-4 * change(ui) - install script copy button styles * change(ui) - copy button in account settings * fix(ui) - error details modal loader position * change(ui) - share popup styles * change(ui) - player improvements * change(ui) - player improvements - playback speed with menu * change(ui) - player improvements - current timezone * change(ui) - player improvements - autoplay options
38 lines
1 KiB
TypeScript
38 lines
1 KiB
TypeScript
import React from 'react';
|
|
import { Button } from 'UI';
|
|
import { connect } from 'react-redux';
|
|
import { setCreateNoteTooltip } from 'Duck/sessions';
|
|
import { PlayerContext } from 'App/components/Session/playerContext';
|
|
|
|
function NotePopup({
|
|
setCreateNoteTooltip,
|
|
tooltipActive,
|
|
}: {
|
|
setCreateNoteTooltip: (args: any) => void;
|
|
tooltipActive: boolean;
|
|
}) {
|
|
const { player, store } = React.useContext(PlayerContext);
|
|
|
|
const toggleNotePopup = () => {
|
|
if (tooltipActive) return;
|
|
player.pause();
|
|
setCreateNoteTooltip({ time: store.get().time, isVisible: true });
|
|
};
|
|
|
|
React.useEffect(() => {
|
|
return () => setCreateNoteTooltip({ time: -1, isVisible: false });
|
|
}, []);
|
|
|
|
return (
|
|
<Button icon="quotes" variant="text" disabled={tooltipActive} onClick={toggleNotePopup}>
|
|
Add Note
|
|
</Button>
|
|
);
|
|
}
|
|
|
|
const NotePopupComp = connect(
|
|
(state: any) => ({ tooltipActive: state.getIn(['sessions', 'createNoteTooltip', 'isVisible']) }),
|
|
{ setCreateNoteTooltip }
|
|
)(NotePopup);
|
|
|
|
export default React.memo(NotePopupComp);
|