Skip to content

Commit ac8ec03

Browse files
authored
Merge pull request #4909 from topcoder-platform/thrive-fixes-sep20
Thrive fixes sep20
2 parents 37fc93e + 21576ee commit ac8ec03

File tree

20 files changed

+122
-104
lines changed

20 files changed

+122
-104
lines changed

.circleci/config.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ workflows:
230230
filters:
231231
branches:
232232
only:
233+
- milestone-20200917
233234
- develop
234235
# This is alternate dev env for parallel testing
235236
- "build-test":
@@ -251,14 +252,15 @@ workflows:
251252
filters:
252253
branches:
253254
only:
255+
- integration-v5-challenge-api
254256
- hot-fix
255257
# This is stage env for production QA releases
256258
- "build-prod-staging":
257259
context : org-global
258260
filters:
259261
branches:
260262
only:
261-
- feature-contentful
263+
- develop
262264
# Production builds are exectuted
263265
# when PR is merged to the master
264266
# Don't change anything in this configuration

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137
"tc-accounts": "git+https://github.com/appirio-tech/accounts-app.git#dev",
138138
"tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.3",
139139
"tc-ui": "^1.0.12",
140-
"topcoder-react-lib": "1.0.3",
140+
"topcoder-react-lib": "1.0.4",
141141
"topcoder-react-ui-kit": "2.0.0",
142142
"topcoder-react-utils": "0.7.8",
143143
"turndown": "^4.0.2",

src/shared/components/Contentful/Article/Article.jsx

+22-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ import LoadingIndicator from 'components/LoadingIndicator';
1515
import YouTubeVideo from 'components/YouTubeVideo';
1616
import moment from 'moment';
1717
import localStorage from 'localStorage';
18-
import { config, Link, isomorphy } from 'topcoder-react-utils';
18+
import { Helmet } from 'react-helmet';
19+
import {
20+
config, Link, isomorphy,
21+
} from 'topcoder-react-utils';
1922
import qs from 'qs';
2023
// SVGs and assets
2124
import GestureIcon from 'assets/images/icon-gesture.svg';
@@ -110,9 +113,27 @@ export default class Article extends React.Component {
110113
if (isomorphy.isClientSide()) {
111114
shareUrl = encodeURIComponent(window.location.href);
112115
}
116+
const description = htmlToText.fromString(
117+
ReactDOMServer.renderToString(markdown(fields.content)),
118+
{
119+
ignoreHref: true,
120+
ignoreImage: true,
121+
singleNewLineParagraphs: true,
122+
uppercaseHeadings: false,
123+
},
124+
).substring(0, CONTENT_PREVIEW_LENGTH);
113125

114126
return (
115127
<React.Fragment>
128+
<Helmet>
129+
<title>{fields.title}</title>
130+
<meta name="title" property="og:title" content={fields.title} />
131+
<meta name="description" property="og:description" content={description} />
132+
<meta name="description" property="description" content={description} />
133+
<meta name="twitter:description" content={description} />
134+
<meta name="image" property="og:image" content={fields.featuredImage ? `https:${subData.assets.items[fields.featuredImage.sys.id].fields.file.url}` : null} />
135+
<meta name="twitter:image" content={fields.featuredImage ? `https:${subData.assets.items[fields.featuredImage.sys.id].fields.file.url}` : null} />
136+
</Helmet>
116137
{/* Banner */}
117138
{
118139
fields.featuredImage ? (

src/shared/components/Contentful/SearchBar/SearchBar.jsx

+43-5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ export class SearchBarInner extends Component {
5656
this.getSuggestionList = this.getSuggestionList.bind(this);
5757
this.handleSearchChange = this.handleSearchChange.bind(this);
5858
this.handleClickOutside = this.handleClickOutside.bind(this);
59+
this.onKeyDown = this.onKeyDown.bind(this);
5960
// using debounce to avoid processing or requesting too much
6061
this.updateSuggestionListWithNewSearch = _.debounce(
6162
this.updateSuggestionListWithNewSearch.bind(this), 400,
@@ -71,6 +72,29 @@ export class SearchBarInner extends Component {
7172
document.removeEventListener('mousedown', this.handleClickOutside);
7273
}
7374

75+
onKeyDown(e) {
76+
const { inputlVal, selectedFilter } = this.state;
77+
if (inputlVal && e.which === 13) {
78+
const searchQuery = {};
79+
if (this.searchFieldRef && this.searchFieldRef.value) {
80+
if (selectedFilter.name === 'Tags') {
81+
searchQuery.tags = [this.searchFieldRef.value];
82+
}
83+
if (selectedFilter.name === 'All') {
84+
searchQuery.phrase = this.searchFieldRef.value;
85+
}
86+
if (selectedFilter.name === 'Title') {
87+
searchQuery.title = this.searchFieldRef.value;
88+
}
89+
}
90+
if (selectedFilter.name !== 'Author') {
91+
window.location.href = `${config.TC_EDU_BASE_PATH}${config.TC_EDU_SEARCH_PATH}?${qs.stringify(searchQuery)}`;
92+
} else {
93+
window.location.href = `${config.TC_EDU_BASE_PATH}${config.TC_EDU_SEARCH_PATH}?author=${inputlVal}`;
94+
}
95+
}
96+
}
97+
7498
/**
7599
* Set the search field ref
76100
*/
@@ -136,6 +160,7 @@ export class SearchBarInner extends Component {
136160
isShowSuggestion,
137161
suggestionList,
138162
selectedFilter,
163+
noResults,
139164
} = this.state;
140165

141166
const searchQuery = {};
@@ -151,7 +176,8 @@ export class SearchBarInner extends Component {
151176
}
152177
}
153178

154-
return (suggestionList && !_.isEmpty(suggestionList) && isShowSuggestion && (
179+
// eslint-disable-next-line no-nested-ternary
180+
return suggestionList && !_.isEmpty(suggestionList) && isShowSuggestion ? (
155181
<div
156182
className={theme['popup-search-result']}
157183
ref={this.setPopupSearchResultRef}
@@ -319,7 +345,14 @@ export class SearchBarInner extends Component {
319345
) : null
320346
}
321347
</div>
322-
));
348+
) : noResults ? (
349+
<div
350+
className={theme['popup-search-result']}
351+
ref={this.setPopupSearchResultRef}
352+
>
353+
<span>No Results</span>
354+
</div>
355+
) : null;
323356
}
324357

325358
handleClickOutside(e) {
@@ -379,23 +412,26 @@ export class SearchBarInner extends Component {
379412
.then((results) => {
380413
// Nothing found?
381414
if (!results.total) {
382-
this.setState({ suggestionList: {} });
415+
this.setState({
416+
suggestionList: {},
417+
noResults: true,
418+
});
383419
return;
384420
}
385421
// Author query?
386422
if (selectedFilter.name === 'Author') {
387423
const suggestionList = {
388424
Author: _.map(results.items, item => ({ ...item.fields })),
389425
};
390-
this.setState({ suggestionList });
426+
this.setState({ suggestionList, noResults: false });
391427
return;
392428
}
393429
// ALL && Tags
394430
const suggestionList = this.groupResults(results);
395431
this.setState({ suggestionList });
396432
});
397433
} else {
398-
this.setState({ suggestionList: {} });
434+
this.setState({ suggestionList: {}, noResults: false });
399435
}
400436
}
401437

@@ -419,6 +455,7 @@ export class SearchBarInner extends Component {
419455
contentAuthor: contentAuthor.fields,
420456
externalArticle: fields.externalArticle,
421457
contentUrl: fields.contentUrl,
458+
slug: fields.slug,
422459
};
423460
}),
424461
'type',
@@ -471,6 +508,7 @@ export class SearchBarInner extends Component {
471508
document.addEventListener('mousedown', this.handleClickOutside);
472509
}}
473510
onChange={this.handleSearchChange}
511+
onKeyDown={this.onKeyDown}
474512
/>
475513
<div className={theme.dropdown}>
476514
<button

src/shared/components/Contentful/SearchBar/themes/default.scss

+4
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ $link-color: #0d61bf;
156156
overflow-y: auto;
157157
box-shadow: 0 25px 50px 0 rgba(0, 0, 0, 0.15);
158158
z-index: 999;
159+
160+
> span {
161+
margin-left: 15px;
162+
}
159163
}
160164

161165
.icon-search {

src/shared/components/ProfilePage/Stats/HistoryGraph/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ export default class HistoryGraph extends React.Component {
211211
}
212212
if (track === 'DATA_SCIENCE') {
213213
if (subTrack === 'MARATHON_MATCH') {
214-
return `/challenges/${challengeId}`;
214+
return `${config.URL.COMMUNITY}/tc?module=MatchDetails&rd=${challengeId}`;
215215
}
216216
if (subTrack === 'SRM') {
217217
return `${config.URL.COMMUNITY}/stat?c=round_overview&rd=${challengeId}`;

src/shared/components/SubmissionManagement/SubmissionManagement/index.jsx

+14-7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import React from 'react';
1919
import PT from 'prop-types';
2020
import moment from 'moment';
2121
import { PrimaryButton } from 'topcoder-react-ui-kit';
22+
import { phaseEndDate } from 'utils/challenge-listing/helper';
2223
import SubmissionsTable from '../SubmissionsTable';
2324

2425
import style from './styles.scss';
@@ -47,9 +48,11 @@ export default function SubmissionManagement(props) {
4748
const currentPhase = challenge.phases
4849
.filter(p => p.name !== 'Registration' && p.isOpen)
4950
.sort((a, b) => moment(a.scheduledEndDate).diff(b.scheduledEndDate))[0];
51+
const submissionPhase = challenge.phases.filter(p => p.name === 'Submission')[0];
52+
const submissionEndDate = submissionPhase && phaseEndDate(submissionPhase);
5053

5154
const now = moment();
52-
const end = moment(currentPhase.scheduledEndDate);
55+
const end = moment(currentPhase && currentPhase.scheduledEndDate);
5356
const diff = end.isAfter(now) ? end.diff(now) : 0;
5457
const timeLeft = moment.duration(diff);
5558

@@ -78,11 +81,15 @@ export default function SubmissionManagement(props) {
7881
</a>
7982
</div>
8083
<div styleName="right-col">
81-
<p styleName="round">
82-
{currentPhase.name}
83-
</p>
8484
{
85-
challenge.status !== 'COMPLETED' ? (
85+
currentPhase && (
86+
<p styleName="round">
87+
{currentPhase.name}
88+
</p>
89+
)
90+
}
91+
{
92+
challenge.status !== 'Completed' ? (
8693
<div>
8794
<p styleName="time-left">
8895
{days > 0 && (`${days}D`)}
@@ -111,7 +118,7 @@ export default function SubmissionManagement(props) {
111118
Manage your submissions
112119
</p>
113120
{
114-
isDesign && (
121+
isDesign && currentPhase && (
115122
<p styleName="round-ends">
116123
<span styleName="ends-label">
117124
{currentPhase.name}
@@ -159,7 +166,7 @@ export default function SubmissionManagement(props) {
159166
)
160167
}
161168
</div>
162-
{now.isBefore(challenge.submissionEndDate) && (
169+
{now.isBefore(submissionEndDate) && (
163170
<div styleName="btn-wrap">
164171
<PrimaryButton
165172
theme={{

src/shared/components/SubmissionPage/Submit/index.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ class Submit extends React.Component {
150150
const topGearCommunity = _.find(communitiesList.data, { mainSubdomain: 'topgear' });
151151
if (topGearCommunity) {
152152
// check the group info match with group list
153-
_.forOwn(groups, (value, key) => {
154-
if (value && _.includes(topGearCommunity.groupIds, key)) {
153+
_.forOwn(groups, (value) => {
154+
if (value && _.includes(topGearCommunity.groupIds, value)) {
155155
isChallengeBelongToTopgearGroup = true;
156156
return false;
157157
}

src/shared/components/tc-communities/communities/cognitive/GetStarted/index.jsx

-3
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import cardImg02 from
2020

2121
import MarchMadnessBanner from '../MarchMadnessBanner';
2222

23-
import NewsSignup from '../NewsSignup';
24-
2523
import style from './style.scss';
2624

2725
export default function GetStarted({ baseUrl }) {
@@ -88,7 +86,6 @@ export default function GetStarted({ baseUrl }) {
8886
/>
8987
</ImageText>
9088
</div>
91-
<NewsSignup />
9289
</main>
9390
);
9491
}

src/shared/components/tc-communities/communities/cognitive/Home/index.jsx

-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { config, Link } from 'topcoder-react-utils';
1616
import davePhotoUrl from 'assets/images/communities/cognitive/home/dave.jpg';
1717

1818
import IbmCloudBanner from '../IbmCloudBanner';
19-
import NewsletterSignup from '../NewsSignup';
2019

2120
import style from './style.scss';
2221

@@ -317,8 +316,6 @@ export default function Home({
317316
</div>
318317
</div>
319318
</div>
320-
321-
<NewsletterSignup />
322319
</main>
323320
);
324321
}

src/shared/components/tc-communities/communities/cognitive/IbmCloudPage/index.jsx

-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import React from 'react';
44
import Differences from './Differences';
55
import HeadBanner from './HeadBanner';
66
import JoinBlock from './JoinBlock';
7-
import NewsSignup from '../NewsSignup';
87

98
export default function IbmCloudPage() {
109
return (
@@ -16,8 +15,6 @@ export default function IbmCloudPage() {
1615
{/* Hidden by the request from Trevor: the transition process won't start
1716
* until Feb 12. */}
1817
{/* <AutoTransition /> */}
19-
20-
<NewsSignup />
2118
</div>
2219
);
2320
}

src/shared/components/tc-communities/communities/cognitive/NewsSignup/index.jsx

-21
This file was deleted.

0 commit comments

Comments
 (0)