Skip to content

Sync develop with master #6845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"jsx-a11y/anchor-is-valid": false,
"import/no-cycle": [2, { "maxDepth": 1 }],
"react/forbid-prop-types": false,
"react/no-unknown-property": ["error", { "ignore": ["styleName"] }]
"react/no-unknown-property": false,
"react/jsx-no-bind": false,
"react/destructuring-assignment": false,
"react/no-array-index-key": false
},
"env": {
"browser": true
Expand Down
62 changes: 22 additions & 40 deletions src/shared/components/Contentful/AppComponent/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,59 +18,41 @@ import PathSelector from 'components/MemberPath/PathSelector';
const { fireErrorMessage } = errors;

export function AppComponentSwitch(appComponent) {
const {
fields: {
type,
theme,
props,
props: {
leaderboardApiUrl,
title,
podiumSpots,
isCopilot,
hasChallengeHistory,
tcoPointsApiUrl,
memberLimit,
isAlgo,
},
},
sys: { id },
} = appComponent;
if (type === 'TCO-Leaderboard') {
if (appComponent.fields.type === 'TCO-Leaderboard') {
return (
<Leaderboard
id={id}
apiUrl={leaderboardApiUrl}
title={title}
podiumSpots={podiumSpots}
isCopilot={isCopilot}
hasChallengeHistory={hasChallengeHistory}
tcoPointsApiUrl={tcoPointsApiUrl}
memberLimit={memberLimit}
isAlgo={isAlgo}
key={id}
themeName={theme}
id={appComponent.sys.id}
apiUrl={appComponent.fields.props.leaderboardApiUrl}
title={appComponent.fields.props.title}
podiumSpots={appComponent.fields.props.podiumSpots}
isCopilot={appComponent.fields.props.isCopilot}
hasChallengeHistory={appComponent.fields.props.hasChallengeHistory}
tcoPointsApiUrl={appComponent.fields.props.tcoPointsApiUrl}
memberLimit={appComponent.fields.props.memberLimit}
isAlgo={appComponent.fields.props.isAlgo}
key={appComponent.sys.id}
themeName={appComponent.fields.theme}
/>
);
}
if (type === 'RecruitCRM-Jobs') {
return <RecruitCRMJobs {...props} key={id} />;
if (appComponent.fields.type === 'RecruitCRM-Jobs') {
return <RecruitCRMJobs {...appComponent.fields.props} key={appComponent.sys.id} />;
}
if (type === 'EmailSubscribeForm') {
return <EmailSubscribeForm {...props} key={id} />;
if (appComponent.fields.type === 'EmailSubscribeForm') {
return <EmailSubscribeForm {...appComponent.fields.props} key={appComponent.sys.id} />;
}
if (type === 'GSheet') {
return <GSheet {...props} key={id} />;
if (appComponent.fields.type === 'GSheet') {
return <GSheet {...appComponent.fields.props} key={appComponent.sys.id} />;
}
if (type === 'MemberPath') {
if (appComponent.fields.type === 'MemberPath') {
return (
<PathSelector
{...props}
key={id}
{...appComponent.fields.props}
key={appComponent.sys.id}
/>
);
}
fireErrorMessage(`Unsupported app component type ${type}`, '');
fireErrorMessage(`Unsupported app component type ${appComponent.fields.type}`, '');
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/Contentful/Viewport/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ export function ViewportLoader(props) {
}

if (query) {
queries.push({ ...query, content_type: 'viewport' });
queries.push({ ...props.query, content_type: 'viewport' });
}

return (
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/Gigs/ReferralCode/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function ReferralCode(props) {
const [growSurfState, setGrowSurfState] = useState(growSurf);
const [copyBtnText, setCopyBtnText] = useState('COPY');
useEffect(() => {
setGrowSurfState(growSurf);
setGrowSurfState(props.growSurf);
}, [growSurf]);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,7 @@ export default function ExistingLink(props) {
return (
<div role="link" styleName={`external-link-tile ${pending ? 'external-link-tile--pending' : ''}`} onClick={e => openLink(e, link)}>
<div styleName="ext-link-tile_edit-header">
<div
role="button"
onClick={(e) => {
e.preventDefault();
e.stopPropagation();
onConfirmDeleteLink(e, link);
}}
styleName={`ext-link-tile_edit-header_delete ${link.deleting ? 'ext-link-tile_edit-header_delete--disabled' : ''}`}
/>
<div role="button" onClick={e => onConfirmDeleteLink(e, link)} styleName={`ext-link-tile_edit-header_delete ${link.deleting ? 'ext-link-tile_edit-header_delete--disabled' : ''}`} prevent-event-propagation="true" />
</div>
<div styleName="top">
<div styleName="logo">
Expand Down Expand Up @@ -102,7 +94,7 @@ export default function ExistingLink(props) {
<p className={!pending ? 'hidden' : ''} styleName="link-title">
Loading data. This will take a few minutes.
</p>
<a styleName="link-url" id="link-url" href={prependProtocol(link.URL)} target="_blank" rel="noopener noreferrer">
<a styleName="link-url" id="link-url" href={prependProtocol(link.URL)} target="_blank" rel="noopener noreferrer" prevent-event-propagation="true">
{prependProtocol(link.URL)}
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ export default function ChallengeViewSelector(props) {
</div>
<div styleName="sort-body">
{
sortOptions.map(option => (
sortOptions.map((option, index) => (
<div
key={`sort-option-${option.name}`}
map={`sort-option-${index}`}
styleName="sort-item"
onClick={() => {
setSelectedSortOption(option.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const { getService } = services.submissions;

export default function SubmissionHistoryRow({
isMM,
isRDM,
submission,
finalScore,
provisionalScore,
Expand Down Expand Up @@ -81,7 +82,7 @@ export default function SubmissionHistoryRow({
</div>
</div>
{
isLoggedIn && isMM
isLoggedIn && (isMM || isRDM)
&& (numWinners > 0 || challengeStatus === CHALLENGE_STATUS.COMPLETED) && (
<div styleName="col-2 col center">
<div styleName="mobile-header">Action</div>
Expand Down Expand Up @@ -121,6 +122,7 @@ SubmissionHistoryRow.defaultProps = {

SubmissionHistoryRow.propTypes = {
isMM: PT.bool.isRequired,
isRDM: PT.bool.isRequired,
submission: PT.number.isRequired,
finalScore: PT.oneOfType([
PT.number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import SubmissionHistoryRow from './SubmissionHistoryRow';
import style from './style.scss';

export default function SubmissionRow({
isMM, openHistory, member, submissions, score, toggleHistory, challengeStatus,
isMM, isRDM, openHistory, member, submissions, score, toggleHistory, challengeStatus,
isReviewPhaseComplete, finalRank, provisionalRank, onShowPopup, rating, viewAsTable,
numWinners, auth, isLoggedIn,
}) {
Expand Down Expand Up @@ -166,7 +166,8 @@ export default function SubmissionRow({
Time
</div>
{
isMM && (numWinners > 0 || challengeStatus === CHALLENGE_STATUS.COMPLETED) && (
(isMM || isRDM)
&& (numWinners > 0 || challengeStatus === CHALLENGE_STATUS.COMPLETED) && (
<div styleName="col-2 col center">
Action
</div>
Expand All @@ -185,6 +186,7 @@ export default function SubmissionRow({
<SubmissionHistoryRow
isReviewPhaseComplete={isReviewPhaseComplete}
isMM={isMM}
isRDM={isRDM}
challengeStatus={challengeStatus}
submission={submissions.length - index}
{...submissionHistory}
Expand Down Expand Up @@ -224,6 +226,7 @@ SubmissionRow.defaultProps = {

SubmissionRow.propTypes = {
isMM: PT.bool.isRequired,
isRDM: PT.bool.isRequired,
openHistory: PT.bool.isRequired,
member: PT.string.isRequired,
challengeStatus: PT.string.isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import React from 'react';
import PT from 'prop-types';
import moment from 'moment';
import { isMM as checkIsMM } from 'utils/challenge';
import { isMM as checkIsMM, isRDM as checkIsRDM } from 'utils/challenge';
import _ from 'lodash';
import { connect } from 'react-redux';
import { config } from 'topcoder-react-utils';
Expand Down Expand Up @@ -309,6 +309,7 @@ class SubmissionsComponent extends React.Component {
} = challenge;

const isMM = this.isMM();
const isRDM = checkIsRDM(challenge);
const isLoggedIn = !_.isEmpty(auth.tokenV3);
const isReviewPhaseComplete = this.checkIsReviewPhaseComplete();

Expand Down Expand Up @@ -604,7 +605,7 @@ class SubmissionsComponent extends React.Component {
}
{
((numWinners > 0 || challenge.status === CHALLENGE_STATUS.COMPLETED)
&& isMM && isLoggedIn) && (
&& (isMM || isRDM) && isLoggedIn) && (
<div styleName="block-download-all">
<button
disabled={downloadingAll}
Expand Down Expand Up @@ -845,6 +846,7 @@ class SubmissionsComponent extends React.Component {
submissions={sortedSubmissions}
isReviewPhaseComplete={isReviewPhaseComplete}
isMM={isMM}
isRDM={isRDM}
key={submission.member}
{...submission}
challengeStatus={challenge.status}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function getId(submissions, placement) {
export default function Winner({
isDesign,
isMM,
isRDM,
prizes,
submissions,
viewable,
Expand Down Expand Up @@ -89,7 +90,7 @@ export default function Winner({
</div>
<div styleName="download-container">
{
((!winner.submissionDownloadLink || !viewable) && isMM && isLoggedIn) && (
((!winner.submissionDownloadLink || !viewable) && (isMM || isRDM) && isLoggedIn) && (
<button
onClick={() => {
// download submission
Expand Down Expand Up @@ -145,6 +146,7 @@ Winner.defaultProps = {
Winner.propTypes = {
isDesign: PT.bool.isRequired,
isMM: PT.bool.isRequired,
isRDM: PT.bool.isRequired,
prizes: PT.arrayOf(PT.shape()),
submissions: PT.arrayOf(PT.object).isRequired,
viewable: PT.bool.isRequired,
Expand Down
6 changes: 5 additions & 1 deletion src/shared/components/challenge-detail/Winners/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default function Winners({
viewable,
isDesign,
isMM,
isRDM,
isLoggedIn,
auth,
challengeStatus,
Expand All @@ -31,7 +32,7 @@ export default function Winners({
<div styleName="container">
{
((winners.length > 0 || challengeStatus === CHALLENGE_STATUS.COMPLETED)
&& isMM && isLoggedIn) && (
&& (isMM || isRDM) && isLoggedIn) && (
<div styleName="block-download-all">
<button
disabled={downloadingAll}
Expand Down Expand Up @@ -80,6 +81,7 @@ export default function Winners({
<Winner
isDesign={isDesign}
isMM={isMM}
isRDM={isRDM}
key={`${w.handle}-${w.placement}`}
prizes={prizes}
submissions={submissions}
Expand All @@ -101,6 +103,7 @@ Winners.defaultProps = {
viewable: false,
isDesign: false,
isMM: false,
isRDM: false,
isLoggedIn: false,
challengeStatus: '',
};
Expand All @@ -112,6 +115,7 @@ Winners.propTypes = {
viewable: PT.bool,
isDesign: PT.bool,
isMM: PT.bool,
isRDM: PT.bool,
isLoggedIn: PT.bool,
challengeStatus: PT.string,
auth: PT.shape().isRequired,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import PT from 'prop-types';
import React from 'react';
import Tooltip from '../../../Tooltip';
import Tooltip from 'components/Tooltip';
import Tip from './Tip';
import './style.scss';

Expand Down Expand Up @@ -35,6 +35,11 @@ export default function Prize({
</div>
);

function placeArrow(TooltipNode) {
const arrow = TooltipNode.querySelector('.rc-tooltip-arrow');
arrow.style.left = '33%';
}

const component = (
<div
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
Expand All @@ -43,13 +48,7 @@ export default function Prize({
>
{((onlyShowTooltipForPrize && !withoutTooltip)
? (
<Tooltip
content={tip}
placeArrow={(TooltipNode) => {
const arrow = TooltipNode.querySelector('.rc-tooltip-arrow');
arrow.style.left = '33%';
}}
>
<Tooltip content={tip} placeArrow={placeArrow}>
{prizeUI}
</Tooltip>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export default function AccessDenied(props) {
spaceName,
environment,
viewportId,
children,
} = props;

if (viewportId) {
Expand Down Expand Up @@ -68,7 +67,7 @@ export default function AccessDenied(props) {
<div styleName="msg">
You are not authorized to access this page.
</div>
{children}
{props.children}
</div>
);
case CAUSE.HAVE_NOT_SUBMITTED_TO_THE_CHALLENGE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ const settings = {
export default function Home(props) {
const {
userId,
resetChallengeListing,
} = props;

return (
Expand Down Expand Up @@ -200,7 +199,7 @@ export default function Home(props) {
>
<div styleName="ImageTextStyles.linkWrap style.linkWrap">
<Link
onClick={() => resetChallengeListing()}
onClick={() => props.resetChallengeListing()}
styleName="ImageTextStyles.link"
to="challenges?communityId="
>
Expand Down
4 changes: 2 additions & 2 deletions src/shared/containers/ErrorIcons/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ function Tip({ errors, clear }) {
&#10799;
</a>
{
errors.map(({ title, message }) => (
<div key={`${title}-${message}`} styleName="item">
errors.map(({ title, message }, i) => (
<div key={i.toString()} styleName="item">
<div styleName="title" title={title}>
{title}
</div>
Expand Down
Loading