Skip to content

Commit b4ed3da

Browse files
authored
Merge pull request #152 from smalruby/merge/scratch-gui
scratch guiをマージしました
2 parents 1859be4 + 8ec84ef commit b4ed3da

38 files changed

+799
-145
lines changed

package.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"clean": "rimraf ./build && mkdirp build && rimraf ./dist && mkdirp dist",
99
"deploy": "touch build/.nojekyll && gh-pages -t -d build -m \"Build for $(git log --pretty=format:%H -n1)\"",
1010
"prune": "./prune-gh-pages.sh",
11-
"i18n:src": "rimraf ./translations/messages/src && babel src > tmp.js && rimraf tmp.js && build-i18n-src ./translations/messages/src ./translations/",
11+
"i18n:push": "tx-push-src scratch-editor interface translations/en.json",
12+
"i18n:src": "rimraf ./translations/messages/src && babel src > tmp.js && rimraf tmp.js && build-i18n-src ./translations/messages/src ./translations/ && npm run i18n:push",
1213
"start": "webpack-dev-server",
1314
"test": "npm run test:lint && npm run test:unit && npm run build && npm run test:integration",
1415
"test:integration": "jest --runInBand test[\\\\/]integration",
@@ -43,7 +44,7 @@
4344
"babel-loader": "^8.0.4",
4445
"base64-loader": "1.0.0",
4546
"bowser": "1.9.4",
46-
"chromedriver": "2.44.0",
47+
"chromedriver": "2.44.1",
4748
"classnames": "2.2.6",
4849
"computed-style-to-inline-style": "3.0.0",
4950
"copy-webpack-plugin": "^4.5.1",
@@ -72,6 +73,7 @@
7273
"lodash.isequal": "4.5.0",
7374
"lodash.omit": "4.5.0",
7475
"lodash.pick": "4.4.0",
76+
"lodash.throttle": "4.0.1",
7577
"minilog": "3.1.0",
7678
"mkdirp": "^0.5.1",
7779
"opal-runtime": "^1.0.11",
@@ -104,13 +106,13 @@
104106
"redux-throttle": "0.1.1",
105107
"rimraf": "^2.6.1",
106108
"scratch-audio": "0.1.0-prerelease.20181023202904",
107-
"scratch-blocks": "0.1.0-prerelease.1542722191",
108-
"scratch-l10n": "3.0.20181121224721",
109-
"scratch-paint": "0.2.0-prerelease.20181128182047",
109+
"scratch-blocks": "0.1.0-prerelease.1544217251",
110+
"scratch-l10n": "3.1.20181206185857",
111+
"scratch-paint": "0.2.0-prerelease.20181203192800",
110112
"scratch-render": "0.1.0-prerelease.20181127194508",
111113
"scratch-storage": "1.2.0",
112114
"scratch-svg-renderer": "0.2.0-prerelease.20181126212715",
113-
"scratch-vm": "0.2.0-prerelease.20181129211442",
115+
"scratch-vm": "0.2.0-prerelease.20181207201549",
114116
"selenium-webdriver": "3.6.0",
115117
"startaudiocontext": "1.2.1",
116118
"style-loader": "^0.23.0",

src/components/alerts/inline-message.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
.inline-message {
55
color: $ui-white;
6-
font-family: "Helvetica Neue";
6+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
77
display: flex;
88
justify-content: end;
99
align-items: center;

src/components/gui/gui.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ const GUIComponent = props => {
8383
enableCommunity,
8484
importInfoVisible,
8585
intl,
86+
isCreating,
8687
isPlayerOnly,
8788
isRtl,
8889
isShared,
@@ -135,7 +136,8 @@ const GUIComponent = props => {
135136
return isPlayerOnly ? (
136137
<StageWrapper
137138
isRendererSupported={isRendererSupported}
138-
stageSize={stageSize}
139+
isRtl={isRtl}
140+
stageSize={STAGE_SIZE_MODES.large}
139141
vm={vm}
140142
>
141143
{alertsVisible ? (
@@ -151,6 +153,9 @@ const GUIComponent = props => {
151153
{loading ? (
152154
<Loader />
153155
) : null}
156+
{isCreating ? (
157+
<Loader messageId="gui.loader.creating" />
158+
) : null}
154159
{importInfoVisible ? (
155160
<ImportModal />
156161
) : null}
@@ -376,6 +381,7 @@ GUIComponent.propTypes = {
376381
enableCommunity: PropTypes.bool,
377382
importInfoVisible: PropTypes.bool,
378383
intl: intlShape.isRequired,
384+
isCreating: PropTypes.bool,
379385
isPlayerOnly: PropTypes.bool,
380386
isRtl: PropTypes.bool,
381387
isShared: PropTypes.bool,
@@ -417,7 +423,9 @@ GUIComponent.defaultProps = {
417423
canShare: false,
418424
canUseCloud: false,
419425
enableCommunity: false,
426+
isCreating: false,
420427
isShared: false,
428+
loading: false,
421429
onUpdateProjectTitle: () => {},
422430
showComingSoon: false,
423431
stageSizeMode: STAGE_SIZE_MODES.large

src/components/library-item/library-item.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
border-color: $motion-primary;
3131
}
3232

33+
.hidden {
34+
display: none;
35+
}
36+
3337
.disabled {
3438
opacity: .5;
3539
cursor: auto;

src/components/library-item/library-item.jsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ class LibraryItem extends React.PureComponent {
5555
{
5656
[styles.disabled]: this.props.disabled
5757
},
58-
this.props.extensionId ? styles.libraryItemExtension : null
58+
this.props.extensionId ? styles.libraryItemExtension : null,
59+
this.props.hidden ? styles.hidden : null
5960
)}
6061
onClick={this.handleClick}
6162
>
@@ -139,7 +140,10 @@ class LibraryItem extends React.PureComponent {
139140
</div>
140141
) : (
141142
<Box
142-
className={styles.libraryItem}
143+
className={classNames(
144+
styles.libraryItem,
145+
this.props.hidden ? styles.hidden : null
146+
)}
143147
role="button"
144148
tabIndex="0"
145149
onBlur={this.handleBlur}
@@ -174,14 +178,15 @@ LibraryItem.propTypes = {
174178
disabled: PropTypes.bool,
175179
extensionId: PropTypes.string,
176180
featured: PropTypes.bool,
177-
iconURL: PropTypes.string.isRequired,
181+
hidden: PropTypes.bool,
182+
iconURL: PropTypes.string,
178183
id: PropTypes.number.isRequired,
179184
insetIconURL: PropTypes.string,
180185
internetConnectionRequired: PropTypes.bool,
181186
name: PropTypes.oneOfType([
182187
PropTypes.string,
183188
PropTypes.node
184-
]).isRequired,
189+
]),
185190
onBlur: PropTypes.func,
186191
onFocus: PropTypes.func,
187192
onMouseEnter: PropTypes.func.isRequired,

src/components/library/library.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ class LibraryComponent extends React.Component {
9898
(dataItem.tags || [])
9999
// Second argument to map sets `this`
100100
.map(String.prototype.toLowerCase.call, String.prototype.toLowerCase)
101-
.concat((typeof dataItem.name === 'string' ?
101+
.concat(dataItem.name ?
102+
(typeof dataItem.name === 'string' ?
102103
// Use the name if it is a string, else use formatMessage to get the translated name
103-
dataItem.name : this.props.intl.formatMessage(dataItem.name.props)
104-
).toLowerCase())
104+
dataItem.name : this.props.intl.formatMessage(dataItem.name.props)
105+
).toLowerCase() :
106+
null)
105107
.join('\n') // unlikely to partially match newlines
106108
.indexOf(this.state.filterQuery.toLowerCase()) !== -1
107109
));
@@ -182,6 +184,7 @@ class LibraryComponent extends React.Component {
182184
disabled={dataItem.disabled}
183185
extensionId={dataItem.extensionId}
184186
featured={dataItem.featured}
187+
hidden={dataItem.hidden}
185188
iconURL={scratchURL}
186189
id={index}
187190
insetIconURL={dataItem.insetIconURL}
@@ -212,7 +215,7 @@ LibraryComponent.propTypes = {
212215
name: PropTypes.oneOfType([
213216
PropTypes.string,
214217
PropTypes.node
215-
]).isRequired,
218+
]),
216219
rawURL: PropTypes.string
217220
})
218221
/* eslint-enable react/no-unused-prop-types, lines-around-comment */

src/components/loader/loader.jsx

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React from 'react';
22
import {FormattedMessage} from 'react-intl';
33
import styles from './loader.css';
4+
import PropTypes from 'prop-types';
45

56
import topBlock from './top-block.svg';
67
import middleBlock from './middle-block.svg';
@@ -97,6 +98,22 @@ const messages = [
9798
weight: 1
9899
}
99100
];
101+
const mainMessages = {
102+
'gui.loader.headline': (
103+
<FormattedMessage
104+
defaultMessage="Loading Project"
105+
description="Main loading message"
106+
id="gui.loader.headline"
107+
/>
108+
),
109+
'gui.loader.creating': (
110+
<FormattedMessage
111+
defaultMessage="Creating Project"
112+
description="Main creating message"
113+
id="gui.loader.creating"
114+
/>
115+
)
116+
};
100117

101118
class LoaderComponent extends React.Component {
102119
constructor (props) {
@@ -148,11 +165,7 @@ class LoaderComponent extends React.Component {
148165
/>
149166
</div>
150167
<div className={styles.title}>
151-
<FormattedMessage
152-
defaultMessage="Loading Project"
153-
description="Main loading message"
154-
id="gui.loader.headline"
155-
/>
168+
{mainMessages[this.props.messageId]}
156169
</div>
157170
<div className={styles.messageContainerOuter}>
158171
<div
@@ -175,4 +188,11 @@ class LoaderComponent extends React.Component {
175188
}
176189
}
177190

191+
LoaderComponent.propTypes = {
192+
messageId: PropTypes.string
193+
};
194+
LoaderComponent.defaultProps = {
195+
messageId: 'gui.loader.headline'
196+
};
197+
178198
export default LoaderComponent;

src/components/menu-bar/community-button.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ const CommunityButton = ({
2121
onClick={onClick}
2222
>
2323
<FormattedMessage
24-
defaultMessage="See Community"
25-
description="Label for see community button"
26-
id="gui.menuBar.seeCommunity"
24+
defaultMessage="See Project Page"
25+
description="Label for see project page button"
26+
id="gui.menuBar.seeProjectPage"
2727
/>
2828
</Button>
2929
);

src/components/menu-bar/menu-bar.jsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import ShareButton from './share-button.jsx';
1313
import {ComingSoonTooltip} from '../coming-soon/coming-soon.jsx';
1414
import Divider from '../divider/divider.jsx';
1515
import LanguageSelector from '../../containers/language-selector.jsx';
16-
import InlineMessages from '../../containers/inline-messages.jsx';
16+
import SaveStatus from './save-status.jsx';
1717
import SBFileUploader from '../../containers/sb-file-uploader.jsx';
1818
import ProjectWatcher from '../../containers/project-watcher.jsx';
1919
import MenuBarMenu from './menu-bar-menu.jsx';
@@ -69,6 +69,13 @@ import smalrubyLogo from './hatti.svg';
6969

7070
import {updateRubyCodeTarget} from '../../reducers/ruby-code';
7171

72+
const messages = defineMessages({
73+
confirmNav: {
74+
id: 'gui.menuBar.confirmNewWithoutSaving',
75+
defaultMessage: 'Replace contents of the current project?',
76+
description: 'message for prompting user to confirm that they want to create new project without saving'
77+
}
78+
});
7279
const ariaMessages = defineMessages({
7380
language: {
7481
id: 'gui.menuBar.LanguageSelector',
@@ -157,7 +164,7 @@ class MenuBar extends React.Component {
157164
// if canSave===true and canCreateNew===true, it's safe to replace current project,
158165
// since we will auto-save first. Else, confirm first.
159166
const readyToReplaceProject = (this.props.canSave && this.props.canCreateNew) ||
160-
confirm('Replace contents of the current project?'); // eslint-disable-line no-alert
167+
confirm(this.props.intl.formatMessage(messages.confirmNav)); // eslint-disable-line no-alert
161168
this.props.onRequestCloseFile();
162169
if (readyToReplaceProject) {
163170
this.props.onClickNew(this.props.canSave && this.props.canCreateNew);
@@ -572,7 +579,9 @@ class MenuBar extends React.Component {
572579
logged in, and whether a session is available to log in with */}
573580
<div className={styles.accountInfoGroup}>
574581
<div className={styles.menuBarItem}>
575-
<InlineMessages />
582+
{this.props.canSave && (
583+
<SaveStatus />
584+
)}
576585
</div>
577586
{this.props.sessionExists ? (
578587
this.props.username ? (
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.save-now {
2+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
3+
cursor: pointer;
4+
}

0 commit comments

Comments
 (0)