Skip to content

Commit 717a07d

Browse files
Merge pull request #5586 from topcoder-platform/thrive-bug-fixes3
Thrive bug fixes3
2 parents 645a42d + ede8c75 commit 717a07d

File tree

10 files changed

+60
-77
lines changed

10 files changed

+60
-77
lines changed

__tests__/shared/components/GUIKit/Datepicker/__snapshots__/index.jsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ exports[`Default render 1`] = `
3838
isRTL={false}
3939
keepFocusOnInput={false}
4040
keepOpenOnDateSelect={false}
41+
maxDate={null}
42+
minDate={null}
4143
monthFormat="MMMM YYYY"
4244
navNext={
4345
<IconNext

src/shared/components/Contentful/ArticleCard/ArticleCard.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ class ArticleCard extends React.Component {
250250
{
251251
showArticleInfo() && (
252252
<p className={theme.readTimeInfo}>
253-
{themeName === 'Article large' ? <span>&nbsp;.&nbsp;</span> : null}
253+
{themeName === 'Article large' && contentAuthor && contentAuthor.length > 0 ? <span>&nbsp;.&nbsp;</span> : null}
254254
{
255255
contentAuthor && contentAuthor.length > 0 ? (
256256
<Link

src/shared/components/Contentful/SearchPageFilter/FilterDate/index.jsx

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ import moment from 'moment';
55
import PT from 'prop-types';
66
import React from 'react';
77
import { themr } from 'react-css-super-themr';
8-
import DatePicker from 'components/challenge-listing/Filters/DatePicker';
8+
import Datepicker from 'components/GUIKit/Datepicker';
99
import CalendarWeek from 'react-dates/lib/components/CalendarWeek';
10-
import IconCalendar from 'assets/images/tc-edu/icon-calendar.svg';
1110
import defaultTheme from './themes/default.scss';
1211

1312
// eslint-disable-next-line no-unused-expressions, react/forbid-foreign-prop-types
@@ -25,22 +24,29 @@ export function FilterDateInner(props) {
2524

2625
return (
2726
<div className={`${theme.container} ${className}`}>
28-
<span className={theme.title}>From</span>
29-
<IconCalendar />
30-
<DatePicker
31-
displayFormat="MMM D, YYYY"
32-
date={startDate}
33-
numberOfMonths={1}
34-
id="date-picker-start-date"
35-
onDateChange={(date) => { onSelectStartDate(date); }}
27+
<Datepicker
28+
label="Date Start"
29+
value={startDate}
30+
onChange={(date) => {
31+
if (date instanceof Date) onSelectStartDate(moment(date));
32+
}}
33+
size="xs"
34+
isOutsideRange={day => moment().isBefore(day)}
35+
displayFormat="M/DD/YYYY"
36+
hideCustomInputIcon
37+
errorMsg={startDate > endDate ? 'From should be before end' : null}
3638
/>
37-
<span className={theme.separator}>-</span>
38-
<DatePicker
39-
displayFormat="MMM D, YYYY"
40-
date={endDate}
41-
numberOfMonths={1}
42-
id="date-picker-end-date"
43-
onDateChange={(date) => { onSelectEndDate(date); }}
39+
<div className={theme.separator} />
40+
<Datepicker
41+
label="Date End"
42+
value={endDate}
43+
onChange={(date) => {
44+
if (date instanceof Date) onSelectEndDate(moment(date));
45+
}}
46+
size="xs"
47+
isOutsideRange={day => moment().isSameOrBefore(day)}
48+
displayFormat="M/DD/YYYY"
49+
hideCustomInputIcon
4450
/>
4551
</div>
4652
);

src/shared/components/Contentful/SearchPageFilter/FilterDate/themes/default.scss

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,20 @@
22

33
$text-black: #2a2a2a;
44

5-
@mixin ellipsis {
6-
white-space: nowrap;
7-
overflow: hidden;
8-
text-overflow: ellipsis;
9-
min-width: 0;
10-
}
11-
125
.container {
136
@include roboto-regular;
147

158
display: flex;
169
flex-direction: row;
1710
color: $text-black;
18-
background-color: $tc-white;
19-
border-radius: 6px;
20-
border: 1px solid #aaa;
2111
position: relative;
22-
width: 100%;
23-
align-items: center;
24-
padding-left: 10px;
2512
font-size: 14px;
26-
height: 38px;
27-
max-width: 235px;
28-
29-
:global {
30-
.SingleDatePicker {
31-
width: 90px;
32-
margin-left: 6px;
33-
}
34-
35-
input {
36-
height: 21px !important;
37-
margin: 0 !important;
38-
padding: 0 !important;
39-
font-size: 14px !important;
40-
border: none !important;
41-
box-shadow: none !important;
42-
}
43-
}
44-
}
45-
46-
.title {
47-
position: absolute;
48-
color: #aaa;
49-
font-size: 12px;
50-
background: $tc-white;
51-
padding: 0 7px;
52-
left: 8px;
53-
top: -7px;
5413
}
5514

5615
.separator {
57-
margin-left: 3px;
58-
margin-right: 3px;
16+
margin: 0 6px;
17+
width: 6px;
18+
height: 1px;
19+
background-color: $text-black;
20+
margin-top: 20px;
5921
}

src/shared/components/Contentful/SearchPageFilter/SearchPageFilter.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ SearchPageFilterInner.defaultProps = {
201201
onApply: () => { },
202202
selectedAuthor: DEF_SELECTED_AUTHOR,
203203
authorList: [DEF_SELECTED_AUTHOR],
204-
startDate: moment('2001-01-02'),
204+
startDate: moment('2001-01-01'),
205205
endDate: moment(),
206206
tags: [],
207207
selectedCategory: '',

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ $green-color: #137d60;
3030
}
3131

3232
.track-date-container {
33-
margin-top: 27px;
33+
margin-top: 43px;
3434
}
3535

3636
.author-container {

src/shared/components/Contentful/TracksFilter/TracksDate/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ export function TracksDateInner(props) {
2424
<Datepicker
2525
label="Date Start"
2626
value={startDate}
27-
onChange={(date) => { onSelectStartDate(date); }}
27+
onChange={(date) => { if (date instanceof Date) onSelectStartDate(date); }}
2828
size="xs"
2929
isOutsideRange={day => moment().isSameOrBefore(day)}
3030
/>
3131
<div className={theme.separator} />
3232
<Datepicker
3333
label="Date End"
3434
value={endDate}
35-
onChange={(date) => { onSelectEndDate(date); }}
35+
onChange={(date) => { if (date instanceof Date) onSelectEndDate(date); }}
3636
size="xs"
3737
isOutsideRange={day => moment().isSameOrBefore(day)}
3838
/>

src/shared/components/GUIKit/Datepicker/index.jsx

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ function Datepicker({
2727
required,
2828
size,
2929
isOutsideRange,
30+
hideCustomInputIcon,
31+
isDayBlocked,
32+
displayFormat,
33+
minDate,
34+
maxDate,
3035
}) {
3136
const sizeStyle = size === 'lg' ? 'lgSize' : 'xsSize';
3237
const [date, setDate] = useState(value ? moment(value) : null);
@@ -43,7 +48,7 @@ function Datepicker({
4348
>
4449
<SingleDatePicker
4550
hideKeyboardShortcutsPanel
46-
customInputIcon={<IconCalendar />}
51+
customInputIcon={hideCustomInputIcon ? null : <IconCalendar />}
4752
date={date}
4853
onDateChange={(changedDate) => {
4954
setDate(changedDate);
@@ -58,13 +63,16 @@ function Datepicker({
5863
numberOfMonths={1}
5964
navPrev={<IconPrev />}
6065
navNext={<IconNext />}
61-
displayFormat="MMM DD, YYYY"
66+
displayFormat={displayFormat}
6267
daySize={width > 600 ? 47 : 35}
6368
renderDayContents={d => (<div>{d.date ? d.date() : ''}</div>)}
6469
enableOutsideDays
6570
firstDayOfWeek={1}
6671
weekDayFormat="ddd"
6772
isOutsideRange={isOutsideRange}
73+
isDayBlocked={isDayBlocked}
74+
minDate={minDate}
75+
maxDate={maxDate}
6876
/>
6977
{label ? (
7078
<span styleName="label">
@@ -86,6 +94,11 @@ Datepicker.defaultProps = {
8694
required: false,
8795
size: 'lg',
8896
isOutsideRange: day => moment().isSameOrAfter(day),
97+
hideCustomInputIcon: false,
98+
isDayBlocked: () => false,
99+
displayFormat: 'MMM DD, YYYY',
100+
minDate: null,
101+
maxDate: null,
89102
};
90103

91104
Datepicker.propTypes = {
@@ -97,6 +110,11 @@ Datepicker.propTypes = {
97110
required: PT.bool,
98111
size: PT.oneOf(['xs', 'lg']),
99112
isOutsideRange: PT.func,
113+
hideCustomInputIcon: PT.bool,
114+
isDayBlocked: PT.func,
115+
displayFormat: PT.string,
116+
minDate: PT.instanceOf(moment),
117+
maxDate: PT.instanceOf(moment),
100118
};
101119

102120
export default Datepicker;

src/shared/containers/EDU/Search.jsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* Container for EDU Portal search page.
33
*/
44
import _ from 'lodash';
5-
import moment from 'moment';
65
import React from 'react';
76
import { config, isomorphy } from 'topcoder-react-utils';
87
import MetaTags from 'components/MetaTags';
@@ -67,8 +66,8 @@ export default class EDUSearch extends React.Component {
6766
const queryUpdate = {
6867
author: filterState.selectedAuthor,
6968
tags: filterState.tags,
70-
startDate: filterState.startDate.format(),
71-
endDate: filterState.endDate.format(),
69+
startDate: filterState.startDate.format('YYYY-MM-DD'),
70+
endDate: filterState.endDate.format('YYYY-MM-DD'),
7271
track: filterState.selectedCategory ? filterState.selectedCategory.title : null,
7372
tax: filterState.selectedCategory ? _.map(
7473
_.filter(filterState.selectedCategory.items, item => item.selected),
@@ -125,8 +124,8 @@ export default class EDUSearch extends React.Component {
125124
onApply={this.onApplyFilter}
126125
selectedAuthor={query.author}
127126
tags={query.tags}
128-
startDate={query.startDate ? moment(query.startDate) : undefined}
129-
endDate={query.endDate ? moment(query.endDate) : undefined}
127+
startDate={query.startDate ? query.startDate : undefined}
128+
endDate={query.endDate ? query.endDate : undefined}
130129
selectedCategory={query.track}
131130
categories={tree}
132131
/>

src/shared/services/contentful.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,7 @@ class Service {
340340
}
341341
if (track) query['fields.trackCategory'] = track;
342342
if (!_.isEmpty(tags)) {
343-
if (tags.length === 1) {
344-
query['fields.tags[match]'] = tags.join(',');
345-
} else {
346-
query.query = tags.join(' ');
347-
}
343+
query['fields.tags[all]'] = tags.join(',');
348344
}
349345
if (startDate) query['fields.creationDate[gte]'] = startDate;
350346
if (endDate) query['fields.creationDate[lte]'] = endDate;

0 commit comments

Comments
 (0)