Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 5 additions & 7 deletions src/components/player/content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import cx from 'classnames';
import Presentation from 'components/presentation';
import TldrawPresentation from 'components/tldraw';
import TldrawPresentationV2 from 'components/tldraw_v2';
import { getTldrawBbbVersion } from 'utils/tldraw';
import { getTldrawBbbVersion, isTldrawWhiteboard as isTldraw } from 'utils/tldraw';
import { useCurrentInterval, useShouldShowScreenShare } from 'components/utils/hooks';
import Screenshare from 'components/screenshare';
import Thumbnails from 'components/thumbnails';
Expand All @@ -30,12 +30,10 @@ const Content = ({

if (layout.single) return null;

const isTldrawWhiteboard = storage.tldraw.length ||
storage.panzooms.tldraw ||
storage.cursor.tldraw;
const isTldrawWhiteboard = isTldraw();

let presentation;

if (isTldrawWhiteboard) {
const bbbVersion = getTldrawBbbVersion(index);

Expand All @@ -62,7 +60,7 @@ const Content = ({
{presentation}
{layout.screenshare ? (
// video-js doesn't mount properly when not mounted in time
<span style={!shouldShowScreenshare ?{
<span style={!shouldShowScreenshare ? {
display: 'none',
width: '100%',
height: '100%'
Expand All @@ -72,7 +70,7 @@ const Content = ({
}}>
<Screenshare />
</span>
): null}
) : null}
</div>
<div className={cx('bottom-content', { 'inactive': fullscreen })}>
<Thumbnails
Expand Down
8 changes: 7 additions & 1 deletion src/utils/builder.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { parseFromString } from './data/xml2json';
import { files as config } from 'config';
import { getFileType, caseInsensitiveReducer } from './data';
import { isTldrawWhiteboard } from './tldraw';
import {
hasProperty,
isEmpty,
Expand Down Expand Up @@ -56,16 +57,21 @@ const buildAlternates = result => {
if (!result) return [];

let data = [];
const useSvg = isTldrawWhiteboard();

for (const presentation in result) {
if (hasProperty(result, presentation)) {
const slides = result[presentation];

for (const slide in slides) {
if (hasProperty(slides, slide)) {
const text = slides[slide];
const slidepath = slide.replace('-', '');

data.push({
src: `presentation/${presentation}/${slide}.png`,
src: useSvg
? `presentation/${presentation}/svgs/${slidepath}.svg`
: `presentation/${presentation}/${slide}.png`,
text,
});
}
Expand Down
7 changes: 7 additions & 0 deletions src/utils/tldraw.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,19 @@ const setupColorThemePaletteOverrides = () => {
};
};

const isTldrawWhiteboard = () => {
return (storage.tldraw && storage.tldraw.length > 0) ||
(storage.panzooms && storage.panzooms.tldraw) ||
(storage.cursor && storage.cursor.tldraw);
};

export {
getTldrawBbbVersion,
getTldrawData,
getViewBox,
createTldrawImageAsset,
createTldrawBackgroundShape,
createTldrawCursorShape,
isTldrawWhiteboard,
setupColorThemePaletteOverrides,
};