Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Side Drawer component implementation inside the Player #735

Merged
merged 53 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
a726ffb
feat: init side drawer component
kKaskak Dec 6, 2024
a81792e
remove: InfoMenu and VideosMenu
kKaskak Dec 6, 2024
61c5781
refactor(SideDrawer): simplify the conditionals
kKaskak Dec 6, 2024
888b008
refactor: simlifications, fix arrows
kKaskak Dec 6, 2024
2b03b08
fix: ts error for the inert attribute
kKaskak Dec 9, 2024
e372b89
refactor: mobile UI improvements
kKaskak Dec 9, 2024
7d2c511
refactor(styles): more mobile adjustments
kKaskak Dec 9, 2024
cbffdfa
refactor(styles): mobile UI adjustments (3)
kKaskak Dec 9, 2024
36bae52
refactor(styles): orientation UI tweaks
kKaskak Dec 9, 2024
8e42bb0
refactor(styles): videos height
kKaskak Dec 9, 2024
d9cec12
refactor(styles): use dvh to respect safe areas
kKaskak Dec 9, 2024
5a422b5
refactor (styles): landscape mode on mobile
kKaskak Dec 9, 2024
121cdca
chore: use core-web branch package for testing
kKaskak Dec 9, 2024
7240432
Merge branch 'development' into feat/player-side-drawer
kKaskak Dec 9, 2024
b894687
chore: update & sync pkgs
kKaskak Dec 9, 2024
d5b8dc9
Merge branch 'fix/player-mark-video-as-watched' into feat/player-side…
kKaskak Dec 10, 2024
cc046ce
refactor: fix iOS overflow issues
kKaskak Dec 10, 2024
c3d506c
fix: padding on MetaPreview
kKaskak Dec 10, 2024
3fc1e2c
fix: action-buttons-container margin issue
kKaskak Dec 10, 2024
de29082
fix: speed menu overflow issue
kKaskak Dec 10, 2024
483273a
fix: menu-layer mobile issues
kKaskak Dec 10, 2024
2a9bf42
chore (pkgs): update core to new release
kKaskak Dec 11, 2024
ec23f67
Merge branch 'development' into feat/player-side-drawer
kKaskak Dec 12, 2024
fde708b
chore(pkgs): package-lock.json
kKaskak Dec 12, 2024
7f6204e
Merge branch 'development' into feat/player-side-drawer
kKaskak Dec 12, 2024
a0be48b
Merge branch 'development' into feat/player-side-drawer
kKaskak Dec 12, 2024
f97b5f1
refactor: import hooks on top of the file
kKaskak Dec 12, 2024
1083831
fix: use dvw for width instead of %
kKaskak Dec 12, 2024
6c34c6f
fix: use flex instead of height attribute
kKaskak Dec 12, 2024
5eb0c01
fix: videos height
kKaskak Dec 12, 2024
7a39c40
remove: unused var
kKaskak Dec 13, 2024
47464ce
feat: add close button
kKaskak Dec 13, 2024
1464324
chore: update stremio-icons
kKaskak Dec 13, 2024
444152a
refactor: closer button logic and width on mobile
kKaskak Dec 13, 2024
b8a5e60
refactor: button position moved to right
kKaskak Dec 13, 2024
dd53dcc
Merge branch 'development' into feat/player-side-drawer
kKaskak Dec 16, 2024
1788a95
fix: strange positioning on movies
kKaskak Dec 16, 2024
297b8f1
refactor: keep the DOM organised
kKaskak Dec 16, 2024
f8d9d0d
fix(info container): height in landscape mode
kKaskak Dec 16, 2024
9b4e3e8
remove: unused prop
kKaskak Dec 16, 2024
1555e05
(revert): removal of useeffect | sidedrawer states
kKaskak Dec 16, 2024
72b7a37
feat: rewrite sidedrawer to act like a menu
kKaskak Dec 16, 2024
f9cb1a5
refactor(Player): make SideDrawer act like a menu
tymmesyde Dec 18, 2024
f6ed54f
feat: add transition to side drawer
tymmesyde Dec 18, 2024
429dfc2
refactor: use cubic bezier easing
kKaskak Dec 18, 2024
c45cc8a
fix(Player): remove side-drawer-layer from overlayHidden
tymmesyde Dec 18, 2024
609e407
fix(Player): hide side drawer button when overlay hidden
tymmesyde Dec 18, 2024
f1cb4c1
feat: add copyright + button mobile styles
kKaskak Dec 18, 2024
5249d18
refactor(SideDrawerButton): styles
kKaskak Dec 18, 2024
78a3771
Merge pull request #756 from Stremio/feat/rewrite-sidedrawer-menu
kKaskak Dec 18, 2024
1b997df
Merge branch 'development' into feat/player-side-drawer
kKaskak Dec 18, 2024
379bd1d
Merge branch 'development' into feat/player-side-drawer
kKaskak Dec 19, 2024
c83f3e8
Merge branch 'development' of https://github.com/Stremio/stremio-web …
tymmesyde Dec 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@sentry/browser": "8.42.0",
"@stremio/stremio-colors": "5.2.0",
"@stremio/stremio-core-web": "0.48.3",
"@stremio/stremio-icons": "5.4.0",
"@stremio/stremio-icons": "5.4.1",
"@stremio/stremio-video": "0.0.48",
"a-color-picker": "1.2.1",
"bowser": "2.11.0",
Expand Down
60 changes: 60 additions & 0 deletions src/common/Transition/Transition.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import { cloneElement, useCallback, useEffect, useMemo, useState } from 'react';
import classNames from 'classnames';

type Props = {
children: JSX.Element,
when: boolean,
name: string,
};

const Transition = ({ children, when, name }: Props) => {
const [element, setElement] = useState<HTMLElement | null>(null);
const [mounted, setMounted] = useState(false);

const [state, setState] = useState('enter');
const [active, setActive] = useState(false);

const callbackRef = useCallback((element: HTMLElement | null) => {
setElement(element);
}, []);

const className = useMemo(() => {
const animationClass = `${name}-${state}`;
const activeClass = active ? `${name}-active` : null;

return children && classNames(
children.props.className,
animationClass,
activeClass,
);
}, [name, state, active, children]);

const onTransitionEnd = useCallback(() => {
state === 'exit' && setMounted(false);
}, [state]);

useEffect(() => {
setState(when ? 'enter' : 'exit');
when && setMounted(true);
}, [when]);

useEffect(() => {
requestAnimationFrame(() => {
setActive(!!element);
});
}, [element]);

useEffect(() => {
element?.addEventListener('transitionend', onTransitionEnd);
return () => element?.removeEventListener('transitionend', onTransitionEnd);
}, [element, onTransitionEnd]);

return (
mounted && cloneElement(children, {
ref: callbackRef,
className,
})
);
};

export default Transition;
2 changes: 2 additions & 0 deletions src/common/Transition/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Transition from './Transition';
export default Transition;
13 changes: 13 additions & 0 deletions src/common/animations.less
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,17 @@
100% {
transform: translateY(0%);
}
}

.slide-left-enter {
transform: translateX(100%);
}

.slide-left-active {
transform: translateX(0%);
transition: transform 0.3s cubic-bezier(0.32, 0, 0.67, 0);
}

.slide-left-exit {
transform: translateX(100%);
}
2 changes: 2 additions & 0 deletions src/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const Slider = require('./Slider');
const { default: TextInput } = require('./TextInput');
const { ToastProvider, useToast } = require('./Toast');
const { TooltipProvider, Tooltip } = require('./Tooltips');
const { default: Transition } = require('./Transition');
const Video = require('./Video');
const comparatorWithPriorities = require('./comparatorWithPriorities');
const CONSTANTS = require('./CONSTANTS');
Expand Down Expand Up @@ -84,6 +85,7 @@ module.exports = {
useToast,
TooltipProvider,
Tooltip,
Transition,
Video,
comparatorWithPriorities,
CONSTANTS,
Expand Down
4 changes: 0 additions & 4 deletions src/routes/MetaDetails/VideosList/SeasonsBar/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@
background-color: var(--overlay-color);
}

&:focus {
background-color: var(--primary-foreground-color);
}

&>:first-child {
margin-right: 0.5rem;
}
Expand Down
14 changes: 3 additions & 11 deletions src/routes/Player/ControlBar/ControlBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,8 @@ const ControlBar = ({
onVolumeChangeRequested,
onSeekRequested,
onToggleSubtitlesMenu,
onToggleInfoMenu,
onToggleSpeedMenu,
onToggleVideosMenu,
onToggleSideDrawer,
onToggleOptionsMenu,
onToggleStatisticsMenu,
...props
Expand All @@ -48,9 +47,6 @@ const ControlBar = ({
const onSubtitlesButtonMouseDown = React.useCallback((event) => {
event.nativeEvent.subtitlesMenuClosePrevented = true;
}, []);
const onInfoButtonMouseDown = React.useCallback((event) => {
event.nativeEvent.infoMenuClosePrevented = true;
}, []);
const onSpeedButtonMouseDown = React.useCallback((event) => {
event.nativeEvent.speedMenuClosePrevented = true;
}, []);
Expand Down Expand Up @@ -151,9 +147,6 @@ const ControlBar = ({
<Button className={classnames(styles['control-bar-button'], { 'disabled': playbackSpeed === null })} tabIndex={-1} onMouseDown={onSpeedButtonMouseDown} onClick={onToggleSpeedMenu}>
<Icon className={styles['icon']} name={'speed'} />
</Button>
<Button className={classnames(styles['control-bar-button'], { 'disabled': metaItem === null || metaItem.type !== 'Ready' })} tabIndex={-1} onMouseDown={onInfoButtonMouseDown} onClick={onToggleInfoMenu}>
<Icon className={styles['icon']} name={'about'} />
</Button>
<Button className={classnames(styles['control-bar-button'], { 'disabled': !chromecastServiceActive })} tabIndex={-1} onClick={onChromecastButtonClick}>
<Icon className={styles['icon']} name={'cast'} />
</Button>
Expand All @@ -162,7 +155,7 @@ const ControlBar = ({
</Button>
{
metaItem?.content?.videos?.length > 0 ?
<Button className={styles['control-bar-button']} tabIndex={-1} onMouseDown={onVideosButtonMouseDown} onClick={onToggleVideosMenu}>
<Button className={styles['control-bar-button']} tabIndex={-1} onMouseDown={onVideosButtonMouseDown} onClick={onToggleSideDrawer}>
<Icon className={styles['icon']} name={'episodes'} />
</Button>
:
Expand Down Expand Up @@ -200,9 +193,8 @@ ControlBar.propTypes = {
onVolumeChangeRequested: PropTypes.func,
onSeekRequested: PropTypes.func,
onToggleSubtitlesMenu: PropTypes.func,
onToggleInfoMenu: PropTypes.func,
onToggleSpeedMenu: PropTypes.func,
onToggleVideosMenu: PropTypes.func,
onToggleSideDrawer: PropTypes.func,
onToggleOptionsMenu: PropTypes.func,
onToggleStatisticsMenu: PropTypes.func,
};
Expand Down
6 changes: 4 additions & 2 deletions src/routes/Player/ControlBar/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,16 @@

.control-bar-buttons-menu-container {
position: absolute;
right: 0.15rem;
right: 0rem;
bottom: 4.5rem;
flex-direction: column;
padding: 0.5rem;
margin: 0.5rem;
max-width: calc(100dvw - 1rem);
border-radius: var(--border-radius);
background-color: var(--modal-background-color);
box-shadow: 0 1.35rem 2.7rem @color-background-dark5-40,
0 1.1rem 0.85rem @color-background-dark5-20;
overflow-x: auto;

&:not(:global(.open)) {
display: none;
Expand Down
77 changes: 0 additions & 77 deletions src/routes/Player/InfoMenu/InfoMenu.js

This file was deleted.

5 changes: 0 additions & 5 deletions src/routes/Player/InfoMenu/index.js

This file was deleted.

10 changes: 0 additions & 10 deletions src/routes/Player/InfoMenu/styles.less

This file was deleted.

Loading
Loading