GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — snoopymod.github.io/src/playground/player.jsx at develop · SnoopyMod/snoopymod.github.io Expand file tree/ Copy pathplayer.jsxMore file actions 64 lines (52 loc) · 1.83 KB / Copy pathplayer.jsxFile metadata and controls64 lines (52 loc) · 1.83 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 import classNames from 'classnames'; import PropTypes from 'prop-types'; import React from 'react'; import ReactDOM from 'react-dom'; import {connect} from 'react-redux'; import {compose} from 'redux'; import Box from '../components/box/box.jsx'; import GUI from '../containers/gui.jsx'; import HashParserHOC from '../lib/hash-parser-hoc.jsx'; import AppStateHOC from '../lib/app-state-hoc.jsx'; import {setPlayer} from '../reducers/mode'; if (process.env.NODE_ENV === 'production' && typeof window === 'object') { // Warn before navigating away window.onbeforeunload = () => true; } import styles from './player.css'; const Player = ({isPlayerOnly, onSeeInside, projectId}) => ( <Box className={classNames(isPlayerOnly ? styles.stageOnly : styles.editor)}> {isPlayerOnly && <button onClick={onSeeInside}>{'See inside'}</button>} <GUI canEditTitle enableCommunity isPlayerOnly={isPlayerOnly} projectId={projectId} /> </Box> ); Player.propTypes = { isPlayerOnly: PropTypes.bool, onSeeInside: PropTypes.func, projectId: PropTypes.string }; const mapStateToProps = state => ({ isPlayerOnly: state.scratchGui.mode.isPlayerOnly }); const mapDispatchToProps = dispatch => ({ onSeeInside: () => dispatch(setPlayer(false)) }); const ConnectedPlayer = connect( mapStateToProps, mapDispatchToProps )(Player); // note that redux's 'compose' function is just being used as a general utility to make // the hierarchy of HOC constructor calls clearer here; it has nothing to do with redux's // ability to compose reducers. const WrappedPlayer = compose( AppStateHOC, HashParserHOC )(ConnectedPlayer); const appTarget = document.createElement('div'); document.body.appendChild(appTarget); ReactDOM.render(<WrappedPlayer isPlayerOnly />, appTarget); |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |