openreplay/frontend/app/components/Session/Player/ClipPlayer/ClipPlayerControls.tsx
Delirium 2cd96b0df0
Highlight UI (#2951)
* ui: start highlight ui

* ui: tag items

* ui: connecting highlights to notes api...

* Highlight feature refinements (#2948)

* ui: move clips player to foss, connect notes api to hl

* ui: tune note/hl editing, prevent zoom slider body from jumping around

* ui: safe check for tag

* ui: fix thumbnail gen

* ui: fix thumbnail gen

* ui: make player modal wider, add shadow

* ui: custom warn barge for clips

* ui: swap icon for note event wrapper

* ui: rm other, fix cancel

* ui: moving around creation modal

* ui: bg tint

* ui: rm disabled for text btn

* ui: fix ownership sorting

* ui: close player on bg click

* ui: fix query, fix min distance for default range

* ui: move hl list header out of list comp

* ui: spot list header segmented size

* Various improvements in highlights (#2955)

* ui: update hl in hlPanel comp

* ui: rm debug

* ui: fix icons file

---------

Co-authored-by: Sudheer Salavadi <connect.uxmaster@gmail.com>
2025-01-24 09:59:54 +01:00

55 lines
1.6 KiB
TypeScript

import React from 'react';
import Timeline from 'Components/Session/Player/ClipPlayer/Timeline';
import { PlayButton, PlayingState } from '@/player-ui';
import { PlayerContext } from 'Components/Session/playerContext';
import { observer } from '.store/mobx-react-lite-virtual-356dc1206a/package';
import { Button } from 'antd';
import { useHistory } from 'react-router-dom';
import { CirclePlay } from 'lucide-react';
import { withSiteId } from '@/routes';
import * as routes from '@/routes';
import { useStore } from '@/mstore';
import Session from 'Types/session';
function ClipPlayerControls({
session,
range,
}: {
session: Session;
range: [number, number];
}) {
const { projectsStore } = useStore();
const { player, store } = React.useContext(PlayerContext);
const history = useHistory();
const siteId = projectsStore.siteId;
const { playing, completed } = store.get();
const state = completed
? PlayingState.Completed
: playing
? PlayingState.Playing
: PlayingState.Paused;
const togglePlay = () => {
player.togglePlay();
};
const showFullSession = () => {
const path = withSiteId(routes.session(session.sessionId), siteId);
history.push(path + '?jumpto=' + Math.round(range[0]));
};
return (
<div className="relative flex items-center gap-4 p-3 border-t">
<PlayButton state={state} togglePlay={togglePlay} iconSize={30} />
<Timeline range={range} />
<Button size="small" type='primary' onClick={showFullSession}>
Play Full Session
<CirclePlay size={16}/>
</Button>
</div>
);
}
export default observer(ClipPlayerControls);