-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: rejig player controls (#25414)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
7a5b418
commit cbc5afd
Showing
10 changed files
with
175 additions
and
180 deletions.
There are no files selected for viewing
Binary file modified
BIN
+791 Bytes
(100%)
frontend/__snapshots__/replay-player-success--recent-recordings--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+821 Bytes
(100%)
frontend/__snapshots__/replay-player-success--recent-recordings--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+757 Bytes
(100%)
frontend/__snapshots__/replay-player-success--second-recording-in-list--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+827 Bytes
(100%)
frontend/__snapshots__/replay-player-success--second-recording-in-list--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
175 changes: 81 additions & 94 deletions
175
frontend/src/scenes/session-recordings/player/PlayerSettings.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 |
---|---|---|
@@ -1,109 +1,96 @@ | ||
import { IconEllipsis, IconFastForward } from '@posthog/icons' | ||
import { IconFastForward, IconGear } from '@posthog/icons' | ||
import { LemonButton, LemonMenu, LemonSelect, LemonSwitch } from '@posthog/lemon-ui' | ||
import clsx from 'clsx' | ||
import { useActions, useValues } from 'kea' | ||
|
||
import { playerSettingsLogic } from './playerSettingsLogic' | ||
import { PLAYBACK_SPEEDS } from './sessionRecordingPlayerLogic' | ||
|
||
export const PlayerSettings = (): JSX.Element => { | ||
const { speed, autoplayDirection, skipInactivitySetting, showMouseTail, showSeekbarTicks } = | ||
useValues(playerSettingsLogic) | ||
const { setSpeed, setAutoplayDirection, setSkipInactivitySetting, setShowMouseTail, setShowSeekbarTicks } = | ||
const { autoplayDirection, skipInactivitySetting, showMouseTail, showSeekbarTicks } = useValues(playerSettingsLogic) | ||
const { setAutoplayDirection, setSkipInactivitySetting, setShowMouseTail, setShowSeekbarTicks } = | ||
useActions(playerSettingsLogic) | ||
|
||
return ( | ||
<div className="pl-2"> | ||
<LemonMenu | ||
closeOnClickInside={false} | ||
items={[ | ||
{ | ||
custom: true, | ||
label: () => ( | ||
<div className="flex flex-row items-center justify-between space-x-2 p-1 pl-1 min-w-64"> | ||
<span className="text-black font-medium">Autoplay</span> | ||
<LemonMenu | ||
closeOnClickInside={false} | ||
items={[ | ||
{ | ||
custom: true, | ||
label: () => ( | ||
<div className="flex flex-row items-center justify-between space-x-2 p-1 pl-1 min-w-64"> | ||
<span className="text-black font-medium">Autoplay</span> | ||
|
||
<LemonSelect | ||
tooltip={ | ||
<div className="text-center"> | ||
Autoplay next recording | ||
<br />({!autoplayDirection ? 'off' : autoplayDirection}) | ||
</div> | ||
} | ||
value={autoplayDirection} | ||
aria-label="Autoplay next recording" | ||
onChange={setAutoplayDirection} | ||
dropdownPlacement="bottom-end" | ||
dropdownMatchSelectWidth={false} | ||
options={[ | ||
{ value: null, label: 'Off' }, | ||
{ value: 'newer', label: 'Newer recordings' }, | ||
{ value: 'older', label: 'Older recordings' }, | ||
]} | ||
size="small" | ||
/> | ||
</div> | ||
), | ||
}, | ||
{ | ||
custom: true, | ||
label: () => ( | ||
<LemonSwitch | ||
className="px-2 py-1" | ||
checked={showMouseTail} | ||
onChange={setShowMouseTail} | ||
label="Show mouse tail" | ||
fullWidth | ||
/> | ||
), | ||
}, | ||
{ | ||
custom: true, | ||
label: () => ( | ||
<LemonSwitch | ||
className="px-2 py-1" | ||
checked={showSeekbarTicks} | ||
onChange={setShowSeekbarTicks} | ||
label="Seekbar ticks" | ||
tooltip="Show $pageview and $screen events on the seekbar" | ||
fullWidth | ||
/> | ||
), | ||
}, | ||
{ | ||
custom: true, | ||
label: () => ( | ||
<LemonSwitch | ||
handleContent={ | ||
<IconFastForward | ||
className={clsx( | ||
'p-0.5', | ||
skipInactivitySetting ? 'text-primary-3000' : 'text-border-bold' | ||
)} | ||
/> | ||
<LemonSelect | ||
tooltip={ | ||
<div className="text-center"> | ||
Autoplay next recording | ||
<br />({!autoplayDirection ? 'off' : autoplayDirection}) | ||
</div> | ||
} | ||
fullWidth | ||
data-attr="skip-inactivity" | ||
className="px-2 py-1" | ||
checked={skipInactivitySetting} | ||
onChange={setSkipInactivitySetting} | ||
label="Skip inactivity" | ||
value={autoplayDirection} | ||
aria-label="Autoplay next recording" | ||
onChange={setAutoplayDirection} | ||
dropdownPlacement="bottom-end" | ||
dropdownMatchSelectWidth={false} | ||
options={[ | ||
{ value: null, label: 'Off' }, | ||
{ value: 'newer', label: 'Newer recordings' }, | ||
{ value: 'older', label: 'Older recordings' }, | ||
]} | ||
size="small" | ||
/> | ||
), | ||
}, | ||
{ | ||
label: `Playback speed (${speed}x)`, | ||
items: PLAYBACK_SPEEDS.map((speedToggle) => ({ | ||
label: `${speedToggle}x`, | ||
onClick: () => setSpeed(speedToggle), | ||
active: speedToggle === speed, | ||
})), | ||
placement: 'right-end', | ||
}, | ||
]} | ||
> | ||
<LemonButton size="small" icon={<IconEllipsis />} /> | ||
</LemonMenu> | ||
</div> | ||
</div> | ||
), | ||
}, | ||
{ | ||
custom: true, | ||
label: () => ( | ||
<LemonSwitch | ||
className="px-2 py-1" | ||
checked={showMouseTail} | ||
onChange={setShowMouseTail} | ||
label="Show mouse tail" | ||
fullWidth | ||
/> | ||
), | ||
}, | ||
{ | ||
custom: true, | ||
label: () => ( | ||
<LemonSwitch | ||
className="px-2 py-1" | ||
checked={showSeekbarTicks} | ||
onChange={setShowSeekbarTicks} | ||
label="Seekbar ticks" | ||
tooltip="Show $pageview and $screen events on the seekbar" | ||
fullWidth | ||
/> | ||
), | ||
}, | ||
{ | ||
custom: true, | ||
label: () => ( | ||
<LemonSwitch | ||
handleContent={ | ||
<IconFastForward | ||
className={clsx( | ||
'p-0.5', | ||
skipInactivitySetting ? 'text-primary-3000' : 'text-border-bold' | ||
)} | ||
/> | ||
} | ||
fullWidth | ||
data-attr="skip-inactivity" | ||
className="px-2 py-1" | ||
checked={skipInactivitySetting} | ||
onChange={setSkipInactivitySetting} | ||
label="Skip inactivity" | ||
/> | ||
), | ||
}, | ||
]} | ||
> | ||
<LemonButton size="small" icon={<IconGear />} /> | ||
</LemonMenu> | ||
) | ||
} |
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
Oops, something went wrong.