Skip to content

Commit

Permalink
fix: CR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
IEduStu authored Sep 17, 2024
1 parent b791e7e commit ed078e1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/App/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
--outer-glow: 0px 0px 30px rgba(123, 91, 245, 0.37);
--border-radius: 0.75rem;

background-color: #161523;
background-color: #161523; // copied from WebpackPwaManifest config (see webpack.config.js)
}

* {
Expand Down
35 changes: 18 additions & 17 deletions src/common/useFullscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,41 @@ const useFullscreen = (videoElementRef) => {
return null;
}, [videoElementRef]);

const videoElement = getVideoElement();
const [fullscreen, setFullscreen] = React.useState(document.fullscreenElement === document.documentElement || (videoElement && videoElement.webkitDisplayingFullscreen));
const [fullscreen, setFullscreen] = React.useState(() => {
const videoElement = getVideoElement();
return document.fullscreenElement === document.documentElement || (videoElement && videoElement.webkitDisplayingFullscreen)
});
const requestFullscreen = React.useCallback(() => {
if (document.documentElement.requestFullscreen)
if (document.documentElement.requestFullscreen) {
document.documentElement.requestFullscreen();
else {
} else {
const videoElement = getVideoElement();
if (videoElement && videoElement.webkitEnterFullscreen)
if (videoElement && videoElement.webkitEnterFullscreen) {
videoElement.webkitEnterFullscreen();
}
}
}, [videoElementRef]);
}, [getVideoElement]);
const exitFullscreen = React.useCallback(() => {
if (document.exitFullscreen)
if (document.exitFullscreen) {
document.exitFullscreen();
else {
} else {
const videoElement = getVideoElement();
if (videoElement && videoElement.webkitEnterFullscreen)
if (videoElement && videoElement.webkitExitFullscreen) {
videoElement.webkitExitFullscreen();
}
}
}, [videoElementRef]);
}, [getVideoElement]);
const toggleFullscreen = React.useCallback(() => {
if (fullscreen) {
exitFullscreen();
} else {
requestFullscreen();
}
fullscreen ? exitFullscreen() : requestFullscreen();
}, [fullscreen, exitFullscreen, requestFullscreen]);
React.useEffect(() => {
const videoElement = getVideoElement();

const onFullscreenChange = () => {
setFullscreen(document.fullscreenElement === document.documentElement || (videoElement && videoElement.webkitDisplayingFullscreen));
};
document.addEventListener('fullscreenchange', onFullscreenChange);

document.addEventListener('fullscreenchange', onFullscreenChange);
if (videoElement && videoElement.addEventListener) {
videoElement.addEventListener('webkitenterfullscreen', onFullscreenChange);
videoElement.addEventListener('webkitendfullscreen', onFullscreenChange);
Expand All @@ -57,12 +57,13 @@ const useFullscreen = (videoElementRef) => {
return () => {
document.removeEventListener('fullscreenchange', onFullscreenChange);

if (videoElement && videoElement.addEventListener) {
if (videoElement && videoElement.removeEventListener) {
videoElement.removeEventListener('webkitenterfullscreen', onFullscreenChange);
videoElement.removeEventListener('webkitendfullscreen', onFullscreenChange);
}
};
}, []);

return [fullscreen, requestFullscreen, exitFullscreen, toggleFullscreen];
};

Expand Down
19 changes: 10 additions & 9 deletions src/routes/MetaDetails/MetaDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,16 @@ const MetaDetails = ({ urlParams, queryParams }) => {
return (
<div className={styles['metadetails-container']}>
{
canRenderBackground &&
<div className={styles['background-image-layer']}>
<Image
className={styles['background-image']}
src={metaDetails.metaItem.content.content.background}
renderFallback={renderBackgroundImageFallback}
alt={' '}
/>
</div>
canRenderBackground
? <div className={styles['background-image-layer']}>
<Image
className={styles['background-image']}
src={metaDetails.metaItem.content.content.background}
renderFallback={renderBackgroundImageFallback}
alt={' '}
/>
</div>
: null
}
<HorizontalNavBar
className={styles['nav-bar']}
Expand Down

0 comments on commit ed078e1

Please sign in to comment.