Skip to content

PROD-3109 PROD-3106 PROD-2708 PROD-2640 -> Fix issues in self service -> dev #413

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 11 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from 5 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
56 changes: 44 additions & 12 deletions src-ts/lib/form/form-groups/form-card-set/FormCardSet.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
flex: 1 1 0;
margin-right: $space-xl;
border-radius: $space-xs;
padding: $space-lg 0;
padding: $space-xxl 0px 0px;
background-color: $black-5;
position: relative;
height: calc($space-xl * 30);

.popular-card {
display: flex;
Expand Down Expand Up @@ -61,19 +62,25 @@
align-items: center;

h3 {
margin: $space-lg;
margin: $space-xxl $space-lg;
font-weight: 500;
font-size: $space-mx;
font-size: calc($space-mx + $space-xs);
line-height: $space-mx;
margin-top: $space-xxl;
}

.body-medium-bold {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than completely redefining a global style, body-medium-bold, can we find the global style that actually matches the design? Figma designs have the name of the font we should use.

The only things we should be overriding for global fonts are related to padding/layout.

font-weight: 700;
font-size: $space-xxl;
font-family: "Roboto";
padding: 0;
line-height: calc($space-xxl - 2px);
}

&.feature {
visibility: hidden;

h3 {
margin: $space-lg;
margin-top: $space-xxl;
margin: $space-xxl $space-lg;
font-size: $space-xxxxl;
}
}
Expand All @@ -82,9 +89,15 @@
h3 {
font-size: $space-xxxxl;
line-height: $space-xxxxl;
margin-top: $space-md;
margin-top: $space-sm;
margin-bottom: $space-xxl;
}

.body-medium-bold {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here?

font-size: $space-xl;
line-height: $space-xxxxl;
font-style: normal;
}
}
}

Expand All @@ -97,24 +110,36 @@
}

.card-section {
margin: $space-lg 0;
margin: $space-mx 0;

.row {
height: auto;

&:last-child {
.row-divider {
&:last-child {
display: block;
}
}
}
}

.row-divider {
height: $border-xs;
border-bottom: $border solid $black-10;
width: auto;
margin: 0;

&:last-child {
display: none;
}
}

.card-row {
display: flex;
padding: $space-md;
align-items: center;
min-height: calc($space-lg + $space-mx);
min-height: calc($space-lg + $space-mx - 2px);
position: relative;

.card-row-col {
Expand Down Expand Up @@ -156,6 +181,7 @@
}
}
&.mobile {
margin-bottom: 0;
.feature-name {
width: 100%;
}
Expand All @@ -164,13 +190,14 @@
}
}
&.feature {
margin: calc($space-lg - 0.2px) 0;
margin-top: $space-mx;
}
}

&.feature {
background-color: $tc-white;
margin-right: 0;
flex-grow: 0.9;

.card-row-col:nth-child(2) {
display: none;
Expand All @@ -188,9 +215,14 @@
}

svg.card-row-icon {
height: 14px;
width: 14px;
height: 24px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use the _icons.mixins to size icons.

width: 24px;
display: inline;
margin-right: 6px;

@include ltemd {
height: 16px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

width: 16px;
}
}
}
5 changes: 3 additions & 2 deletions src-ts/lib/form/form-groups/form-card-set/FormCardSet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const FormCardSet: React.FC<FormCardSetProps> = ({ name, cards, onChange, value
<div key={`card-${index}`}className={cn(styles['card'], selected && styles['selected'], isMobile && card.mostPopular && styles['mobile-popular'], { [styles.feature]: index === 0, [styles.mobile]: isMobile })}>
{ card.mostPopular && <div className={styles['popular-card']}>MOST POPULAR</div>}
<div className={cn(styles['card-header'], isMobile && styles['mobile'], { [styles.feature]: index === 0 })}>
<div className='body-medium-bold'>{card.title}</div>
<div className={styles['body-medium-bold']}>{card.title}</div>
<h3>{formattedPrice}</h3>
{getButton(card, selected)}
</div>
Expand Down Expand Up @@ -77,12 +77,13 @@ const FormCardSet: React.FC<FormCardSetProps> = ({ name, cards, onChange, value
{(
<span className={cn(styles['card-row-col'], styles['center'])}>
{ row.valueIcon ?
<IconOutline.CheckIcon width={18} height={16} /> :
<IconOutline.CheckIcon width={28} height={20} /> :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use the mixins in the stylesheets to size icons.

<span className='body-main'>{row.text}</span>
}
</span>
)}
</div>
<div className={styles['row-divider']}></div>
</div>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ import _ from 'lodash'
import { Dispatch, FC, SetStateAction, useEffect, useState } from 'react'
import { Link } from 'react-router-dom'

import { currencyFormat } from '../../../../../src/utils'
import { ArrowIcon, FormCard, LoadingSpinner } from '../../../../lib'
import { ArrowIcon, LoadingSpinner } from '../../../../lib'
import getSelectedPackageFormatted from '../../../../utils/bug-hunt'
import { ChallengeMetadataName, workFactoryMapFormData } from '../../work-lib'
import BugHuntPricingConfig from '../../work-self-service/intake-forms/bug-hunt/bug-hunt.form.pricing-config'

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

Expand Down Expand Up @@ -108,15 +107,4 @@ function checkIsEmpty(detail: Array<string> | {} | string): boolean {
.filter((val) => val?.trim().length > 0).length === 0)
}

const getSelectedPackageFormatted: (packageId: string) => string = (packageId) => {
const currentPackage: FormCard | undefined = BugHuntPricingConfig.find((pricingConfig) => pricingConfig.id === packageId)
if (currentPackage) {
const deviceType: string = currentPackage.sections?.[0]?.rows?.[3]?.text || ''
const noOfTesters: string = `${currentPackage.sections?.[0]?.rows?.[2]?.text || 0} testers`
return `${currentPackage.title} - ${currencyFormat(currentPackage.price)} - ${deviceType} - ${noOfTesters}`
}

return packageId
}

export default WorkDetailDetailsPane
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import moment from 'moment'

import getSelectedPackageFormatted from '../../../../../../utils/bug-hunt'
import { WorkConfigConstants, WorkStrings } from '../../../work-constants'
import {
ActivateWorkRequest,
Expand Down Expand Up @@ -302,7 +303,7 @@ function buildFormDataBugHunt(formData: any): ReadonlyArray<FormDetail> {
{
key: ChallengeMetadataName.packageType,
title: ChallengeMetadataTitle.bugHuntPackage,
value: formData.packageType,
value: getSelectedPackageFormatted(formData.packageType),
},
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export const WorkTypeConfigs: { [workType: string]: WorkTypeConfig } = {
[WorkType.bugHunt]: {
about: `Expert QA testers will verify that all of the pages on your website are working correctly from the end-user perspective. The testing will stress functional issues, but also includes security issues, user interface issues, usability issues and more. Test on desktop, tablet, and mobile, to uncover bugs before your customers encounter them.`,
bgImage: bugHuntTileImg,
deliverablesDescription: `You will receive thorough testing of your website, and at the conclusion will be provided
a detailed report of bugs which have steps to reproduce, screenshots / videos if applicable,
details of the bug, and severity of the issue.`,
deliverablesDescription: 'You will receive thorough testing of your website by QA experts, and an actionable report extremely quickly. Our experts will deliver a detailed list of bugs found, with steps to reproduce, including screenshots, videos, and the information you need to fix them.',
description: 'Execute thorough bug hunts exceptionally fast. Receive a detailed list of bugs and instructions on exactly how to fix them.',
duration: {
'advanced': 6,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ const BugHuntIntakeForm: React.FC = () => {
const [loading, setLoading]: [boolean, Dispatch<SetStateAction<boolean>>] = useState<boolean>(false)
const [saveSuccess, setSaveSuccess]: [boolean, Dispatch<SetStateAction<boolean>>] = useState<boolean>(false)

const defaultPackage: PricePackageName = 'standard'

BugHuntFormConfig.buttons.primaryGroup[0].onClick = () => { setAction('save') }
BugHuntFormConfig.buttons.primaryGroup[0].hidden = !isLoggedIn
BugHuntFormConfig.buttons.primaryGroup[1].onClick = () => { setAction('submit') }
Expand All @@ -72,7 +74,7 @@ const BugHuntIntakeForm: React.FC = () => {

const [formValues, setFormValues]: [any, Dispatch<any>] = useState({
currentStep: 'basicInfo',
[ChallengeMetadataName.packageType]: 'standard',
[ChallengeMetadataName.packageType]: defaultPackage,
})

const [selectedPackage, setSelectedPackage]: [PricePackageName, Dispatch<SetStateAction<PricePackageName>>]
Expand Down Expand Up @@ -111,6 +113,11 @@ const BugHuntIntakeForm: React.FC = () => {

if (formData?.packageType) {
setSelectedPackage(formData.packageType)
} else {
setFormValues({
...formValues,
[ChallengeMetadataName.packageType]: defaultPackage,
})
}
}

Expand Down
16 changes: 16 additions & 0 deletions src-ts/utils/bug-hunt/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { currencyFormat } from '../../../src/utils'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is a confusing naming convention, but /src-ts/utils in this case refers specifically to the utilities in the header, like Account Settings. See the README.

Anything related to bughunt and the work tool needs to be located w/in the /src-ts/tools/work directory. Perhaps, this would go in the src-ts/tools/work/work-lib/work-provider/work-functions/work.functions.ts?

Also, we should not be importing anything from the /src directory into the /src-ts directory unless we absolutely have to. And then there should be comment explaining why it has to be imported.

In this case, please use the textFormatMoneyLocaleString method from the /src-ts/lib to format money.

import { FormCard } from '../../lib'
import BugHuntPricingConfig from '../../tools/work/work-self-service/intake-forms/bug-hunt/bug-hunt.form.pricing-config'

function getSelectedPackageFormatted(packageId: string): string {
const currentPackage: FormCard | undefined = BugHuntPricingConfig.find((pricingConfig) => pricingConfig.id === packageId)
if (currentPackage) {
const deviceType: string = currentPackage.sections?.[0]?.rows?.[3]?.text || ''
const noOfTesters: string = `${currentPackage.sections?.[0]?.rows?.[2]?.text || 0} testers`
return `${currentPackage.title} - ${currencyFormat(currentPackage.price)} - ${deviceType} - ${noOfTesters}`
}

return packageId
}

export default getSelectedPackageFormatted