Skip to content

Commit b8fbeff

Browse files
authored
Merge pull request #580 from topcoder-platform/TCA-1185_hiring-manager-view-as-modal
TCA-1185 - restore and update modal view for the hiring manager view -> dev
2 parents b97d3db + e73380d commit b8fbeff

File tree

3 files changed

+136
-39
lines changed

3 files changed

+136
-39
lines changed

src-ts/tools/learn/learn-lib/hiring-manager-view/HiringManagerView.module.scss

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,76 @@
286286
@include ltemd {
287287
display: none;
288288
}
289+
}
290+
291+
.modalView {
292+
.hero {
293+
padding-top: $space-mx;
294+
min-height: 380px;
295+
296+
@include ltesm {
297+
max-height: none;
298+
}
299+
300+
301+
.heroInner {
302+
margin-bottom: 0;
303+
flex-direction: row;
304+
padding-right: $space-lg;
305+
padding-bottom: $space-mx;
306+
307+
@include ltesm {
308+
flex-direction: column;
309+
padding-right: 0;
310+
}
311+
312+
.heroLeft {
313+
.member {
314+
margin-bottom: $space-xxxxl;
315+
316+
>svg,
317+
>img {
318+
max-width: 88px;
319+
max-height: 88px;
320+
}
321+
}
322+
323+
.certTitle {
324+
font-size: 40px;
325+
line-height: 40px;
326+
}
327+
}
328+
}
329+
}
330+
331+
.wrap {
332+
margin-bottom: 0;
333+
}
334+
335+
.contentOuter {
336+
max-width: none;
337+
338+
>div {
339+
max-width: none !important;
340+
}
341+
342+
}
343+
344+
.courses {
345+
margin-bottom: 0;
346+
}
347+
348+
.colsWrap {
349+
margin-top: 0;
350+
}
351+
352+
.colWrap {
353+
&:last-child {
354+
max-width: 25%;
355+
padding-right: 0;
356+
@include ltemd {
357+
max-width: 100%;
358+
}
359+
}
360+
}
289361
}

src-ts/tools/learn/learn-lib/hiring-manager-view/HiringManagerView.tsx

Lines changed: 59 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
ReactNode,
66
SetStateAction,
77
useCallback,
8+
useLayoutEffect,
89
useRef,
910
useState,
1011
} from 'react'
@@ -34,7 +35,7 @@ import {
3435
useTCAShareCertificateModal,
3536
} from '..'
3637
import { getTCACertificationPath, getUserTCACertificateSsr } from '../../learn.routes'
37-
import { clearFCCCertificationTitle } from '../functions'
38+
import { clearFCCCertificationTitle, hideSiblings } from '../functions'
3839
import { EnvironmentConfig } from '../../../../config'
3940

4041
import { CertificateModal } from './certificate-modal'
@@ -64,6 +65,7 @@ export interface HiringManagerViewProps {
6465

6566
const HiringManagerView: FC<HiringManagerViewProps> = (props: HiringManagerViewProps) => {
6667
const certificateElRef: MutableRefObject<HTMLDivElement | any> = useRef()
68+
const wrapElRef: MutableRefObject<HTMLElement | any> = useRef()
6769

6870
const [certPreviewModalIsOpen, setCertPreviewModalIsOpen]: [boolean, Dispatch<SetStateAction<boolean>>]
6971
= useState<boolean>(false)
@@ -89,6 +91,8 @@ const HiringManagerView: FC<HiringManagerViewProps> = (props: HiringManagerViewP
8991
)
9092
const shareModal: TCAShareCertificateModalData = useTCAShareCertificateModal(ssrCertUrl)
9193

94+
const renderShareActions: boolean = props.isOwner && !props.isModalView
95+
9296
const getCertificateCanvas: () => Promise<HTMLCanvasElement | void>
9397
= useCertificateCanvas(certificateElRef)
9498

@@ -198,29 +202,31 @@ const HiringManagerView: FC<HiringManagerViewProps> = (props: HiringManagerViewP
198202
<div className={styles.heroCert}>
199203
{renderTCACertificatePreview(certificateElRef)}
200204

201-
<div className={styles.certActionBtns}>
202-
<ActionButton
203-
icon={<IconOutline.ZoomInIcon />}
204-
className={classNames(styles.certZoomBtn, styles.certActionBtn)}
205-
onClick={handleShowCertPreviewModal}
206-
/>
207-
{props.isOwner && (
208-
<>
209-
<ActionButton
210-
className={classNames('desktop-hide', styles.certActionBtn)}
211-
icon={<IconOutline.PrinterIcon />}
212-
onClick={handlePrint}
213-
/>
214-
<ActionButton
215-
className={classNames('desktop-hide', styles.certActionBtn)}
216-
icon={<IconOutline.DownloadIcon />}
217-
onClick={handleDownload}
218-
/>
219-
</>
220-
)}
221-
</div>
205+
{!props.isModalView && (
206+
<div className={styles.certActionBtns}>
207+
<ActionButton
208+
icon={<IconOutline.ZoomInIcon />}
209+
className={classNames(styles.certZoomBtn, styles.certActionBtn)}
210+
onClick={handleShowCertPreviewModal}
211+
/>
212+
{renderShareActions && (
213+
<>
214+
<ActionButton
215+
className={classNames('desktop-hide', styles.certActionBtn)}
216+
icon={<IconOutline.PrinterIcon />}
217+
onClick={handlePrint}
218+
/>
219+
<ActionButton
220+
className={classNames('desktop-hide', styles.certActionBtn)}
221+
icon={<IconOutline.DownloadIcon />}
222+
onClick={handleDownload}
223+
/>
224+
</>
225+
)}
226+
</div>
227+
)}
222228
</div>
223-
{props.isOwner && (
229+
{renderShareActions && (
224230
<div className={classNames('mobile-hide', styles.certActionBtns)}>
225231
<ActionButton
226232
className={styles.certActionBtn}
@@ -241,8 +247,19 @@ const HiringManagerView: FC<HiringManagerViewProps> = (props: HiringManagerViewP
241247
)
242248
}
243249

250+
useLayoutEffect(() => {
251+
const el: HTMLElement = wrapElRef.current
252+
if (!el || !props.isModalView) {
253+
return
254+
}
255+
256+
hideSiblings(el.parentElement as HTMLElement)
257+
hideSiblings(el.parentElement?.parentElement as HTMLElement)
258+
259+
})
260+
244261
return !!props.certification && !!props.userProfile ? (
245-
<div>
262+
<div className={props.isModalView ? styles.modalView : ''} ref={wrapElRef}>
246263
{renderHero()}
247264

248265
<ContentLayout
@@ -251,7 +268,7 @@ const HiringManagerView: FC<HiringManagerViewProps> = (props: HiringManagerViewP
251268
innerClass={styles.innerContentWrap}
252269
>
253270
<div className={styles.wrap}>
254-
{props.isOwner && (
271+
{renderShareActions && (
255272
<Button
256273
buttonStyle='primary'
257274
icon={IconOutline.ShareIcon}
@@ -278,24 +295,28 @@ const HiringManagerView: FC<HiringManagerViewProps> = (props: HiringManagerViewP
278295
expandCount={props.certification?.skills?.length ?? 0}
279296
/>
280297

281-
<Button
282-
buttonStyle='secondary'
283-
label={props.isOwner ? 'View your Topcoder profile' : 'View full Topcoder profile'}
284-
url={myProfileLink}
285-
target='_blank'
286-
className={styles.shareBtn}
287-
/>
298+
{!props.isModalView && (
299+
<Button
300+
buttonStyle='secondary'
301+
label={props.isOwner ? 'View your Topcoder profile' : 'View full Topcoder profile'}
302+
url={myProfileLink}
303+
target='_blank'
304+
className={styles.shareBtn}
305+
/>
306+
)}
288307
</div>
289308
</div>
290309

291310
{renderCoursesGridItems()}
292311

293-
<Button
294-
className={styles.detailsBtn}
295-
buttonStyle='link'
296-
label='Certification details'
297-
route={certificationDetailsLink}
298-
/>
312+
{!props.isModalView && (
313+
<Button
314+
className={styles.detailsBtn}
315+
buttonStyle='link'
316+
label='Certification details'
317+
route={certificationDetailsLink}
318+
/>
319+
)}
299320
</div>
300321
</ContentLayout>
301322
{shareModal.modal}

src-ts/tools/learn/tca-certificate/user-certification-view/UserCertificationViewBase.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
useRef,
88
useState,
99
} from 'react'
10+
import { useSearchParams } from 'react-router-dom'
1011

1112
import {
1213
getVerificationStatusAsync,
@@ -32,12 +33,14 @@ interface UserCertificationViewBaseProps {
3233
}
3334

3435
const UserCertificationViewBase: FC<UserCertificationViewBaseProps> = (props: UserCertificationViewBaseProps) => {
36+
const [queryParams]: [URLSearchParams, any] = useSearchParams()
3537

36-
// const routeParams: Params<string> = useParams()
3738
const tcaCertificationPath: string = getTCACertificationPath(`${props.certification?.dashedName}`)
3839
const certificateElRef: MutableRefObject<HTMLDivElement | any> = useRef()
3940
const isOwnProfile: boolean = !!props.profile?.email
4041

42+
const isModalView: boolean = queryParams.get('view-style') === 'modal'
43+
4144
const [isMemberVerified, setIsMemberVerified]: [boolean, Dispatch<SetStateAction<boolean>>]
4245
= useState<boolean>(false)
4346

@@ -82,6 +85,7 @@ const UserCertificationViewBase: FC<UserCertificationViewBaseProps> = (props: Us
8285
userName={props.enrollment.userName}
8386
isOwner={isOwnProfile}
8487
validationUrl={validationUrl}
88+
isModalView={isModalView}
8589
/>
8690
</div>
8791
)}

0 commit comments

Comments
 (0)