Skip to content
2 changes: 1 addition & 1 deletion src-ts/lib/form/form-functions/form.functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ export async function onSubmitAsync<T>(
): Promise<void> {

event.preventDefault()
event.stopPropagation()

const { groups, shortName, successMessage }: FormDefinition = formDef
const inputs: Array<FormInputModel> = getFormInputFields(groups || [])

// get the dirty fields before we validate b/c validation marks them dirty on submit
const dirty: FormInputModel | undefined = inputs?.find(fieldDef => !!fieldDef.dirty)

// if there are any validation errors, display a message and stop submitting
// NOTE: need to check this before we check if the form is dirty bc you
// could have a form that's not dirty but has errors and you wouldn't
Expand Down
17 changes: 17 additions & 0 deletions src-ts/lib/svgs/icon-wrapper/IconWrapper.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
@import '../../styles/includes';

.iconWrapper {
@include icon-mxx;

margin: 0 $space-lg $space-lg $space-lg;
background: $tc-grad12;
border-radius: $space-xxl;
display: flex;
align-items: center;
justify-content: center;

svg {
@include icon-xl;
color: $tc-white;
}
}
17 changes: 17 additions & 0 deletions src-ts/lib/svgs/icon-wrapper/IconWrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import classNames from 'classnames'
import { FC } from 'react'

import styles from './IconWrapper.module.scss'

interface IconWrapperProps {
className?: string
icon: JSX.Element
}

const IconWrapper: FC<IconWrapperProps> = ({ className, icon }: IconWrapperProps) => (
<div className={classNames(styles.iconWrapper, className)}>
<>{icon}</>
</div>
)

export default IconWrapper
1 change: 1 addition & 0 deletions src-ts/lib/svgs/icon-wrapper/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as IconWrapper } from './IconWrapper'
1 change: 1 addition & 0 deletions src-ts/lib/svgs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ export {
GitlabIcon,
GithubIcon
}
export * from './icon-wrapper'
1 change: 1 addition & 0 deletions src-ts/tools/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ export {
WorkTypeCategoryUnknownIcon,
WorkTypeConfigs,
BugHuntIntakeForm,
bugHuntRoute
} from './work'
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,11 @@ function getProgress(challenge: Challenge, workStatus: WorkStatus): WorkProgress
name: 'Submitted',
},
{
date: getProgressStepDateStart(challenge, [ChallengePhaseName.registration]),
date: getProgressStepDateStart(challenge, [
ChallengePhaseName.specificationReview,
ChallengePhaseName.specificationSubmission,
ChallengePhaseName.registration,
]),
name: 'Started',
},
{
Expand Down Expand Up @@ -694,7 +698,10 @@ function getTypeCategory(type: WorkType): WorkTypeCategory {
case WorkType.designLegacy:
return WorkTypeCategory.design

// TOOD: other categories: qa and dev
case WorkType.bugHunt:
return WorkTypeCategory.qa

// TOOD: other categories: dev
default:
return WorkTypeCategory.unknown
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export enum ChallengePhaseName {
specificationReview = 'Specification Review',
specificationSubmission = 'Specification Submission',
appeals = 'Appeals',
appealsResponse = 'Appeals Response',
approval = 'Approval',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
} from '../../../work-lib'
import { WorkServicePrice } from '../../../work-service-price'
import { WorkTypeBanner } from '../../../work-type-banner'
import { dashboardRoute } from '../../../work.routes'
import { dashboardRoute, selfServiceStartRoute } from '../../../work.routes'
import IntakeFormsBreadcrumb from '../intake-forms-breadcrumb/IntakeFormsBreadcrumb'

import { BugHuntFormConfig } from './bug-hunt.form.config'
Expand All @@ -52,7 +52,7 @@ const BugHuntIntakeForm: React.FC = () => {
BugHuntFormConfig.buttons.primaryGroup[0].hidden = !isLoggedIn
BugHuntFormConfig.buttons.primaryGroup[1].onClick = () => { setAction('submit') }
if (BugHuntFormConfig.buttons.secondaryGroup) {
BugHuntFormConfig.buttons.secondaryGroup[0].onClick = () => { navigate(-1) }
BugHuntFormConfig.buttons.secondaryGroup[0].onClick = () => { navigate(selfServiceStartRoute) }
}

const [challenge, setChallenge]: [Challenge | undefined, Dispatch<SetStateAction<Challenge | undefined>>] = useState()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,6 @@

margin-top: $space-xl;

.iconWrapper {
height: 48;
width: 48;
margin: 0 $space-lg $space-lg $space-lg;
background: $tc-grad12;
border-radius: 24px;

svg {
@include icon-xl;
margin: $space-md;
color: $tc-white;
}
}

.inline {
display: flex;
flex-direction: row;
Expand Down
10 changes: 4 additions & 6 deletions src-ts/tools/work/work-service-price/WorkServicePrice.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FC } from 'react'

import { IconOutline, textFormatMoneyLocaleString, Tooltip } from '../../../lib'
import { IconOutline, IconWrapper, textFormatMoneyLocaleString, Tooltip } from '../../../lib'

import styles from './WorkServicePrice.module.scss'

Expand All @@ -20,11 +20,9 @@ const ServicePrice: FC<WorkServicePriceProps> = (props: WorkServicePriceProps) =
return (
<div className={styles.container}>
<div className={styles.inline}>
<div className={styles.iconWrapper}>
{!!showIcon && !!icon && (
<>{icon}</>
)}
</div>
{!!showIcon && !!icon && (
<IconWrapper icon={icon} />
)}
<div>
{!hideTitle && (
<p><h3 className={styles.serviceTitle}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,13 @@
margin-top: 6px;
@include text-clamp(3);
}

.qa-icon {
margin: 0px 12px 0px 0px;

svg {
min-width: unset;
margin: 0px;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FC, SVGProps } from 'react'

import { IconOutline, IconWrapper } from '../../../../lib'
import {
Work,
WorkTypeCategory,
Expand All @@ -12,26 +11,35 @@ import styles from './WorkTableTitleRenderer.module.scss'

function WorkTableTitleRenderer(data: Work): JSX.Element {

let Icon: FC<SVGProps<SVGSVGElement>>
let Icon: JSX.Element
switch (data.typeCategory) {

case WorkTypeCategory.data:
Icon = WorkTypeCategoryDataIcon
Icon = <WorkTypeCategoryDataIcon />
break

case WorkTypeCategory.design:
Icon = WorkTypeCategoryDesignIcon
Icon = <WorkTypeCategoryDesignIcon />
break

// TODO: qa and dev work categories
case WorkTypeCategory.qa:
Icon = (
<IconWrapper
className={styles['qa-icon']}
icon={<IconOutline.BadgeCheckIcon />}
/>
)
break

// TODO: dev work categories
default:
Icon = WorkTypeCategoryUnknownIcon
Icon = <WorkTypeCategoryUnknownIcon />
break
}

return (
<div className={styles['work-table-title-container']}>
<Icon />
{Icon}
<div className={styles['work-table-title']}>
<div className={styles.title}>
{data.title}
Expand Down
11 changes: 6 additions & 5 deletions src-ts/tools/work/work.routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const rootRoute: string = '/work'
export const selfServiceRootRoute: string = '/self-service'
export const selfServiceStartRoute: string = `${selfServiceRootRoute}/wizard`
export const dashboardRoute: string = `${rootRoute}/dashboard`
export const bugHuntRoute: string = 'bug-hunt/'

export function workDashboardRoute(active: string): string {
return `${dashboardRoute}/${active}`
Expand Down Expand Up @@ -82,23 +83,23 @@ export const workRoutes: Array<PlatformRoute> = [
// Bug Hunt
{
element: <BugHuntIntakeForm />,
route: `bug-hunt/basic-info`,
route: `${bugHuntRoute}basic-info`,
},
{
element: <BugHuntIntakeForm />,
route: `bug-hunt/basic-info/:workId`,
route: `${bugHuntRoute}basic-info/:workId`,
},
{
element: <Review />,
route: `bug-hunt/review`,
route: `${bugHuntRoute}review`,
},
{
element: <Review />,
route: `bug-hunt/review/:workId`,
route: `${bugHuntRoute}review/:workId`,
},
{
element: <WorkLoginPrompt previousPageUrl={WorkIntakeFormRoutes[WorkType.bugHunt]['basicInfo']} />,
route: `bug-hunt/login-prompt/:retUrl`,
route: `${bugHuntRoute}login-prompt/:retUrl`,
},
// General
{
Expand Down
8 changes: 5 additions & 3 deletions src/IntakeForm.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useNavigate, Route, Routes } from "react-router-dom";
import { useNavigate, Route, Routes, useLocation } from "react-router-dom";
import _ from "lodash";
import React, { useContext, useEffect, useState } from "react";
import { useDispatch } from "react-redux";
Expand Down Expand Up @@ -28,11 +28,12 @@ import WebsiteDesign from "./routes/Products/WebsiteDesign";
import DataAdvisory from "./routes/Products/DataAdvisory";
import WebsiteDesignLegacy from "./routes/Products/WebsiteDesignLegacy";

import { profileContext, WorkType } from "../src-ts";
import { profileContext, WorkType, bugHuntRoute } from "../src-ts";

export default function IntakeForm() {

const dispatch = useDispatch();
const location = useLocation();
const [isLoading, setIsLoading] = useState(false);
const navigate = useNavigate()

Expand Down Expand Up @@ -141,7 +142,8 @@ export default function IntakeForm() {
};

const syncSavedData = (savedData) => {
if (!savedData) return;
const isBugHuntRoute = location.pathname.indexOf(`/${bugHuntRoute}`) > -1
if (!savedData || isBugHuntRoute) return;
const { form, progress } = savedData;
if (form) dispatch(saveForm(form));
if (progress?.currentStep) {
Expand Down