Spaces:
Runtime error
Runtime error
File size: 6,418 Bytes
8fd7a1d |
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
import PropTypes from 'prop-types';
import React from 'react';
import Modal from '../../containers/windowed-modal.jsx';
import Box from '../box/box.jsx';
import ColorPicker from './color-picker.jsx';
import {defineMessages, injectIntl, intlShape, FormattedMessage} from 'react-intl';
import booleanInputIcon from './icon--boolean-input.svg';
import textInputIcon from './icon--text-input.svg';
import labelIcon from './icon--label.svg';
import styles from './custom-procedures.css';
const messages = defineMessages({
myblockModalTitle: {
defaultMessage: 'Make a Block',
description: 'Title for the modal where you create a custom block.',
id: 'gui.customProcedures.myblockModalTitle'
}
});
const CustomProcedures = props => (
<Modal
className={styles.modalContent}
contentLabel={props.intl.formatMessage(messages.myblockModalTitle)}
onRequestClose={props.onCancel}
id="customProceduresModal"
>
<Box
className={styles.workspace}
componentRef={props.componentRef}
/>
<Box className={styles.body}>
<div className={styles.optionsRow}>
<div
className={styles.optionCard}
role="button"
tabIndex="0"
onClick={props.onAddTextNumber}
>
<img
className={styles.optionIcon}
src={textInputIcon}
draggable={false}
/>
<div className={styles.optionTitle}>
<FormattedMessage
defaultMessage="Add an input"
description="Label for button to add a number/text input"
id="gui.customProcedures.addAnInputNumberText"
/>
</div>
<div className={styles.optionDescription}>
<FormattedMessage
defaultMessage="number or text"
description="Description of the number/text input type"
id="gui.customProcedures.numberTextType"
/>
</div>
</div>
<div
className={styles.optionCard}
role="button"
tabIndex="0"
onClick={props.onAddBoolean}
>
<img
className={styles.optionIcon}
src={booleanInputIcon}
draggable={false}
/>
<div className={styles.optionTitle}>
<FormattedMessage
defaultMessage="Add an input"
description="Label for button to add a boolean input"
id="gui.customProcedures.addAnInputBoolean"
/>
</div>
<div className={styles.optionDescription}>
<FormattedMessage
defaultMessage="boolean"
description="Description of the boolean input type"
id="gui.customProcedures.booleanType"
/>
</div>
</div>
<div
className={styles.optionCard}
role="button"
tabIndex="0"
onClick={props.onAddLabel}
>
<img
className={styles.optionIcon}
src={labelIcon}
draggable={false}
/>
<div className={styles.optionTitle}>
<FormattedMessage
defaultMessage="Add a label"
description="Label for button to add a label"
id="gui.customProcedures.addALabel"
/>
</div>
</div>
</div>
<div className={styles.checkboxRow}>
<label>
<input
checked={props.warp}
type="checkbox"
onChange={props.onToggleWarp}
/>
<FormattedMessage
defaultMessage="Run without screen refresh"
description="Label for checkbox to run without screen refresh"
id="gui.customProcedures.runWithoutScreenRefresh"
/>
</label>
</div>
<ColorPicker
color={props.color || '#FF6680'}
onColorChange={props.onColorChange}
/>
<Box className={styles.buttonRow}>
<button
className={styles.cancelButton}
onClick={props.onCancel}
>
<FormattedMessage
defaultMessage="Cancel"
description="Label for button to cancel custom procedure edits"
id="gui.customProcedures.cancel"
/>
</button>
<button
className={styles.okButton}
onClick={props.onOk}
>
<FormattedMessage
defaultMessage="OK"
description="Label for button to save new custom procedure"
id="gui.customProcedures.ok"
/>
</button>
</Box>
</Box>
</Modal>
);
CustomProcedures.propTypes = {
color: PropTypes.string,
componentRef: PropTypes.func.isRequired,
intl: intlShape,
onAddBoolean: PropTypes.func.isRequired,
onAddLabel: PropTypes.func.isRequired,
onAddTextNumber: PropTypes.func.isRequired,
onCancel: PropTypes.func.isRequired,
onColorChange: PropTypes.func.isRequired,
onOk: PropTypes.func.isRequired,
onToggleWarp: PropTypes.func.isRequired,
warp: PropTypes.bool.isRequired
};
export default injectIntl(CustomProcedures);
|