Skip to content

Commit 62c2918

Browse files
authored
Merge pull request #720 from topcoder-platform/profiles-app
Profiles app QA fixes -> dev
2 parents 14afb1b + d4dc01d commit 62c2918

File tree

15 files changed

+102
-29
lines changed

15 files changed

+102
-29
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"apexcharts": "^3.36.0",
3333
"axios": "^1.1.2",
3434
"browser-cookies": "^1.2.0",
35+
"city-timezones": "^1.2.1",
3536
"classnames": "^2.3.2",
3637
"contentful": "^9.2.5",
3738
"country-calling-code": "0.0.3",

src/apps/profiles/src/member-profile/links/MemberLinks.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
svg {
2525
width: 24px;
2626
height: 24px;
27+
28+
path {
29+
fill: #333333;
30+
}
2731
}
2832
}
2933
}

src/apps/profiles/src/member-profile/links/MemberLinks.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { useMemberTraits, UserProfile, UserTrait, UserTraitIds, UserTraits } fro
66
import {
77
IconOutline,
88
SocialIconFacebook,
9-
SocialIconInstagram,
10-
SocialIconLinkedIn,
119
SocialIconTwitter,
1210
SocialIconYoutube,
1311
} from '~/libs/ui'
@@ -16,6 +14,9 @@ import { EditMemberPropertyBtn } from '../../components'
1614
import { EDIT_MODE_QUERY_PARAM, profileEditModes } from '../../config'
1715

1816
import { ModifyMemberLinksModal } from './ModifyMemberLinksModal'
17+
import { ReactComponent as GitHubLinkIcon } from './assets/github-link-icon.svg'
18+
import { ReactComponent as InstagramLinkIcon } from './assets/instagram-link-icon.svg'
19+
import { ReactComponent as LinkedInLinkIcon } from './assets/linkedIn-link-icon.svg'
1920
import styles from './MemberLinks.module.scss'
2021

2122
interface MemberLinksProps {
@@ -27,12 +28,14 @@ export function renderLinkIcon(linkName: string): JSX.Element {
2728
switch (linkName) {
2829
case 'Facebook':
2930
return <SocialIconFacebook />
31+
case 'GitHub':
32+
return <GitHubLinkIcon />
3033
case 'Twitter':
3134
return <SocialIconTwitter />
3235
case 'LinkedIn':
33-
return <SocialIconLinkedIn />
36+
return <LinkedInLinkIcon />
3437
case 'Instagram':
35-
return <SocialIconInstagram />
38+
return <InstagramLinkIcon />
3639
case 'YouTube':
3740
return <SocialIconYoutube />
3841
default:

src/apps/profiles/src/member-profile/links/ModifyMemberLinksModal/link-types.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const linkTypes: Array<{[key: string]: string}> = [
33
name: 'Facebook',
44
},
55
{
6-
name: 'Twitter',
6+
name: 'GitHub',
77
},
88
{
99
name: 'Instagram',
@@ -12,9 +12,12 @@ export const linkTypes: Array<{[key: string]: string}> = [
1212
name: 'LinkedIn',
1313
},
1414
{
15-
name: 'YouTube',
15+
name: 'Twitter',
1616
},
1717
{
1818
name: 'Website',
1919
},
20+
{
21+
name: 'YouTube',
22+
},
2023
]
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 5 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading

src/apps/profiles/src/member-profile/local-info/MemberLocalInfo.tsx

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { FC } from 'react'
1+
import { FC, useMemo } from 'react'
2+
import cityTimezones from 'city-timezones'
23
import moment from 'moment-timezone'
34

45
import { useCountryName, UserProfile } from '~/libs/core'
@@ -12,22 +13,46 @@ interface MemberLocalInfoProps {
1213

1314
const MemberLocalInfo: FC<MemberLocalInfoProps> = (props: MemberLocalInfoProps) => {
1415

15-
const memberCountry: string | undefined = useCountryName(props.profile?.homeCountryCode)
16+
const memberCountry: string | undefined
17+
= useCountryName(props.profile?.homeCountryCode || props.profile?.competitionCountryCode)
18+
19+
const city: string | undefined = props.profile?.addresses?.[0]?.city
20+
21+
const memberCityTimezone: string | undefined = useMemo(() => {
22+
if (!city) {
23+
return undefined
24+
}
25+
26+
const cityTimezoneData: cityTimezones.CityData[] = cityTimezones.lookupViaCity(city)
27+
let memberTimezone: string | undefined
28+
29+
if (!cityTimezoneData?.length) {
30+
memberTimezone = `${memberCountry}/${city}`
31+
} else {
32+
memberTimezone = cityTimezoneData[0].timezone
33+
}
34+
35+
return moment.tz.zone(memberTimezone) ? memberTimezone : undefined
36+
}, [city, memberCountry])
1637

1738
return (
1839
<div className={styles.container}>
1940
<div className={styles.localInfo}>
2041
<IconSolid.LocationMarkerIcon />
21-
{memberCountry}
22-
</div>
23-
<div className={styles.localInfo}>
24-
<IconSolid.ClockIcon />
25-
Local time:
26-
{' '}
27-
{moment()
28-
.tz('America/New_York')
29-
.format('HH:MM')}
42+
{`${!!city ? `${city}, ` : ''}${memberCountry}`}
3043
</div>
44+
{
45+
!!memberCityTimezone && (
46+
<div className={styles.localInfo}>
47+
<IconSolid.ClockIcon />
48+
Local time:
49+
{' '}
50+
{moment()
51+
.tz(memberCityTimezone)
52+
.format('hh:mm')}
53+
</div>
54+
)
55+
}
3156
</div>
3257
)
3358
}

src/apps/profiles/src/member-profile/profile-header/OpenForGigsModifyModal/OpenForGigsModifyModal.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@ import { toast } from 'react-toastify'
33
import { reject } from 'lodash'
44

55
import { BaseModal, Button, FormToggleSwitch } from '~/libs/ui'
6-
import { updateMemberTraitsAsync, UserProfile, UserTrait, UserTraitCategoryNames, UserTraitIds } from '~/libs/core'
6+
import {
7+
createMemberTraitsAsync,
8+
updateMemberTraitsAsync,
9+
UserProfile,
10+
UserTrait,
11+
UserTraitCategoryNames,
12+
UserTraitIds,
13+
} from '~/libs/core'
714

815
import styles from './OpenForGigsModifyModal.module.scss'
916

@@ -15,6 +22,11 @@ interface OpenForGigsModifyModalProps {
1522
profile: UserProfile
1623
}
1724

25+
const methodsMap: { [key: string]: any } = {
26+
create: createMemberTraitsAsync,
27+
update: updateMemberTraitsAsync,
28+
}
29+
1830
const OpenForGigsModifyModal: FC<OpenForGigsModifyModalProps> = (props: OpenForGigsModifyModalProps) => {
1931
const [isSaving, setIsSaving]: [boolean, Dispatch<SetStateAction<boolean>>]
2032
= useState<boolean>(false)
@@ -32,7 +44,7 @@ const OpenForGigsModifyModal: FC<OpenForGigsModifyModalProps> = (props: OpenForG
3244
const updatedPersonalizationTraits: UserTrait[]
3345
= reject(props.memberPersonalizationTraitsFullData, (trait: UserTrait) => !!trait.availableForGigs)
3446

35-
updateMemberTraitsAsync(props.profile.handle, [{
47+
methodsMap[!!props.memberPersonalizationTraitsFullData ? 'update' : 'create'](props.profile.handle, [{
3648
categoryName: UserTraitCategoryNames.personalization,
3749
traitId: UserTraitIds.personalization,
3850
traits: {

src/apps/profiles/src/member-profile/profile-header/ProfileHeader.module.scss

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,16 @@
1414
position: absolute;
1515
right: 0;
1616
top: 0;
17-
color: $turq-120;
17+
color: $tc-white;
1818

1919
svg {
2020
width: 70px;
2121
height: 70px;
22+
fill: $turq-120;
23+
24+
path {
25+
fill: $turq-120;
26+
}
2227
}
2328
}
2429

0 commit comments

Comments
 (0)