Skip to content

Self-service prod release #325

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 19 commits into from
Feb 2, 2022
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
10 changes: 10 additions & 0 deletions src/components/challenge-detail/Header/ChallengeTags.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import "./style.module.scss";

export default function ChallengeTags(props) {
const {
selfService,
challengeId,
challengesUrl,
track,
Expand Down Expand Up @@ -113,6 +114,13 @@ export default function ChallengeTags(props) {
{matchSkills.map((item) => (
<VerifiedTag item={item} challengesUrl={challengesUrl} />
))}
{
selfService && (
<DevelopmentTrackTag>
<span>On Demand</span>
</DevelopmentTrackTag>
)
}
{tags.map(
(tag) =>
tag && (
Expand All @@ -133,6 +141,7 @@ export default function ChallengeTags(props) {
ChallengeTags.defaultProps = {
events: [],
technPlatforms: [],
selfService: false,
};

ChallengeTags.propTypes = {
Expand All @@ -143,4 +152,5 @@ ChallengeTags.propTypes = {
technPlatforms: PT.arrayOf(PT.string),
challengeType: PT.shape().isRequired,
openForRegistrationChallenges: PT.shape().isRequired,
selfService: PT.bool,
};
7 changes: 7 additions & 0 deletions src/components/challenge-detail/Header/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,11 @@ export default function ChallengeHeader(props) {
status,
type,
track,
legacy,
} = challenge;

const { selfService } = legacy;

const tags = challenge.tags || [];

const allPhases = challenge.phases || [];
Expand Down Expand Up @@ -275,6 +278,7 @@ export default function ChallengeHeader(props) {
<h1 styleName="challenge-header">{name}</h1>
<div styleName="tag-container">
<ChallengeTags
selfService={selfService}
challengeId={challengeId}
track={track}
challengeType={_.find(challengeTypesMap, { name: type }) || {}}
Expand Down Expand Up @@ -496,6 +500,9 @@ ChallengeHeader.propTypes = {
checkpoints: PT.shape(),
challenge: PT.shape({
id: PT.string.isRequired,
legacy: PT.shape({
selfService: PT.bool,
}),
type: PT.any,
track: PT.string,
drPoints: PT.any,
Expand Down
5 changes: 3 additions & 2 deletions src/components/challenge-detail/Specification/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default function ChallengeDetailsView(props) {
} = challenge;

const roles = (userDetails || {}).roles || [];
const { reviewScorecardId, screeningScorecardId, forumId } = legacy;
const { reviewScorecardId, screeningScorecardId, forumId, selfService } = legacy;

let stockArtValue = "";
const allowStockArt = _.find(metadata, { name: "allowStockArt" });
Expand Down Expand Up @@ -163,7 +163,7 @@ export default function ChallengeDetailsView(props) {
<div styleName="challenge-details-view">
<div styleName="challenge-specifications">
<div styleName={`challenge-specs-main ${accentedStyle}`}>
{track.toLowerCase() !== "design" ? (
{track.toLowerCase() !== "design" && !selfService ? (
<div>
{description && (
<article>
Expand Down Expand Up @@ -390,6 +390,7 @@ ChallengeDetailsView.propTypes = {
reviewScorecardId: PT.oneOfType([PT.string, PT.number]),
screeningScorecardId: PT.string,
forumId: PT.number,
selfService: PT.bool,
}),
track: PT.string.isRequired,
legacyId: PT.oneOfType([PT.string, PT.number]),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { useState, useMemo } from "react";
import PT from "prop-types";
import _ from 'lodash';
import Tag from "../../../../../components/Tag";
import * as util from "../../../../../utils/tag";
import { useTargetSize } from "../../../../../utils/hooks/useTargetSize";

import "./styles.scss";

const Tags = ({ tags, onClickTag, tooltip }) => {
const Tags = ({ tags, onClickTag, tooltip, isSelfService }) => {
const Tooltip = tooltip;

const [size, ref] = useTargetSize();
Expand Down Expand Up @@ -41,6 +42,7 @@ const Tags = ({ tags, onClickTag, tooltip }) => {

return (
<div styleName="tags" ref={ref}>
{isSelfService && <Tag tag="On Demand" onClick={_.noop}/>}
{visibleTags.map((tag) => (
<Tag tag={tag} key={tag} onClick={onClickTag} />
))}
Expand All @@ -54,11 +56,13 @@ const Tags = ({ tags, onClickTag, tooltip }) => {
};

Tags.defaultProps = {
isSelfService: false,
tags: [],
tooltip: ({ children }) => <>{children}</>,
};

Tags.propTypes = {
isSelfService: PT.bool,
tags: PT.arrayOf(PT.string),
onClickTag: PT.func,
};
Expand Down
1 change: 1 addition & 0 deletions src/containers/Challenges/Listing/ChallengeItem/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const ChallengeItem = ({ challenge, onClickTag, onClickTrack, isLoggedIn }) => {
</div>
<div styleName="tags">
<Tags
isSelfService={_.get(challenge, 'legacy.selfService')}
tags={challenge.tags}
onClickTag={onClickTag}
tooltip={({ children, more }) => (
Expand Down