Skip to content

Commit 06f9050

Browse files
committed
♻️ dry up <MobileIDEView /> imports
1 parent 682db4d commit 06f9050

File tree

1 file changed

+13
-61
lines changed

1 file changed

+13
-61
lines changed

client/modules/IDE/pages/MobileIDEView.jsx

Lines changed: 13 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { bindActionCreators } from 'redux';
1111
import * as FileActions from '../actions/files';
1212
import * as IDEActions from '../actions/ide';
1313
import * as ProjectActions from '../actions/project';
14-
import * as EditorAccessibilityActions from '../actions/editorAccessibility';
1514
import * as PreferencesActions from '../actions/preferences';
1615
import * as UserActions from '../../User/actions';
1716
import * as ToastActions from '../actions/toast';
@@ -74,14 +73,15 @@ const getNatOptions = (username = undefined) =>
7473

7574
const MobileIDEView = (props) => {
7675
const {
77-
ide, project, selectedFile, user, params,
76+
ide, project, selectedFile, user, params, unsavedChanges,
7877
stopSketch, startSketch, getProject, clearPersistedState
7978
} = props;
8079

8180
const [tmController, setTmController] = useState(null); // eslint-disable-line
8281

8382
const { username } = user;
84-
const { unsavedChanges } = ide;
83+
const { consoleIsExpanded } = ide;
84+
const { name: filename } = selectedFile;
8585

8686
const [triggerNavDropdown, NavDropDown] = useAsModal(<Dropdown
8787
items={getNatOptions(username)}
@@ -109,7 +109,7 @@ const MobileIDEView = (props) => {
109109
<Screen fullscreen>
110110
<Header
111111
title={withChangeDot(project.name, unsavedChanges)}
112-
subtitle={selectedFile.name}
112+
subtitle={filename}
113113
>
114114
<NavItem>
115115
<IconButton
@@ -129,7 +129,7 @@ const MobileIDEView = (props) => {
129129
</IDEWrapper>
130130

131131
<Footer>
132-
{ide.consoleIsExpanded && (
132+
{consoleIsExpanded && (
133133
<Expander expanded>
134134
<Console />
135135
</Expander>
@@ -141,50 +141,8 @@ const MobileIDEView = (props) => {
141141
};
142142

143143
MobileIDEView.propTypes = {
144-
preferences: PropTypes.shape({
145-
fontSize: PropTypes.number.isRequired,
146-
autosave: PropTypes.bool.isRequired,
147-
linewrap: PropTypes.bool.isRequired,
148-
lineNumbers: PropTypes.bool.isRequired,
149-
lintWarning: PropTypes.bool.isRequired,
150-
textOutput: PropTypes.bool.isRequired,
151-
gridOutput: PropTypes.bool.isRequired,
152-
soundOutput: PropTypes.bool.isRequired,
153-
theme: PropTypes.string.isRequired,
154-
autorefresh: PropTypes.bool.isRequired,
155-
}).isRequired,
156-
157144
ide: PropTypes.shape({
158-
isPlaying: PropTypes.bool.isRequired,
159-
isAccessibleOutputPlaying: PropTypes.bool.isRequired,
160-
consoleEvent: PropTypes.array,
161-
modalIsVisible: PropTypes.bool.isRequired,
162-
sidebarIsExpanded: PropTypes.bool.isRequired,
163145
consoleIsExpanded: PropTypes.bool.isRequired,
164-
preferencesIsVisible: PropTypes.bool.isRequired,
165-
projectOptionsVisible: PropTypes.bool.isRequired,
166-
newFolderModalVisible: PropTypes.bool.isRequired,
167-
shareModalVisible: PropTypes.bool.isRequired,
168-
shareModalProjectId: PropTypes.string.isRequired,
169-
shareModalProjectName: PropTypes.string.isRequired,
170-
shareModalProjectUsername: PropTypes.string.isRequired,
171-
editorOptionsVisible: PropTypes.bool.isRequired,
172-
keyboardShortcutVisible: PropTypes.bool.isRequired,
173-
infiniteLoop: PropTypes.bool.isRequired,
174-
previewIsRefreshing: PropTypes.bool.isRequired,
175-
infiniteLoopMessage: PropTypes.string.isRequired,
176-
projectSavedTime: PropTypes.string,
177-
previousPath: PropTypes.string.isRequired,
178-
justOpenedProject: PropTypes.bool.isRequired,
179-
errorType: PropTypes.string,
180-
runtimeErrorWarningVisible: PropTypes.bool.isRequired,
181-
uploadFileModalVisible: PropTypes.bool.isRequired,
182-
183-
unsavedChanges: PropTypes.bool.isRequired,
184-
}).isRequired,
185-
186-
editorAccessibility: PropTypes.shape({
187-
lintMessages: PropTypes.array.isRequired,
188146
}).isRequired,
189147

190148
project: PropTypes.shape({
@@ -194,12 +152,8 @@ MobileIDEView.propTypes = {
194152
username: PropTypes.string,
195153
id: PropTypes.string,
196154
}),
197-
updatedAt: PropTypes.string,
198155
}).isRequired,
199156

200-
startSketch: PropTypes.func.isRequired,
201-
stopSketch: PropTypes.func.isRequired,
202-
203157

204158
selectedFile: PropTypes.shape({
205159
id: PropTypes.string.isRequired,
@@ -213,12 +167,17 @@ MobileIDEView.propTypes = {
213167
username: PropTypes.string,
214168
}).isRequired,
215169

216-
getProject: PropTypes.func.isRequired,
217-
clearPersistedState: PropTypes.func.isRequired,
218170
params: PropTypes.shape({
219171
project_id: PropTypes.string,
220172
username: PropTypes.string
221173
}).isRequired,
174+
175+
unsavedChanges: PropTypes.bool.isRequired,
176+
177+
startSketch: PropTypes.func.isRequired,
178+
stopSketch: PropTypes.func.isRequired,
179+
getProject: PropTypes.func.isRequired,
180+
clearPersistedState: PropTypes.func.isRequired,
222181
};
223182

224183
function mapStateToProps(state) {
@@ -230,9 +189,8 @@ function mapStateToProps(state) {
230189
state.files.find(file => file.name !== 'root'),
231190
htmlFile: getHTMLFile(state.files),
232191
ide: state.ide,
233-
unsavedChanges: state.ide.unsavedChanged,
192+
unsavedChanges: state.ide.unsavedChanges,
234193
preferences: state.preferences,
235-
editorAccessibility: state.editorAccessibility,
236194
user: state.user,
237195
project: state.project,
238196
toast: state.toast,
@@ -244,14 +202,8 @@ function mapDispatchToProps(dispatch) {
244202
return bindActionCreators(
245203
Object.assign(
246204
{},
247-
EditorAccessibilityActions,
248-
FileActions,
249205
ProjectActions,
250206
IDEActions,
251-
PreferencesActions,
252-
UserActions,
253-
ToastActions,
254-
ConsoleActions
255207
),
256208
dispatch
257209
);

0 commit comments

Comments
 (0)