|
24 | 24 | import _ from 'lodash';
|
25 | 25 | import React, { useState, useEffect } from 'react';
|
26 | 26 | import PT from 'prop-types';
|
27 |
| -import Select from 'components/Select'; |
28 | 27 | import DateRangePicker from 'components/DateRangePicker';
|
29 | 28 | import moment from 'moment';
|
30 | 29 | import Tooltip from 'components/Tooltip';
|
31 |
| -import { config, Link } from 'topcoder-react-utils'; |
| 30 | +import { config } from 'topcoder-react-utils'; |
32 | 31 | import { COMPOSE, PRIORITY } from 'react-css-super-themr';
|
33 | 32 | import { REVIEW_OPPORTUNITY_TYPES } from 'utils/tc';
|
34 | 33 | import { isFilterEmpty, isPastBucket, BUCKETS } from 'utils/challenge-listing/buckets';
|
35 | 34 | import SwitchWithLabel from 'components/SwitchWithLabel';
|
36 | 35 | import ChallengeSearchBar from 'containers/challenge-listing/ChallengeSearchBar';
|
37 | 36 | import { challenge as challengeUtils } from 'topcoder-react-lib';
|
38 | 37 | import { createStaticRanges } from 'utils/challenge-listing/date-range';
|
39 |
| -import ArrowIcon from 'assets/images/ico-arrow-down.svg'; |
40 | 38 | import CircleIcon from 'assets/images/icon-circle.svg';
|
41 | 39 | import Button from '../Button';
|
42 | 40 | import UiSimpleRemove from '../../Icons/ui-simple-remove.svg';
|
43 | 41 | import BucketSelector from '../../Sidebar/BucketSelector';
|
44 |
| -import CheckmarkIcon from './CheckmarkIcon'; |
45 | 42 | import style from './style.scss';
|
46 | 43 |
|
47 | 44 | const Filter = challengeUtils.filter;
|
48 | 45 |
|
49 | 46 | export default function FiltersPanel({
|
50 |
| - communityFilters, |
51 | 47 | defaultCommunityId,
|
52 | 48 | filterState,
|
53 | 49 | // challenges,
|
@@ -92,156 +88,10 @@ export default function FiltersPanel({
|
92 | 88 | );
|
93 | 89 | }
|
94 | 90 |
|
95 |
| - const isVisitorRegisteredToCommunity = (visitorGroupIds, communityGroupIds) => Boolean( |
96 |
| - _.intersection(visitorGroupIds, communityGroupIds).length, |
97 |
| - ); |
98 |
| - |
99 | 91 | // const isAllBucket = activeBucket === BUCKETS.ALL;
|
100 | 92 |
|
101 |
| - const getLabel = (community) => { |
102 |
| - const { communityName } = community; |
103 |
| - if (!isAuth) { |
104 |
| - return ( |
105 |
| - <div> |
106 |
| - {communityName} |
107 |
| - </div> |
108 |
| - ); |
109 |
| - } |
110 |
| - |
111 |
| - // eslint-disable-next-line max-len |
112 |
| - const visitorGroupIds = (auth.profile && auth.profile.groups) ? auth.profile.groups.map(g => g.id) : []; |
113 |
| - const visitorRegisteredToCommunity = isVisitorRegisteredToCommunity( |
114 |
| - visitorGroupIds, |
115 |
| - community.groupIds, |
116 |
| - ); |
117 |
| - |
118 |
| - const registrationStatus = visitorRegisteredToCommunity |
119 |
| - ? ( |
120 |
| - <div> |
121 |
| - Registered |
122 |
| - </div> |
123 |
| - ) |
124 |
| - : ( |
125 |
| - <div> |
126 |
| - You are |
127 |
| - {' '} |
128 |
| - <span styleName="bold uppercase"> |
129 |
| - not |
130 |
| - </span> |
131 |
| - {' '} |
132 |
| - registered. |
133 |
| - <Link |
134 |
| - onMouseDown={(e) => { |
135 |
| - const url = community.mainSubdomain ? ( |
136 |
| - config.URL.BASE.replace(/www/, community.mainSubdomain) |
137 |
| - ) : `/community/${community.communityId}`; |
138 |
| - window.open(url); |
139 |
| - e.stopPropagation(); |
140 |
| - e.preventDefault(); |
141 |
| - }} |
142 |
| - styleName="learn-more-link" |
143 |
| - to="" |
144 |
| - openInNewTab |
145 |
| - > |
146 |
| - Learn more |
147 |
| - </Link> |
148 |
| - </div> |
149 |
| - ); |
150 |
| - |
151 |
| - // const filterFunction = Filter.getFilterFunction(community.challengeFilter); |
152 |
| - // const challengesInCommunity = challenges.filter(filterFunction).length; |
153 |
| - |
154 |
| - const selectItem = ( |
155 |
| - <div styleName="community-select-item"> |
156 |
| - <div> |
157 |
| - <div styleName="community-name"> |
158 |
| - <div> |
159 |
| - {communityName} |
160 |
| - </div> |
161 |
| - {visitorRegisteredToCommunity && ( |
162 |
| - <div styleName="checkmark-icon-container"> |
163 |
| - <CheckmarkIcon color="#fff" /> |
164 |
| - </div> |
165 |
| - )} |
166 |
| - </div> |
167 |
| - <div styleName="registration-status"> |
168 |
| - {communityName === 'All' |
169 |
| - ? 'Select to see all challenges' |
170 |
| - : registrationStatus} |
171 |
| - </div> |
172 |
| - </div> |
173 |
| - <div> |
174 |
| - {/* {challengesInCommunity} */} |
175 |
| - </div> |
176 |
| - </div> |
177 |
| - ); |
178 |
| - |
179 |
| - if (communityName === 'All') { |
180 |
| - return selectItem; |
181 |
| - } |
182 |
| - |
183 |
| - return ( |
184 |
| - <div> |
185 |
| - <Tooltip |
186 |
| - position="bottom" |
187 |
| - trigger={['hover']} |
188 |
| - content={( |
189 |
| - <div style={{ padding: '15px', fontSize: '13px', borderRadius: '5px' }}> |
190 |
| - <p> |
191 |
| - You are |
192 |
| - { !visitorRegisteredToCommunity && ( |
193 |
| - <span styleName="bold"> |
194 |
| - NOT |
195 |
| - </span> |
196 |
| - )} |
197 |
| - {' '} |
198 |
| - registered for this sub community. |
199 |
| - </p> |
200 |
| - <p> |
201 |
| - There are |
202 |
| - {/* {challengesInCommunity} */} |
203 |
| - {' '} |
204 |
| - challenges in this sub community |
205 |
| - </p> |
206 |
| - </div> |
207 |
| - )} |
208 |
| - > |
209 |
| - {selectItem} |
210 |
| - </Tooltip> |
211 |
| - </div> |
212 |
| - ); |
213 |
| - }; |
214 |
| - |
215 |
| - const mapCommunityOps = (community) => { |
216 |
| - if (community.challengeFilter |
217 |
| - && community.challengeFilter.events && community.challengeFilter.events.length) { |
218 |
| - return `event_${community.challengeFilter.events[0]}`; |
219 |
| - } |
220 |
| - |
221 |
| - return community.communityName === 'All' ? '' : community.groupIds[0]; |
222 |
| - }; |
223 |
| - |
224 |
| - const communityOps = communityFilters.filter(community => ( |
225 |
| - ((!community.hidden && !community.hideFilter) || community.communityName === 'All') && !community.communityName.includes('TCO') |
226 |
| - )) |
227 |
| - .map(community => ({ |
228 |
| - label: community.communityName, |
229 |
| - value: mapCommunityOps(community), |
230 |
| - name: community.communityName, |
231 |
| - data: getLabel(community), |
232 |
| - })); |
233 |
| - |
234 | 93 | // const mapOps = item => ({ label: item, value: item });
|
235 | 94 | const mapTypes = item => ({ label: item.name, value: item.abbreviation });
|
236 |
| - const getCommunityOption = () => { |
237 |
| - if (filterState.events && filterState.events.length) { |
238 |
| - return `event_${filterState.events[0]}`; |
239 |
| - } |
240 |
| - if (filterState.groups && filterState.groups.length) { |
241 |
| - return filterState.groups[0]; |
242 |
| - } |
243 |
| - return ''; |
244 |
| - }; |
245 | 95 |
|
246 | 96 | const isTrackOn = track => filterState.tracks && filterState.tracks[track];
|
247 | 97 |
|
@@ -572,52 +422,6 @@ export default function FiltersPanel({
|
572 | 422 | ) : null
|
573 | 423 | }
|
574 | 424 |
|
575 |
| - { !isReviewOpportunitiesBucket && !(recommendedToggle && activeBucket === 'openForRegistration') |
576 |
| - && ( |
577 |
| - <div styleName="filter-row"> |
578 |
| - <div styleName="filter filter community"> |
579 |
| - <label htmlFor="community-select" styleName="label"> |
580 |
| - Sub communities |
581 |
| - <input type="hidden" /> |
582 |
| - </label> |
583 |
| - <Select |
584 |
| - autoBlur |
585 |
| - clearable={false} |
586 |
| - id="community-select" |
587 |
| - // onChange={selectCommunity} |
588 |
| - onChange={(value) => { |
589 |
| - if (value && value.startsWith('event_')) { |
590 |
| - const event = value.split('_')[1]; |
591 |
| - setFilterState({ |
592 |
| - ..._.clone(filterState), |
593 |
| - events: event === '' ? [] : [event], |
594 |
| - groups: [], |
595 |
| - }); |
596 |
| - } else { |
597 |
| - const group = value; |
598 |
| - setFilterState({ |
599 |
| - ..._.clone(filterState), |
600 |
| - groups: group === '' ? [] : [group], |
601 |
| - events: [], |
602 |
| - }); |
603 |
| - } |
604 |
| - // setFilterState({ ..._.clone(filterState), groups: [value] }); |
605 |
| - }} |
606 |
| - options={communityOps} |
607 |
| - simpleValue |
608 |
| - value={getCommunityOption()} |
609 |
| - valueRenderer={option => ( |
610 |
| - <span styleName="active-community"> |
611 |
| - {option.name} |
612 |
| - </span> |
613 |
| - )} |
614 |
| - arrowRenderer={ArrowIcon} |
615 |
| - /> |
616 |
| - </div> |
617 |
| - </div> |
618 |
| - ) |
619 |
| - } |
620 |
| - |
621 | 425 | {
|
622 | 426 | isRecommendedChallengesVisible && _.get(auth, 'user.userId')
|
623 | 427 | && (
|
@@ -707,10 +511,6 @@ FiltersPanel.defaultProps = {
|
707 | 511 | };
|
708 | 512 |
|
709 | 513 | FiltersPanel.propTypes = {
|
710 |
| - communityFilters: PT.arrayOf(PT.shape({ |
711 |
| - communityId: PT.string.isRequired, |
712 |
| - communityName: PT.string.isRequired, |
713 |
| - })).isRequired, |
714 | 514 | defaultCommunityId: PT.string.isRequired,
|
715 | 515 | activeBucket: PT.string.isRequired,
|
716 | 516 | filterState: PT.shape().isRequired,
|
|
0 commit comments