Skip to content

Commit b94784d

Browse files
Merge branch 'develop' into changes_by_almas_khan
2 parents 57f14c1 + 2e7fbe0 commit b94784d

File tree

6 files changed

+632
-33
lines changed

6 files changed

+632
-33
lines changed

client/components/Nav.jsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,16 @@ class Nav extends React.PureComponent {
637637
Español
638638
</button>
639639
</li>
640+
<li className="nav__dropdown-item">
641+
<button
642+
onFocus={this.handleFocusForLang}
643+
onBlur={this.handleBlur}
644+
value="pt-BR"
645+
onClick={(e) => this.handleLangSelection(e)}
646+
>
647+
Português
648+
</button>
649+
</li>
640650
<li className="nav__dropdown-item">
641651
<button
642652
onFocus={this.handleFocusForLang}

client/i18n.js

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

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

99
export function languageKeyToLabel(lang) {
1010
const languageMap = {
1111
'en-US': 'English',
1212
'es-419': 'Español',
1313
ja: '日本語',
14-
hi: 'हिन्दी'
14+
hi: 'हिन्दी',
15+
'pt-BR': 'Português'
1516
};
1617
return languageMap[lang];
1718
}
@@ -21,7 +22,8 @@ export function languageKeyToDateLocale(lang) {
2122
'en-US': enUS,
2223
'es-419': es,
2324
ja,
24-
hi
25+
hi,
26+
'pt-BR': ptBR
2527
};
2628
return languageMap[lang];
2729
}

client/modules/User/pages/DashboardView.jsx

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ class DashboardView extends React.Component {
3030
super(props);
3131
this.closeAccountPage = this.closeAccountPage.bind(this);
3232
this.gotoHomePage = this.gotoHomePage.bind(this);
33+
this.toggleCollectionCreate = this.toggleCollectionCreate.bind(this);
34+
this.state = {
35+
collectionCreateVisible: false
36+
};
3337
}
3438

3539
componentDidMount() {
@@ -68,15 +72,12 @@ class DashboardView extends React.Component {
6872
return this.props.user.username === this.props.params.username;
6973
}
7074

71-
isCollectionCreate() {
72-
const path = this.props.location.pathname;
73-
return /collections\/create$/.test(path);
75+
toggleCollectionCreate() {
76+
this.setState((prevState) => ({
77+
collectionCreateVisible: !prevState.collectionCreateVisible
78+
}));
7479
}
7580

76-
returnToDashboard = () => {
77-
browserHistory.push(`/${this.ownerName()}/collections`);
78-
};
79-
8081
renderActionButton(tabKey, username, t) {
8182
switch (tabKey) {
8283
case TabKey.assets:
@@ -85,7 +86,7 @@ class DashboardView extends React.Component {
8586
return (
8687
this.isOwner() && (
8788
<React.Fragment>
88-
<Button to={`/${username}/collections/create`}>
89+
<Button onClick={this.toggleCollectionCreate}>
8990
{t('DashboardView.CreateCollection')}
9091
</Button>
9192
<CollectionSearchbar />
@@ -148,10 +149,10 @@ class DashboardView extends React.Component {
148149
{this.renderContent(currentTab, username)}
149150
</div>
150151
</main>
151-
{this.isCollectionCreate() && (
152+
{this.state.collectionCreateVisible && (
152153
<Overlay
153154
title={this.props.t('DashboardView.CreateCollectionOverlay')}
154-
closeOverlay={this.returnToDashboard}
155+
closeOverlay={this.toggleCollectionCreate}
155156
>
156157
<CollectionCreate />
157158
</Overlay>

client/routes.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@ const routes = (store) => (
9898
path="/:username/collections"
9999
component={mobileFirst(MobileDashboardView, DashboardView)}
100100
/>
101-
102-
<Route path="/:username/collections/create" component={DashboardView} />
103101
<Route
104102
path="/:username/collections/:collection_id"
105103
component={CollectionView}

server/routes/server.routes.js

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,23 +121,6 @@ router.get('/about', (req, res) => {
121121
res.send(renderIndex());
122122
});
123123

124-
router.get('/:username/collections/create', (req, res) => {
125-
userExists(req.params.username, (exists) => {
126-
const isLoggedInUser =
127-
req.user && req.user.username === req.params.username;
128-
const canAccess = exists && isLoggedInUser;
129-
return canAccess
130-
? res.send(renderIndex())
131-
: get404Sketch((html) => res.send(html));
132-
});
133-
});
134-
135-
router.get('/:username/collections/create', (req, res) => {
136-
userExists(req.params.username, (exists) =>
137-
exists ? res.send(renderIndex()) : get404Sketch((html) => res.send(html))
138-
);
139-
});
140-
141124
router.get('/:username/collections/:id', (req, res) => {
142125
collectionForUserExists(req.params.username, req.params.id, (exists) =>
143126
exists ? res.send(renderIndex()) : get404Sketch((html) => res.send(html))

0 commit comments

Comments
 (0)