From 089fc52a7d64b45001f79caaf44ba5a95047fea1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rave=20=7C=20=E5=9B=B3=E6=9B=B8=E9=A4=A8=E7=8C=AB?= Date: Wed, 20 Apr 2022 10:20:15 +0200 Subject: [PATCH] Filepage theater fix (#1366) * Disable theater mode for non-video files * Add black background to image container --- ui/component/page/index.js | 2 ++ ui/component/page/view.jsx | 9 ++++++--- ui/page/file/view.jsx | 12 ++++++------ ui/scss/component/_file-render.scss | 2 ++ 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/ui/component/page/index.js b/ui/component/page/index.js index 3a3a4113d..52b9123a4 100644 --- a/ui/component/page/index.js +++ b/ui/component/page/index.js @@ -1,9 +1,11 @@ import { connect } from 'react-redux'; +import { makeSelectFileRenderModeForUri } from 'redux/selectors/content'; import { selectClientSetting } from 'redux/selectors/settings'; import * as SETTINGS from 'constants/settings'; import Page from './view'; const select = (state, props) => ({ + renderMode: makeSelectFileRenderModeForUri(state.content.primaryUri)(state), videoTheaterMode: selectClientSetting(state, SETTINGS.VIDEO_THEATER_MODE), }); diff --git a/ui/component/page/view.jsx b/ui/component/page/view.jsx index 8ca560856..49316021c 100644 --- a/ui/component/page/view.jsx +++ b/ui/component/page/view.jsx @@ -35,6 +35,7 @@ type Props = { noSideNavigation: boolean, rightSide?: Node, settingsPage?: boolean, + renderMode: String, videoTheaterMode: boolean, isPopoutWindow?: boolean, }; @@ -55,6 +56,7 @@ function Page(props: Props) { noSideNavigation = false, rightSide, settingsPage, + renderMode, videoTheaterMode, isPopoutWindow, } = props; @@ -63,6 +65,7 @@ function Page(props: Props) { location: { pathname }, } = useHistory(); + const theaterMode = renderMode === 'video' ? videoTheaterMode : false; const isMediumScreen = useIsMediumScreen(); const isMobile = useIsMobile(); const isLandscapeRotated = useIsMobileLandscape(); @@ -102,7 +105,7 @@ function Page(props: Props) {
{/* playables will be rendered and injected by */} - +
); } @@ -188,7 +188,7 @@ export default function FilePage(props: Props) { return ( <> - + @@ -203,7 +203,7 @@ export default function FilePage(props: Props) {
- {!isMarkdown && !videoTheaterMode && } + {!isMarkdown && !theaterMode && } ); } @@ -252,13 +252,13 @@ export default function FilePage(props: Props) { - {!isMarkdown && videoTheaterMode && } + {!isMarkdown && theaterMode && } )} {!isMarkdown - ? !videoTheaterMode && + ? !theaterMode && : !contentCommentsDisabled && (
diff --git a/ui/scss/component/_file-render.scss b/ui/scss/component/_file-render.scss index 2ca4d97c3..dd1b0198d 100644 --- a/ui/scss/component/_file-render.scss +++ b/ui/scss/component/_file-render.scss @@ -263,6 +263,8 @@ .file-render__img-container { width: 100%; // aspect-ratio: 16 / 9; + background-color: #000000; + border-radius: var(--border-radius); } .file-render--post-container {