openreplay/frontend/app/components/Session/Player/ClipPlayer/AutoplayToggle.tsx
Andrey Babushkin fd5c0c9747
Add lokalisation (#3092)
* applied eslint

* add locales and lint the project

* removed error boundary

* updated locales

* fix min files

* fix locales
2025-03-06 17:43:15 +01:00

37 lines
1.1 KiB
TypeScript

import React, { useContext } from 'react';
import { observer } from 'mobx-react-lite';
import {
IPlayerContext,
PlayerContext,
} from 'Components/Session/playerContext';
import { useStore } from '@/mstore';
import { Switch, Tooltip } from './.store/antd-virtual-7db13b4af6/package';
import {
CaretRightOutlined,
PauseOutlined,
} from './.store/@ant-design-icons-virtual-de151eefe5/package';
function AutoplayToggle() {
const { clipStore } = useStore();
const playerContext = React.useContext<IPlayerContext>(PlayerContext);
// const { player, store } = playerContext;
const { autoplay } = playerContext.store.get();
const handleToggle = () => {
clipStore.toggleAutoplay();
};
return (
<Tooltip title="Toggle Autoplay" placement="bottom">
<Switch
className="custom-switch"
onChange={handleToggle}
checked={clipStore.autoplay}
checkedChildren={<CaretRightOutlined className="switch-icon" />}
unCheckedChildren={<PauseOutlined className="switch-icon" />}
/>
</Tooltip>
);
}
export default observer(AutoplayToggle);