2018-03-26 23:32:43 +02:00
|
|
|
// @flow
|
2021-07-22 20:21:31 +02:00
|
|
|
import * as PAGES from 'constants/pages';
|
2022-02-07 18:51:26 +01:00
|
|
|
import { VIDEO_ALMOST_FINISHED_THRESHOLD } from 'constants/player';
|
2018-03-26 23:32:43 +02:00
|
|
|
import * as React from 'react';
|
2020-04-01 20:43:50 +02:00
|
|
|
import classnames from 'classnames';
|
2021-07-07 09:10:28 +02:00
|
|
|
import { lazyImport } from 'util/lazyImport';
|
2018-03-26 23:32:43 +02:00
|
|
|
import Page from 'component/page';
|
2020-04-01 20:43:50 +02:00
|
|
|
import * as RENDER_MODES from 'constants/file_render_modes';
|
2021-03-11 18:08:11 +01:00
|
|
|
import FileTitleSection from 'component/fileTitleSection';
|
2020-04-01 20:43:50 +02:00
|
|
|
import FileRenderInitiator from 'component/fileRenderInitiator';
|
|
|
|
import FileRenderInline from 'component/fileRenderInline';
|
|
|
|
import FileRenderDownload from 'component/fileRenderDownload';
|
|
|
|
import RecommendedContent from 'component/recommendedContent';
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
import CollectionContent from 'component/collectionContentSidebar';
|
2021-07-22 20:21:31 +02:00
|
|
|
import Button from 'component/button';
|
|
|
|
import I18nMessage from 'component/i18nMessage';
|
2021-02-04 06:45:49 +01:00
|
|
|
import Empty from 'component/common/empty';
|
2022-02-02 13:44:33 +01:00
|
|
|
import SwipeableDrawer from 'component/swipeableDrawer';
|
2022-02-02 13:48:24 +01:00
|
|
|
import { DrawerExpandButton } from 'component/swipeableDrawer/view';
|
2022-02-02 13:44:33 +01:00
|
|
|
import { useIsMobile } from 'effects/use-screensize';
|
2020-04-01 20:43:50 +02:00
|
|
|
|
2021-10-18 17:54:59 +02:00
|
|
|
const CommentsList = lazyImport(() => import('component/commentsList' /* webpackChunkName: "comments" */));
|
2021-07-07 09:10:28 +02:00
|
|
|
const PostViewer = lazyImport(() => import('component/postViewer' /* webpackChunkName: "postViewer" */));
|
2021-06-11 08:06:29 +02:00
|
|
|
|
2020-10-20 19:10:02 +02:00
|
|
|
export const PRIMARY_PLAYER_WRAPPER_CLASS = 'file-page__video-container';
|
2019-08-13 07:35:13 +02:00
|
|
|
|
2018-03-26 23:32:43 +02:00
|
|
|
type Props = {
|
2020-04-01 20:43:50 +02:00
|
|
|
costInfo: ?{ includesData: boolean, cost: number },
|
2019-04-24 16:02:08 +02:00
|
|
|
fileInfo: FileListItem,
|
2018-03-26 23:32:43 +02:00
|
|
|
uri: string,
|
2022-02-05 13:06:19 +01:00
|
|
|
channelId?: string,
|
2020-04-01 20:43:50 +02:00
|
|
|
renderMode: string,
|
2020-07-21 09:26:56 +02:00
|
|
|
obscureNsfw: boolean,
|
|
|
|
isMature: boolean,
|
2021-07-15 16:43:28 +02:00
|
|
|
linkedCommentId?: string,
|
2022-02-01 21:27:48 +01:00
|
|
|
hasCollectionById?: boolean,
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
collectionId: string,
|
2021-01-08 16:21:27 +01:00
|
|
|
videoTheaterMode: boolean,
|
2021-07-22 20:21:31 +02:00
|
|
|
claimIsMine: boolean,
|
2022-02-05 13:06:19 +01:00
|
|
|
contentCommentsDisabled: boolean,
|
2021-07-22 20:21:31 +02:00
|
|
|
isLivestream: boolean,
|
2021-08-30 16:41:38 +02:00
|
|
|
position: number,
|
2022-02-02 13:45:16 +01:00
|
|
|
commentsListTitle: string,
|
2022-02-05 13:06:19 +01:00
|
|
|
settingsByChannelId: { [channelId: string]: PerChannelSettings },
|
2022-02-08 13:15:22 +01:00
|
|
|
isPlaying?: boolean,
|
2022-02-01 21:27:48 +01:00
|
|
|
doFetchCostInfoForUri: (uri: string) => void,
|
|
|
|
doSetContentHistoryItem: (uri: string) => void,
|
|
|
|
doSetPrimaryUri: (uri: ?string) => void,
|
|
|
|
clearPosition: (uri: string) => void,
|
2022-02-07 17:51:07 +01:00
|
|
|
doClearPlayingUri: () => void,
|
2018-03-26 23:32:43 +02:00
|
|
|
};
|
|
|
|
|
2022-02-01 21:27:48 +01:00
|
|
|
export default function FilePage(props: Props) {
|
2020-10-20 19:10:02 +02:00
|
|
|
const {
|
|
|
|
uri,
|
2022-02-05 13:06:19 +01:00
|
|
|
channelId,
|
2020-10-20 19:10:02 +02:00
|
|
|
renderMode,
|
|
|
|
fileInfo,
|
|
|
|
obscureNsfw,
|
|
|
|
isMature,
|
|
|
|
costInfo,
|
2021-07-15 16:43:28 +02:00
|
|
|
linkedCommentId,
|
2021-01-08 16:21:27 +01:00
|
|
|
videoTheaterMode,
|
2021-07-22 20:21:31 +02:00
|
|
|
|
|
|
|
claimIsMine,
|
2022-02-05 13:06:19 +01:00
|
|
|
contentCommentsDisabled,
|
2022-02-01 21:27:48 +01:00
|
|
|
hasCollectionById,
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
collectionId,
|
2021-07-22 20:21:31 +02:00
|
|
|
isLivestream,
|
2021-08-30 16:41:38 +02:00
|
|
|
position,
|
2022-02-02 13:45:16 +01:00
|
|
|
commentsListTitle,
|
2022-02-05 13:06:19 +01:00
|
|
|
settingsByChannelId,
|
2022-02-08 13:15:22 +01:00
|
|
|
isPlaying,
|
2022-02-01 21:27:48 +01:00
|
|
|
doFetchCostInfoForUri,
|
|
|
|
doSetContentHistoryItem,
|
|
|
|
doSetPrimaryUri,
|
|
|
|
clearPosition,
|
2022-02-07 17:51:07 +01:00
|
|
|
doClearPlayingUri,
|
2020-10-20 19:10:02 +02:00
|
|
|
} = props;
|
2022-02-01 21:27:48 +01:00
|
|
|
|
2022-02-02 13:44:33 +01:00
|
|
|
const isMobile = useIsMobile();
|
|
|
|
|
2022-02-04 21:59:11 +01:00
|
|
|
// Auto-open the drawer on Mobile view if there is a linked comment
|
|
|
|
const [showComments, setShowComments] = React.useState(linkedCommentId);
|
2022-02-02 13:44:33 +01:00
|
|
|
|
2022-02-05 13:06:19 +01:00
|
|
|
const channelSettings = channelId ? settingsByChannelId[channelId] : undefined;
|
|
|
|
const commentSettingDisabled = channelSettings && !channelSettings.comments_enabled;
|
2020-10-20 19:10:02 +02:00
|
|
|
const cost = costInfo ? costInfo.cost : null;
|
|
|
|
const hasFileInfo = fileInfo !== undefined;
|
2021-03-12 17:18:09 +01:00
|
|
|
const isMarkdown = renderMode === RENDER_MODES.MARKDOWN;
|
2021-08-30 16:41:38 +02:00
|
|
|
const videoPlayedEnoughToResetPosition = React.useMemo(() => {
|
|
|
|
const durationInSecs =
|
|
|
|
fileInfo && fileInfo.metadata && fileInfo.metadata.video ? fileInfo.metadata.video.duration : 0;
|
2021-10-28 17:48:39 +02:00
|
|
|
const isVideoTooShort = durationInSecs <= 45;
|
2022-02-07 18:51:26 +01:00
|
|
|
const almostFinishedPlaying = position / durationInSecs >= VIDEO_ALMOST_FINISHED_THRESHOLD;
|
2021-08-30 16:41:38 +02:00
|
|
|
|
2022-02-07 18:51:26 +01:00
|
|
|
return durationInSecs ? isVideoTooShort || almostFinishedPlaying : false;
|
2021-08-30 16:41:38 +02:00
|
|
|
}, [fileInfo, position]);
|
2020-10-20 19:10:02 +02:00
|
|
|
|
|
|
|
React.useEffect(() => {
|
2019-03-15 17:15:31 +01:00
|
|
|
// always refresh file info when entering file page to see if we have the file
|
2020-04-01 20:43:50 +02:00
|
|
|
// this could probably be refactored into more direct components now
|
2021-08-25 21:35:00 +02:00
|
|
|
if (collectionId) {
|
|
|
|
clearPosition(uri);
|
|
|
|
}
|
|
|
|
|
2021-08-30 16:41:38 +02:00
|
|
|
if (fileInfo && videoPlayedEnoughToResetPosition) {
|
|
|
|
clearPosition(uri);
|
|
|
|
}
|
|
|
|
|
2018-07-12 20:39:12 +02:00
|
|
|
// See https://github.com/lbryio/lbry-desktop/pull/1563 for discussion
|
2022-02-01 21:27:48 +01:00
|
|
|
doFetchCostInfoForUri(uri);
|
|
|
|
doSetContentHistoryItem(uri);
|
|
|
|
doSetPrimaryUri(uri);
|
2019-03-14 19:40:26 +01:00
|
|
|
|
2022-02-01 21:27:48 +01:00
|
|
|
return () => doSetPrimaryUri(null);
|
2021-08-30 16:41:38 +02:00
|
|
|
}, [
|
|
|
|
uri,
|
|
|
|
hasFileInfo,
|
|
|
|
fileInfo,
|
|
|
|
videoPlayedEnoughToResetPosition,
|
|
|
|
collectionId,
|
|
|
|
clearPosition,
|
2022-02-01 21:27:48 +01:00
|
|
|
doFetchCostInfoForUri,
|
|
|
|
doSetContentHistoryItem,
|
|
|
|
doSetPrimaryUri,
|
2021-08-30 16:41:38 +02:00
|
|
|
]);
|
2018-10-19 22:38:07 +02:00
|
|
|
|
2022-02-07 17:51:07 +01:00
|
|
|
React.useEffect(() => {
|
|
|
|
// No floating player on mobile as of now, so clear the playing uri
|
|
|
|
return () => {
|
2022-02-08 13:15:22 +01:00
|
|
|
if (isMobile && isPlaying && RENDER_MODES.FLOATING_MODES.includes(renderMode)) {
|
2022-02-07 17:51:07 +01:00
|
|
|
doClearPlayingUri();
|
|
|
|
}
|
|
|
|
};
|
2022-02-08 13:15:22 +01:00
|
|
|
}, [doClearPlayingUri, isMobile, isPlaying, renderMode]);
|
2022-02-07 17:51:07 +01:00
|
|
|
|
2020-10-20 19:10:02 +02:00
|
|
|
function renderFilePageLayout() {
|
|
|
|
if (RENDER_MODES.FLOATING_MODES.includes(renderMode)) {
|
2020-04-01 20:43:50 +02:00
|
|
|
return (
|
2022-02-01 21:27:48 +01:00
|
|
|
<div className={PRIMARY_PLAYER_WRAPPER_CLASS}>
|
2020-04-01 20:43:50 +02:00
|
|
|
{/* playables will be rendered and injected by <FileRenderFloating> */}
|
2022-02-01 21:27:48 +01:00
|
|
|
<FileRenderInitiator uri={uri} videoTheaterMode={videoTheaterMode} />
|
|
|
|
</div>
|
2020-04-01 20:43:50 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-10-20 19:10:02 +02:00
|
|
|
if (RENDER_MODES.UNRENDERABLE_MODES.includes(renderMode)) {
|
2020-04-01 20:43:50 +02:00
|
|
|
return (
|
2022-02-01 21:27:48 +01:00
|
|
|
<>
|
2021-03-11 18:08:11 +01:00
|
|
|
<FileTitleSection uri={uri} />
|
2020-04-01 20:43:50 +02:00
|
|
|
<FileRenderDownload uri={uri} isFree={cost === 0} />
|
2022-02-01 21:27:48 +01:00
|
|
|
</>
|
2020-04-01 20:43:50 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-03-12 17:18:09 +01:00
|
|
|
if (isMarkdown) {
|
2021-06-11 08:06:29 +02:00
|
|
|
return (
|
|
|
|
<React.Suspense fallback={null}>
|
|
|
|
<PostViewer uri={uri} />
|
|
|
|
</React.Suspense>
|
|
|
|
);
|
2020-04-01 20:43:50 +02:00
|
|
|
}
|
|
|
|
|
2021-03-12 17:18:09 +01:00
|
|
|
if (RENDER_MODES.TEXT_MODES.includes(renderMode)) {
|
|
|
|
return (
|
2022-02-01 21:27:48 +01:00
|
|
|
<>
|
2021-03-12 17:18:09 +01:00
|
|
|
<FileTitleSection uri={uri} />
|
|
|
|
<FileRenderInitiator uri={uri} />
|
|
|
|
<FileRenderInline uri={uri} />
|
2022-02-01 21:27:48 +01:00
|
|
|
</>
|
2021-07-19 08:26:00 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (renderMode === RENDER_MODES.IMAGE) {
|
|
|
|
return (
|
2022-02-01 21:27:48 +01:00
|
|
|
<>
|
2021-07-19 08:26:00 +02:00
|
|
|
<div className="file-render--img-container">
|
|
|
|
<FileRenderInitiator uri={uri} />
|
|
|
|
<FileRenderInline uri={uri} />
|
|
|
|
</div>
|
|
|
|
<FileTitleSection uri={uri} />
|
2022-02-01 21:27:48 +01:00
|
|
|
</>
|
2021-03-12 17:18:09 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-04-01 20:43:50 +02:00
|
|
|
return (
|
2022-02-01 21:27:48 +01:00
|
|
|
<>
|
2021-01-08 16:21:27 +01:00
|
|
|
<FileRenderInitiator uri={uri} videoTheaterMode={videoTheaterMode} />
|
2020-04-01 20:43:50 +02:00
|
|
|
<FileRenderInline uri={uri} />
|
2021-03-11 18:08:11 +01:00
|
|
|
<FileTitleSection uri={uri} />
|
2022-02-01 21:27:48 +01:00
|
|
|
</>
|
2020-04-01 20:43:50 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-02-01 21:27:48 +01:00
|
|
|
const rightSideProps = { hasCollectionById, collectionId, uri };
|
|
|
|
|
2021-01-08 16:21:27 +01:00
|
|
|
if (obscureNsfw && isMature) {
|
2020-07-21 09:26:56 +02:00
|
|
|
return (
|
wip
wip
wip - everything but publish, autoplay, and styling
collection publishing
add channel to collection publish
cleanup
wip
bump
clear mass add after success
move collection item management controls
redirect replace to published collection id
bump
playlist selector on create
bump
use new collection add ui element
bump
wip
gitignore
add content json
wip
bump
context add to playlist
basic collections page style pass wip
wip: edits, buttons, styles...
change fileAuthor to claimAuthor
update, pending bugfixes, delete modal progress, collection header, other bugfixes
bump
cleaning
show page bugfix
builtin collection headers
no playlists, no grid title
wip
style tweaks
use normal looking claim previews for collection tiles
add collection changes
style library previews
collection menulist for delete/view on library
delete modal works for unpublished
rearrange collection publish tabs
clean up collection publishing and items
show on odysee
begin collectoin edit header and css renaming
better thumbnails
bump
fix collection publish redirect
view collection in menu does something
copy and thumbs
list previews, pending, context menus, list page
enter to add collection, lists page empty state
playable lists only, delete feature, bump
put fileListDownloaded back
better collection titles
improve collection claim details
fix horiz more icon
fix up channel page
style, copy, bump
refactor preview overlay properties,
fix reposts showing as floppydisk
add watch later toast,
small overlay properties on wunderbar results,
fix collection actions buttons
bump
cleanup
cleaning, refactoring
bump
preview thumb styling, cleanup
support discover page lists search
sync, bump
bump, fix sync more
enforce builtin order for now
new lists page empty state
try to indicate unpublished edits in lists
bump
fix autoplay and linting
consts, fix autoplay
bugs
fixes
cleanup
fix, bump
lists experimental ui, fixes
refactor listIndex out
hack in collection fallback thumb
bump
2021-02-06 08:03:51 +01:00
|
|
|
<Page className="file-page" filePage isMarkdown={isMarkdown}>
|
|
|
|
<div className={classnames('section card-stack', `file-page__${renderMode}`)}>
|
|
|
|
<FileTitleSection uri={uri} isNsfwBlocked />
|
|
|
|
</div>
|
2022-02-01 21:27:48 +01:00
|
|
|
{!isMarkdown && !videoTheaterMode && <RightSideContent {...rightSideProps} />}
|
2020-07-21 09:26:56 +02:00
|
|
|
</Page>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-02-04 21:59:11 +01:00
|
|
|
const commentsListProps = { uri, linkedCommentId };
|
2022-02-05 13:06:19 +01:00
|
|
|
const emptyMsgProps = { padded: !isMobile };
|
2022-02-02 13:44:33 +01:00
|
|
|
|
2020-10-20 19:10:02 +02:00
|
|
|
return (
|
2021-03-12 17:18:09 +01:00
|
|
|
<Page className="file-page" filePage isMarkdown={isMarkdown}>
|
|
|
|
<div className={classnames('section card-stack', `file-page__${renderMode}`)}>
|
2020-10-20 19:10:02 +02:00
|
|
|
{renderFilePageLayout()}
|
2020-09-11 19:51:31 +02:00
|
|
|
|
2021-03-12 17:18:09 +01:00
|
|
|
{!isMarkdown && (
|
2021-03-11 18:08:11 +01:00
|
|
|
<div className="file-page__secondary-content">
|
2022-02-02 13:48:24 +01:00
|
|
|
<section className="file-page__media-actions">
|
2021-07-22 20:21:31 +02:00
|
|
|
{claimIsMine && isLivestream && (
|
|
|
|
<div className="livestream__creator-message">
|
|
|
|
<h4>{__('Only visible to you')}</h4>
|
|
|
|
<I18nMessage>
|
|
|
|
People who view this link will be redirected to your livestream. Make sure to use this for sharing
|
|
|
|
so your title and thumbnail are displayed properly.
|
|
|
|
</I18nMessage>
|
|
|
|
<div className="section__actions">
|
|
|
|
<Button button="primary" navigate={`/$/${PAGES.LIVESTREAM}`} label={__('View livestream')} />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)}
|
2022-02-01 21:27:48 +01:00
|
|
|
|
2021-03-11 18:08:11 +01:00
|
|
|
{RENDER_MODES.FLOATING_MODES.includes(renderMode) && <FileTitleSection uri={uri} />}
|
2022-02-01 21:27:48 +01:00
|
|
|
|
2022-02-02 13:48:24 +01:00
|
|
|
<React.Suspense fallback={null}>
|
2022-02-05 13:06:19 +01:00
|
|
|
{contentCommentsDisabled ? (
|
|
|
|
<Empty {...emptyMsgProps} text={__('The creator of this content has disabled comments.')} />
|
|
|
|
) : commentSettingDisabled ? (
|
|
|
|
<Empty {...emptyMsgProps} text={__('This channel has disabled comments on their page.')} />
|
2022-02-04 21:59:11 +01:00
|
|
|
) : isMobile ? (
|
2022-02-02 13:48:24 +01:00
|
|
|
<>
|
|
|
|
<SwipeableDrawer
|
|
|
|
open={Boolean(showComments)}
|
|
|
|
toggleDrawer={() => setShowComments(!showComments)}
|
|
|
|
title={commentsListTitle}
|
|
|
|
>
|
2022-02-04 21:59:11 +01:00
|
|
|
<CommentsList {...commentsListProps} />
|
2022-02-02 13:48:24 +01:00
|
|
|
</SwipeableDrawer>
|
|
|
|
|
|
|
|
<DrawerExpandButton label={commentsListTitle} toggleDrawer={() => setShowComments(!showComments)} />
|
|
|
|
</>
|
|
|
|
) : (
|
2022-02-04 21:59:11 +01:00
|
|
|
<CommentsList {...commentsListProps} />
|
2022-02-02 13:48:24 +01:00
|
|
|
)}
|
|
|
|
</React.Suspense>
|
|
|
|
</section>
|
2022-02-02 13:44:33 +01:00
|
|
|
|
2022-02-01 21:27:48 +01:00
|
|
|
{!isMarkdown && videoTheaterMode && <RightSideContent {...rightSideProps} />}
|
2021-01-08 16:21:27 +01:00
|
|
|
</div>
|
2021-03-11 18:08:11 +01:00
|
|
|
)}
|
2020-10-20 19:10:02 +02:00
|
|
|
</div>
|
2022-02-01 21:27:48 +01:00
|
|
|
|
|
|
|
{!isMarkdown
|
|
|
|
? !videoTheaterMode && <RightSideContent {...rightSideProps} />
|
2022-02-05 13:06:19 +01:00
|
|
|
: !contentCommentsDisabled && (
|
2022-02-01 21:27:48 +01:00
|
|
|
<div className="file-page__post-comments">
|
|
|
|
<React.Suspense fallback={null}>
|
|
|
|
<CommentsList uri={uri} linkedCommentId={linkedCommentId} commentsAreExpanded />
|
|
|
|
</React.Suspense>
|
|
|
|
</div>
|
|
|
|
)}
|
2020-10-20 19:10:02 +02:00
|
|
|
</Page>
|
|
|
|
);
|
2017-05-05 07:10:37 +02:00
|
|
|
}
|
2017-05-01 21:59:40 +02:00
|
|
|
|
2022-02-01 21:27:48 +01:00
|
|
|
type RightSideProps = {
|
|
|
|
hasCollectionById?: boolean,
|
|
|
|
collectionId?: string,
|
|
|
|
uri: string,
|
|
|
|
};
|
|
|
|
|
|
|
|
const RightSideContent = (rightSideProps: RightSideProps) => {
|
|
|
|
const { hasCollectionById, collectionId, uri } = rightSideProps;
|
|
|
|
|
|
|
|
return hasCollectionById ? <CollectionContent id={collectionId} uri={uri} /> : <RecommendedContent uri={uri} />;
|
|
|
|
};
|