@@ -4,15 +4,13 @@ import {compose} from 'redux';
4
4
import { connect } from 'react-redux' ;
5
5
import ReactModal from 'react-modal' ;
6
6
import VM from 'scratch-vm' ;
7
- import { defineMessages , injectIntl , intlShape } from 'react-intl' ;
7
+ import { injectIntl , intlShape } from 'react-intl' ;
8
8
9
9
import ErrorBoundaryHOC from '../lib/error-boundary-hoc.jsx' ;
10
10
import {
11
11
getIsError ,
12
- getIsShowingProject ,
13
- getIsShowingWithoutId
12
+ getIsShowingProject
14
13
} from '../reducers/project-state' ;
15
- import { setProjectTitle } from '../reducers/project-title' ;
16
14
import {
17
15
activateTab ,
18
16
BLOCKS_TAB_INDEX ,
@@ -30,6 +28,7 @@ import {
30
28
import FontLoaderHOC from '../lib/font-loader-hoc.jsx' ;
31
29
import LocalizationHOC from '../lib/localization-hoc.jsx' ;
32
30
import ProjectFetcherHOC from '../lib/project-fetcher-hoc.jsx' ;
31
+ import TitledHOC from '../lib/titled-hoc.jsx' ;
33
32
import ProjectSaverHOC from '../lib/project-saver-hoc.jsx' ;
34
33
import QueryParserHOC from '../lib/query-parser-hoc.jsx' ;
35
34
import storage from '../lib/storage' ;
@@ -40,45 +39,21 @@ import cloudManagerHOC from '../lib/cloud-manager-hoc.jsx';
40
39
import GUIComponent from '../components/gui/gui.jsx' ;
41
40
import { setIsScratchDesktop } from '../lib/isScratchDesktop.js' ;
42
41
43
- const messages = defineMessages ( {
44
- defaultProjectTitle : {
45
- id : 'gui.gui.defaultProjectTitle' ,
46
- description : 'Default title for project' ,
47
- defaultMessage : 'Scratch Project'
48
- }
49
- } ) ;
50
-
51
42
class GUI extends React . Component {
52
43
componentDidMount ( ) {
53
44
setIsScratchDesktop ( this . props . isScratchDesktop ) ;
54
- this . setReduxTitle ( this . props . projectTitle ) ;
55
45
this . props . onStorageInit ( storage ) ;
56
46
this . props . onVmInit ( this . props . vm ) ;
57
47
}
58
48
componentDidUpdate ( prevProps ) {
59
49
if ( this . props . projectId !== prevProps . projectId && this . props . projectId !== null ) {
60
50
this . props . onUpdateProjectId ( this . props . projectId ) ;
61
51
}
62
- if ( this . props . projectTitle !== prevProps . projectTitle ) {
63
- this . setReduxTitle ( this . props . projectTitle ) ;
64
- }
65
52
if ( this . props . isShowingProject && ! prevProps . isShowingProject ) {
66
53
// this only notifies container when a project changes from not yet loaded to loaded
67
54
// At this time the project view in www doesn't need to know when a project is unloaded
68
55
this . props . onProjectLoaded ( ) ;
69
56
}
70
- if ( this . props . isShowingWithoutId && ! prevProps . isShowingWithoutId ) {
71
- this . props . onUpdateProjectTitle ( this . props . intl . formatMessage ( messages . defaultProjectTitle ) ) ;
72
- }
73
- }
74
- setReduxTitle ( newTitle ) {
75
- if ( newTitle === null || typeof newTitle === 'undefined' ) {
76
- this . props . onUpdateReduxProjectTitle (
77
- this . props . intl . formatMessage ( messages . defaultProjectTitle )
78
- ) ;
79
- } else {
80
- this . props . onUpdateReduxProjectTitle ( newTitle ) ;
81
- }
82
57
}
83
58
render ( ) {
84
59
if ( this . props . isError ) {
@@ -96,11 +71,9 @@ class GUI extends React.Component {
96
71
onProjectLoaded,
97
72
onStorageInit,
98
73
onUpdateProjectId,
99
- onUpdateReduxProjectTitle,
100
74
onVmInit,
101
75
projectHost,
102
76
projectId,
103
- projectTitle,
104
77
/* eslint-enable no-unused-vars */
105
78
children,
106
79
fetchingProject,
@@ -137,11 +110,9 @@ GUI.propTypes = {
137
110
onStorageInit : PropTypes . func ,
138
111
onUpdateProjectId : PropTypes . func ,
139
112
onUpdateProjectTitle : PropTypes . func ,
140
- onUpdateReduxProjectTitle : PropTypes . func ,
141
113
onVmInit : PropTypes . func ,
142
114
projectHost : PropTypes . string ,
143
115
projectId : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . number ] ) ,
144
- projectTitle : PropTypes . string ,
145
116
telemetryModalVisible : PropTypes . bool ,
146
117
vm : PropTypes . instanceOf ( VM ) . isRequired
147
118
} ;
@@ -151,7 +122,6 @@ GUI.defaultProps = {
151
122
onStorageInit : storageInstance => storageInstance . addOfficialScratchWebStores ( ) ,
152
123
onProjectLoaded : ( ) => { } ,
153
124
onUpdateProjectId : ( ) => { } ,
154
- onUpdateProjectTitle : ( ) => { } ,
155
125
onVmInit : ( /* vm */ ) => { }
156
126
} ;
157
127
@@ -172,7 +142,6 @@ const mapStateToProps = state => {
172
142
isPlayerOnly : state . scratchGui . mode . isPlayerOnly ,
173
143
isRtl : state . locales . isRtl ,
174
144
isShowingProject : getIsShowingProject ( loadingState ) ,
175
- isShowingWithoutId : getIsShowingWithoutId ( loadingState ) ,
176
145
loadingStateVisible : state . scratchGui . modals . loadingProject ,
177
146
projectId : state . scratchGui . projectState . projectId ,
178
147
soundsTabVisible : state . scratchGui . editorTab . activeTabIndex === SOUNDS_TAB_INDEX ,
@@ -193,8 +162,7 @@ const mapDispatchToProps = dispatch => ({
193
162
onActivateSoundsTab : ( ) => dispatch ( activateTab ( SOUNDS_TAB_INDEX ) ) ,
194
163
onRequestCloseBackdropLibrary : ( ) => dispatch ( closeBackdropLibrary ( ) ) ,
195
164
onRequestCloseCostumeLibrary : ( ) => dispatch ( closeCostumeLibrary ( ) ) ,
196
- onRequestCloseTelemetryModal : ( ) => dispatch ( closeTelemetryModal ( ) ) ,
197
- onUpdateReduxProjectTitle : title => dispatch ( setProjectTitle ( title ) )
165
+ onRequestCloseTelemetryModal : ( ) => dispatch ( closeTelemetryModal ( ) )
198
166
} ) ;
199
167
200
168
const ConnectedGUI = injectIntl ( connect (
@@ -211,6 +179,7 @@ const WrappedGui = compose(
211
179
FontLoaderHOC ,
212
180
QueryParserHOC ,
213
181
ProjectFetcherHOC ,
182
+ TitledHOC ,
214
183
ProjectSaverHOC ,
215
184
vmListenerHOC ,
216
185
vmManagerHOC ,
0 commit comments