Skip to content

Commit cb4aa35

Browse files
authored
Merge pull request #504 from topcoder-platform/fix-scaling-hook
Fixes the cert scaling hook: use transformScale instead of zoom -> dev
2 parents 3be898e + 1712def commit cb4aa35

File tree

30 files changed

+240
-147
lines changed

30 files changed

+240
-147
lines changed

src-ts/tools/learn/certification-details/certificate-preview/CertificatePreview.module.scss

Lines changed: 0 additions & 5 deletions
This file was deleted.

src-ts/tools/learn/certification-details/certificate-preview/CertificatePreview.tsx

Lines changed: 0 additions & 61 deletions
This file was deleted.

src-ts/tools/learn/certification-details/certificate-preview/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src-ts/tools/learn/certification-details/certification-details-sidebar/CertificationDetailsSidebar.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
import { FC, ReactNode } from 'react'
22
import classNames from 'classnames'
33

4-
import { Button, IconOutline, IconSolid, Tooltip, UserProfile } from '../../../../lib'
4+
import { Button, IconOutline, IconSolid, Tooltip } from '../../../../lib'
55
import {
66
CompletionTimeRange,
77
LearnLevelIcon,
88
ProvidersLogoList,
99
StickySidebar,
10+
TCACertificatePreview,
1011
TCACertification,
1112
TCACertificationProgress,
1213
} from '../../learn-lib'
1314
import { EnrollCtaBtn } from '../enroll-cta-btn'
14-
import { CertificatePreview } from '../certificate-preview'
15-
import { getTCACertificateUrl } from '../../learn.routes'
15+
import { getTCACertificateUrl, getTCACertificationValidationUrl } from '../../learn.routes'
1616

1717
import styles from './CertificationDetailsSidebar.module.scss'
1818

1919
interface CertificationDetailsSidebarProps {
2020
certification: TCACertification
2121
enrolled: boolean
22-
profile?: UserProfile
2322
certProgress?: TCACertificationProgress
2423
}
2524

@@ -38,13 +37,18 @@ function renderTooltipContents(icon: ReactNode, text: Array<string>): ReactNode
3837
const CertificationDetailsSidebar: FC<CertificationDetailsSidebarProps> = (props: CertificationDetailsSidebarProps) => {
3938
const completed: boolean = !!props.certProgress?.completedAt
4039

40+
const validateLink: string
41+
= getTCACertificationValidationUrl(props.certProgress?.completionUuid as string ?? '')
42+
4143
return (
4244
<StickySidebar>
4345
<div className={styles['certificate-placeholder']}>
44-
<CertificatePreview
46+
<TCACertificatePreview
4547
certification={props.certification}
46-
profile={props.profile}
47-
completedDate={props.certProgress?.completedAt ?? undefined}
48+
userName={props.certProgress?.userName}
49+
tcHandle={props.certProgress?.userHandle}
50+
completedDate={props.certProgress?.completedAt as unknown as string ?? ''}
51+
validateLink={validateLink}
4852
/>
4953
</div>
5054
{completed && props.certification && (

src-ts/tools/learn/course-certificate/certificate-view/CertificateView.module.scss

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,41 @@
4545

4646
.certificate-wrap {
4747
aspect-ratio: 1.25715;
48+
width: 100%;
49+
max-width: 880px;
50+
position: relative;
51+
52+
&:global(.large-container) {
53+
aspect-ratio: unset;
54+
@include socialPreviewImg;
55+
max-width: none;
56+
}
57+
58+
body:global(.canvas-clone) & {
59+
transform: none!important;
60+
}
61+
}
62+
63+
.certifInnerWrap {
64+
position: absolute;
65+
top: 0;
66+
left: 0;
4867
width: 880px;
68+
aspect-ratio: inherit;
4969

5070
background: #fff;
51-
5271
box-shadow: 0 20px 36px rgba($tc-black, 0.22);
5372

54-
&:global(.large-container) {
55-
aspect-ratio: unset;
56-
@include socialPreviewImg;
73+
> * {
74+
position: absolute;
75+
top: 0;
76+
left: 0;
77+
width: 100%;
78+
}
79+
80+
.certificate-wrap:global(.large-container) & {
81+
width: 100%;
82+
height: 100%;
5783
}
5884
}
5985

src-ts/tools/learn/course-certificate/certificate-view/CertificateView.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ const CertificateView: FC<CertificateViewProps> = (props: CertificateViewProps)
9797
ready && hasCompletedTheCertification
9898
), [hasCompletedTheCertification, ready])
9999

100-
useCertificateScaling(ready ? certificateWrapRef : undefined)
100+
useCertificateScaling(ready ? certificateWrapRef : undefined, 880, 880)
101101

102102
const handleBackBtnClick: () => void = useCallback(() => {
103103
navigate(coursePath)
@@ -141,16 +141,18 @@ const CertificateView: FC<CertificateViewProps> = (props: CertificateViewProps)
141141
className={classNames(styles['certificate-wrap'], props.viewStyle)}
142142
ref={certificateWrapRef}
143143
>
144-
<Certificate
145-
course={course?.title}
146-
userName={userName}
147-
tcHandle={props.profile.handle}
148-
provider={course?.resourceProvider.name}
149-
completedDate={completedCertificate?.completedDate ?? ''}
150-
elRef={certificateElRef}
151-
type={certificate?.certificationCategory.track}
152-
viewStyle={props.viewStyle}
153-
/>
144+
<div className={styles.certifInnerWrap}>
145+
<Certificate
146+
course={course?.title}
147+
userName={userName}
148+
tcHandle={props.profile.handle}
149+
provider={course?.resourceProvider.name}
150+
completedDate={completedCertificate?.completedDate ?? ''}
151+
elRef={certificateElRef}
152+
type={certificate?.certificationCategory.track}
153+
viewStyle={props.viewStyle}
154+
/>
155+
</div>
154156
</div>
155157
{!props.hideActions && (
156158
<div className={styles['btns-wrap']}>

src-ts/tools/learn/course-certificate/certificate-view/certificate/Certificate.module.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,14 @@
137137

138138
svg {
139139
width: auto;
140-
height: 100%;
141140
}
142141
}
143142

144143
.divider {
145144
width: $border;
146145
background: $black-10;
147-
margin: 0 $space-xxxxl;
146+
margin: 0 $space-lg;
147+
flex: 0 0 auto;
148148
}
149149

150150
.vendor {

src-ts/tools/learn/course-certificate/certificate-view/certificate/Certificate.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { FC, MutableRefObject } from 'react'
22
import classNames from 'classnames'
33

44
import { LearnConfig } from '../../../learn-config'
5-
import { LearnCertificateTrackType, TcLogoSvg } from '../../../learn-lib'
6-
import { FccLogoSvg, TcAcademyLogoSvg } from '../../../../../lib'
5+
import { LearnCertificateTrackType } from '../../../learn-lib'
6+
import { FccLogoSvg, TcAcademyLogoSvg, TcLogoSvg } from '../../../../../lib'
77

88
import { CertificateBgPattern } from './certificate-bg-pattern'
99
import { CourseCard } from './course-card'
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1+
import { LearnModelBase } from '../../../functions'
12
import { TCACertification } from '../tca-certification.model'
23

34
import { TCAFccCertificationProgress } from './tca-fcc-certification-progress.model'
45

56
export type TCACertificationProgressStatus = 'enrolled' | 'completed'
67

7-
export interface TCACertificationProgress {
8+
export interface TCACertificationProgress extends LearnModelBase {
89
id: number
10+
completionUuid: string
11+
coursesCount: number
912
topcoderCertification: TCACertification
10-
topcoderCertificationId: number
1113
status: TCACertificationProgressStatus
1214
completedAt: null | Date
13-
createdAt: Date
14-
updatedAt: Date
15-
certificationProgress: 0
15+
certificationProgress: number
1616
resourceProgresses: [{
1717
fccCertificationProgress: TCAFccCertificationProgress
1818
}]
19+
userHandle: string
20+
userId: number
21+
userName: string
1922
}

src-ts/tools/learn/learn-lib/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
export * from './action-button'
22
export * from './collapsible-pane'
3+
export * from './completion-time-range'
34
export * from './course-badge'
45
export * from './course-outline'
56
export * from './course-title'
6-
export * from './completion-time-range'
77
export * from './curriculum-summary'
88
export * from './data-providers'
99
export * from './dynamic-icons'
1010
export * from './learn-breadcrumb-provider'
1111
export * from './learn-swr'
1212
export * from './providers-logo-list'
13-
export * from './skill'
1413
export * from './skill-tags'
14+
export * from './skill'
1515
export * from './sticky-sidebar'
1616
export * from './svgs'
17+
export * from './tca-certificate-preview'
1718
export * from './use-certificate-canvas-hook'
1819
export * from './use-certificate-print-hook'
1920
export * from './use-certificate-scaling-hook'

0 commit comments

Comments
 (0)