Skip to content
Snippets Groups Projects
Unverified Commit c05a9368 authored by chrisgarrity's avatar chrisgarrity Committed by GitHub
Browse files

Merge pull request #3946 from chrisgarrity/feature/3942-embed-project

Feature/3942 embed project
parents cee2fb12 ad328c06
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,12 @@
padding-bottom: $space;
}
.embed-scratch-logo img {
height: 1.6rem;
vertical-align: middle;
opacity: .6;
}
.stage-size-row {
display: flex;
}
......
......@@ -16,6 +16,7 @@ import largeStageIcon from './icon--large-stage.svg';
import smallStageIcon from './icon--small-stage.svg';
import unFullScreenIcon from './icon--unfullscreen.svg';
import scratchLogo from '../menu-bar/scratch-logo.svg';
import styles from './stage-header.css';
const messages = defineMessages({
......@@ -55,6 +56,7 @@ const StageHeaderComponent = function (props) {
onSetStageSmall,
onSetStageFull,
onSetStageUnFull,
showBranding,
stageSizeMode,
vm
} = props;
......@@ -63,6 +65,34 @@ const StageHeaderComponent = function (props) {
if (isFullScreen) {
const stageDimensions = getStageDimensions(null, true);
const stageButton = showBranding ? (
<div className={styles.embedScratchLogo}>
<a
href="https://scratch.mit.edu"
rel="noopener noreferrer"
target="_blank"
>
<img
alt="Scratch"
src={scratchLogo}
/>
</a>
</div>
) : (
<Button
className={styles.stageButton}
onClick={onSetStageUnFull}
onKeyPress={onKeyPress}
>
<img
alt={props.intl.formatMessage(messages.unFullStageSizeMessage)}
className={styles.stageButtonIcon}
draggable={false}
src={unFullScreenIcon}
title={props.intl.formatMessage(messages.fullscreenControl)}
/>
</Button>
);
header = (
<Box className={styles.stageHeaderWrapperOverlay}>
<Box
......@@ -70,19 +100,7 @@ const StageHeaderComponent = function (props) {
style={{width: stageDimensions.width}}
>
<Controls vm={vm} />
<Button
className={styles.stageButton}
onClick={onSetStageUnFull}
onKeyPress={onKeyPress}
>
<img
alt={props.intl.formatMessage(messages.unFullStageSizeMessage)}
className={styles.stageButtonIcon}
draggable={false}
src={unFullScreenIcon}
title={props.intl.formatMessage(messages.fullscreenControl)}
/>
</Button>
{stageButton}
</Box>
</Box>
);
......@@ -171,6 +189,7 @@ StageHeaderComponent.propTypes = {
onSetStageLarge: PropTypes.func.isRequired,
onSetStageSmall: PropTypes.func.isRequired,
onSetStageUnFull: PropTypes.func.isRequired,
showBranding: PropTypes.bool.isRequired,
stageSizeMode: PropTypes.oneOf(Object.keys(STAGE_SIZE_MODES)),
vm: PropTypes.instanceOf(VM).isRequired
};
......
......@@ -46,12 +46,14 @@ StageHeader.propTypes = {
isFullScreen: PropTypes.bool,
isPlayerOnly: PropTypes.bool,
onSetStageUnFull: PropTypes.func.isRequired,
showBranding: PropTypes.bool,
stageSizeMode: PropTypes.oneOf(Object.keys(STAGE_SIZE_MODES)),
vm: PropTypes.instanceOf(VM).isRequired
};
const mapStateToProps = state => ({
stageSizeMode: state.scratchGui.stageSize.stageSize,
showBranding: state.scratchGui.mode.showBranding,
isFullScreen: state.scratchGui.mode.isFullScreen,
isPlayerOnly: state.scratchGui.mode.isPlayerOnly
});
......
import GUI from './containers/gui.jsx';
import AppStateHOC from './lib/app-state-hoc.jsx';
import GuiReducer, {guiInitialState, guiMiddleware, initFullScreen, initPlayer} from './reducers/gui';
import GuiReducer, {guiInitialState, guiMiddleware, initEmbedded, initFullScreen, initPlayer} from './reducers/gui';
import LocalesReducer, {localesInitialState, initLocale} from './reducers/locales';
import {ScratchPaintReducer} from 'scratch-paint';
import {setFullScreen, setPlayer} from './reducers/mode';
......@@ -20,6 +20,7 @@ export {
guiReducers,
guiInitialState,
guiMiddleware,
initEmbedded,
initPlayer,
initFullScreen,
initLocale,
......
......@@ -83,6 +83,19 @@ const initFullScreen = function (currentState) {
);
};
const initEmbedded = function (currentState) {
return Object.assign(
{},
currentState,
{mode: {
showBranding: true,
isFullScreen: true,
isPlayerOnly: true,
hasEverEnteredEditor: false
}}
);
};
const initTutorialCard = function (currentState, deckId) {
return Object.assign(
{},
......@@ -145,6 +158,7 @@ export {
guiReducer as default,
guiInitialState,
guiMiddleware,
initEmbedded,
initFullScreen,
initPlayer,
initPreviewInfo,
......
......@@ -2,6 +2,7 @@ const SET_FULL_SCREEN = 'scratch-gui/mode/SET_FULL_SCREEN';
const SET_PLAYER = 'scratch-gui/mode/SET_PLAYER';
const initialState = {
showBranding: false,
isFullScreen: false,
isPlayerOnly: false,
hasEverEnteredEditor: true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment