pkg.components.videoplayer#66
Conversation
AlexanderLukomsky
commented
Jul 5, 2023

|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
|
|
||
| const [open, setOpen] = useState(false); | ||
|
|
||
| const handleOpen = () => { |
There was a problem hiding this comment.
я бы отрефакторил обе функции в handleToggle
| <> | ||
| <Button onClick={handleOpen}>Open video</Button> | ||
|
|
||
| <Button onClick={() => setSelectedVideo((prev) => (prev === 0 ? 1 : 0))}> |
There was a problem hiding this comment.
а вот эту бы функцию вынес
|
|
||
| return ( | ||
| <> | ||
| {!open && ( |
There was a problem hiding this comment.
вместо !open && ... open && ...
можно open ? ... : ...
| import { formatTime } from './helpers'; | ||
| import 'pkg.config.muidts'; | ||
|
|
||
| type ControlsProps = { |
There was a problem hiding this comment.
я бы добавил комментарии за что отвечает каждый проп
| })} | ||
| > | ||
| <Stack direction="row" alignItems="center" sx={controlsRowStyle}> | ||
| {!playing && ( |
There was a problem hiding this comment.
тут тоже самое, что с open
| <VolumeControl volume={volume} onChange={onVolumeChange} /> | ||
|
|
||
| <IconButton sx={iconButtonStyle} onClick={onToggleScreenMode}> | ||
| {isFullScreen && <Minimize sx={iconStyle} />} |
| setPlayerState((prev) => ({ ...prev, playing: false })); | ||
| }; | ||
|
|
||
| const handleVolumeChange = (event: Event, value: number | number[]) => { |
There was a problem hiding this comment.
а если всё же прилетит массив чисел? тут явно надо подумать, as не выход
| }; | ||
|
|
||
| const handlePlayerTimeChange = (event: Event, value: number | number[]) => { | ||
| reactPlayerRef.current?.seekTo((value as number) - 0.01); |
| return ( | ||
| <Box sx={{ position: 'relative', ml: 'auto' }}> | ||
| <IconButton onClick={handleIconClick} sx={iconButtonStyle}> | ||
| {volume > 0 && <SoundOn sx={iconStyle} />} |
There was a problem hiding this comment.
тут тоже можно на ? :
| "eslint": "^7.32.0", | ||
| "eslint-config-custom": "*", | ||
| "pkg.config.typescript": "*", | ||
| "react": "^18.2.0", |
There was a problem hiding this comment.
react тут лишний, он уже есть в dependencies
|
Исправил все замечания, так же отредактировал названия переменных. |
unknownproperty
left a comment
There was a problem hiding this comment.
Хорошо, спасибо, поставил аппрув, можно отнести отправить на тестирование