Skip to content

Commit 62e9e8f

Browse files
authored
Merge branch 'develop' into fix-failing-nav-test
2 parents 1504e71 + 622c2d8 commit 62e9e8f

File tree

13 files changed

+6601
-3769
lines changed

13 files changed

+6601
-3769
lines changed

client/components/Nav.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,16 @@ class Nav extends React.PureComponent {
679679
日本語
680680
</button>
681681
</li>
682+
<li className="nav__dropdown-item">
683+
<button
684+
onFocus={this.handleFocusForLang}
685+
onBlur={this.handleBlur}
686+
value="hi"
687+
onClick={(e) => this.handleLangSelection(e)}
688+
>
689+
हिन्दी
690+
</button>
691+
</li>
682692
</ul>
683693
</li>
684694
</React.Fragment>

client/i18n.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import i18n from 'i18next';
22
import { initReactI18next } from 'react-i18next';
33
import Backend from 'i18next-http-backend';
4-
import { enUS, es, ja } from 'date-fns/locale';
4+
import { enUS, es, ja, hi } from 'date-fns/locale';
55

66
const fallbackLng = ['en-US'];
7-
const availableLanguages = ['en-US', 'es-419', 'ja'];
7+
const availableLanguages = ['en-US', 'es-419', 'ja', 'hi'];
88

99
export function languageKeyToLabel(lang) {
1010
const languageMap = {
1111
'en-US': 'English',
1212
'es-419': 'Español',
13-
ja: '日本語'
13+
ja: '日本語',
14+
hi: 'हिन्दी'
1415
};
1516
return languageMap[lang];
1617
}
@@ -19,7 +20,8 @@ export function languageKeyToDateLocale(lang) {
1920
const languageMap = {
2021
'en-US': enUS,
2122
'es-419': es,
22-
ja
23+
ja,
24+
hi
2325
};
2426
return languageMap[lang];
2527
}

client/modules/IDE/actions/files.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import * as ActionTypes from '../../../constants';
55
import {
66
setUnsavedChanges,
77
closeNewFolderModal,
8-
closeNewFileModal
8+
closeNewFileModal,
9+
setSelectedFile
910
} from './ide';
1011
import { setProjectSavedTime } from './project';
1112
import { createError } from './ide';
@@ -82,7 +83,7 @@ export function submitFile(formProps, files, parentId, projectId) {
8283
});
8384
}
8485

85-
export function handleCreateFile(formProps) {
86+
export function handleCreateFile(formProps, setSelected = true) {
8687
return (dispatch, getState) => {
8788
const state = getState();
8889
const { files } = state;
@@ -96,6 +97,9 @@ export function handleCreateFile(formProps) {
9697
if (updatedAt) dispatch(setProjectSavedTime(updatedAt));
9798
dispatch(closeNewFileModal());
9899
dispatch(setUnsavedChanges(true));
100+
if (setSelected) {
101+
dispatch(setSelectedFile(file.id));
102+
}
99103
resolve();
100104
})
101105
.catch((error) => {

client/modules/IDE/actions/uploader.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import apiClient from '../../../utils/apiClient';
22
import getConfig from '../../../utils/getConfig';
3-
import { createFile } from './files';
3+
import { handleCreateFile } from './files';
44
import { TEXT_FILE_REGEX } from '../../../../server/utils/fileUtils';
55

66
const s3BucketHttps =
@@ -48,7 +48,7 @@ export function dropzoneAcceptCallback(userId, file, done) {
4848
if (file.name.match(TEXT_FILE_REGEX) && file.size < MAX_LOCAL_FILE_SIZE) {
4949
localIntercept(file)
5050
.then((result) => {
51-
file.content = result; // eslint-disable-line
51+
file.content = result; // eslint-disable-line
5252
done('Uploading plaintext file locally.');
5353
file.previewElement.classList.remove('dz-error');
5454
file.previewElement.classList.add('dz-success');
@@ -103,7 +103,7 @@ export function dropzoneSendingCallback(file, xhr, formData) {
103103
}
104104

105105
export function dropzoneCompleteCallback(file) {
106-
return (dispatch, getState) => { // eslint-disable-line
106+
return (dispatch) => { // eslint-disable-line
107107
if (
108108
(!file.name.match(TEXT_FILE_REGEX) || file.size >= MAX_LOCAL_FILE_SIZE) &&
109109
file.status !== 'error'
@@ -125,13 +125,13 @@ export function dropzoneCompleteCallback(file) {
125125
name: file.name,
126126
url: `${s3BucketHttps}${file.postData.key}`
127127
};
128-
createFile(formParams)(dispatch, getState);
128+
dispatch(handleCreateFile(formParams, false));
129129
} else if (file.content !== undefined) {
130130
const formParams = {
131131
name: file.name,
132132
content: file.content
133133
};
134-
createFile(formParams)(dispatch, getState);
134+
dispatch(handleCreateFile(formParams, false));
135135
}
136136
};
137137
}

client/modules/IDE/components/UploadFileModal.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const limit = getConfig('UPLOAD_LIMIT') || 250000000;
1313
const limitText = prettyBytes(limit);
1414

1515
class UploadFileModal extends React.Component {
16-
propTypes = {
16+
static propTypes = {
1717
reachedTotalSizeLimit: PropTypes.bool.isRequired,
1818
closeModal: PropTypes.func.isRequired,
1919
t: PropTypes.func.isRequired

client/modules/User/actions.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ export function validateSession() {
141141
};
142142
}
143143

144+
export function resetProject(dispatch) {
145+
dispatch({
146+
type: ActionTypes.RESET_PROJECT
147+
});
148+
dispatch({
149+
type: ActionTypes.CLEAR_CONSOLE
150+
});
151+
browserHistory.push('/');
152+
}
153+
144154
export function logoutUser() {
145155
return (dispatch) => {
146156
apiClient
@@ -149,6 +159,7 @@ export function logoutUser() {
149159
dispatch({
150160
type: ActionTypes.UNAUTH_USER
151161
});
162+
resetProject(dispatch);
152163
})
153164
.catch((error) => {
154165
const { response } = error;

developer_docs/development.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,6 @@ Structure your commit message like this:
9191

9292
- For reference to the JavaScript style guide, see the [Airbnb Style Guide](https://github.com/airbnb/javascript), [React ESLint Plugin](https://github.com/yannickcr/eslint-plugin-react).
9393

94-
- The ESLint configuration is based on a few popular React/Redux boilerplates. Open to suggestions on this. If in development, you're getting annoyed with ESLint, you can temporarily remove the `eslint-loader` it from `webpack/config.dev.js` in the JavaScript loader, or disable any line from eslint by commenting at the end of the line `// eslint-disable-line`.
94+
- The ESLint configuration is based on a few popular React/Redux boilerplates. Open to suggestions on this. If in development, you're getting annoyed with ESLint, you can disable any line from eslint by commenting at the end of the line `// eslint-disable-line`.
9595

9696
- [Jest](https://jestjs.io/) for unit tests and snapshot testing along with [Enzyme](https://airbnb.io/enzyme/) for testing React.

0 commit comments

Comments
 (0)