Skip to content

Commit 6490c97

Browse files
committed
Lint
1 parent eca51ee commit 6490c97

File tree

1 file changed

+1
-155
lines changed
  • src/shared/components/challenge-listing/Filters/FiltersPanel

1 file changed

+1
-155
lines changed

src/shared/components/challenge-listing/Filters/FiltersPanel/index.jsx

Lines changed: 1 addition & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,26 @@
2424
import _ from 'lodash';
2525
import React, { useState, useEffect } from 'react';
2626
import PT from 'prop-types';
27-
import Select from 'components/Select';
2827
import DateRangePicker from 'components/DateRangePicker';
2928
import moment from 'moment';
3029
import Tooltip from 'components/Tooltip';
31-
import { config, Link } from 'topcoder-react-utils';
30+
import { config } from 'topcoder-react-utils';
3231
import { COMPOSE, PRIORITY } from 'react-css-super-themr';
3332
import { REVIEW_OPPORTUNITY_TYPES } from 'utils/tc';
3433
import { isFilterEmpty, isPastBucket, BUCKETS } from 'utils/challenge-listing/buckets';
3534
import SwitchWithLabel from 'components/SwitchWithLabel';
3635
import ChallengeSearchBar from 'containers/challenge-listing/ChallengeSearchBar';
3736
import { challenge as challengeUtils } from 'topcoder-react-lib';
3837
import { createStaticRanges } from 'utils/challenge-listing/date-range';
39-
import ArrowIcon from 'assets/images/ico-arrow-down.svg';
4038
import CircleIcon from 'assets/images/icon-circle.svg';
4139
import Button from '../Button';
4240
import UiSimpleRemove from '../../Icons/ui-simple-remove.svg';
4341
import BucketSelector from '../../Sidebar/BucketSelector';
44-
import CheckmarkIcon from './CheckmarkIcon';
4542
import style from './style.scss';
4643

4744
const Filter = challengeUtils.filter;
4845

4946
export default function FiltersPanel({
50-
communityFilters,
5147
defaultCommunityId,
5248
filterState,
5349
// challenges,
@@ -92,156 +88,10 @@ export default function FiltersPanel({
9288
);
9389
}
9490

95-
const isVisitorRegisteredToCommunity = (visitorGroupIds, communityGroupIds) => Boolean(
96-
_.intersection(visitorGroupIds, communityGroupIds).length,
97-
);
98-
9991
// const isAllBucket = activeBucket === BUCKETS.ALL;
10092

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-
23493
// const mapOps = item => ({ label: item, value: item });
23594
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-
};
24595

24696
const isTrackOn = track => filterState.tracks && filterState.tracks[track];
24797

@@ -661,10 +511,6 @@ FiltersPanel.defaultProps = {
661511
};
662512

663513
FiltersPanel.propTypes = {
664-
communityFilters: PT.arrayOf(PT.shape({
665-
communityId: PT.string.isRequired,
666-
communityName: PT.string.isRequired,
667-
})).isRequired,
668514
defaultCommunityId: PT.string.isRequired,
669515
activeBucket: PT.string.isRequired,
670516
filterState: PT.shape().isRequired,

0 commit comments

Comments
 (0)