Skip to content

Commit 8b13d10

Browse files
committed
fix: use showVideos prop instead of prop in cards component
1 parent 077b34f commit 8b13d10

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

packages/scratch-gui/src/components/cards/cards.jsx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import closeIcon from './icon--close.svg';
1818
import {translateVideo} from '../../lib/libraries/decks/translate-video.js';
1919
import {translateImage} from '../../lib/libraries/decks/translate-image.js';
2020

21-
import {PLATFORM} from '../../lib/platform.js';
22-
2321
const CardHeader = ({onCloseCards, onShrinkExpandCards, onShowAll, totalSteps, step, expanded}) => (
2422
<div className={expanded ? styles.headerButtons : classNames(styles.headerButtons, styles.headerButtonsHidden)}>
2523
<div
@@ -295,7 +293,7 @@ const Cards = props => {
295293
onPrevStep,
296294
step,
297295
expanded,
298-
platform,
296+
showVideos,
299297
...posProps
300298
} = props;
301299
let {x, y} = posProps;
@@ -362,20 +360,18 @@ const Cards = props => {
362360
/>
363361
) : (
364362
steps[step].video ? (
365-
platform === PLATFORM.DESKTOP ?
366-
// Assume user is offline and don't attempt to
367-
// download videos
363+
showVideos ?
368364
(
369-
<ImageStep
370-
image={content[activeDeckId].img}
371-
title={content[activeDeckId].name}
372-
/>
373-
) : (
374365
<VideoStep
375366
dragging={dragging}
376367
expanded={expanded}
377368
video={translateVideo(steps[step].video, locale)}
378369
/>
370+
) : (
371+
<ImageStep
372+
image={content[activeDeckId].img}
373+
title={content[activeDeckId].name}
374+
/>
379375
)
380376
) : (
381377
<ImageStep
@@ -426,7 +422,7 @@ Cards.propTypes = {
426422
onShowAll: PropTypes.func,
427423
onShrinkExpandCards: PropTypes.func.isRequired,
428424
onStartDrag: PropTypes.func,
429-
platform: PropTypes.oneOf(Object.keys(PLATFORM)),
425+
showVideos: PropTypes.bool,
430426
step: PropTypes.number.isRequired,
431427
x: PropTypes.number,
432428
y: PropTypes.number

packages/scratch-gui/src/containers/cards.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ class Cards extends React.Component {
4141

4242
Cards.propTypes = {
4343
locale: PropTypes.string.isRequired,
44-
platform: PropTypes.oneOf(Object.keys(PLATFORM))
4544
};
4645

4746
const mapStateToProps = state => ({
@@ -55,7 +54,9 @@ const mapStateToProps = state => ({
5554
isRtl: state.locales.isRtl,
5655
locale: state.locales.locale,
5756
dragging: state.scratchGui.cards.dragging,
58-
platform: state.scratchGui.platform.platform
57+
// Assume user is offline and don't attempt to
58+
// download and show videos
59+
showVideos: state.scratchGui.platform.platform !== PLATFORM.DESKTOP
5960
});
6061

6162
const mapDispatchToProps = dispatch => ({

0 commit comments

Comments
 (0)