Skip to content

Commit

Permalink
Merge branch 'feat/nomad-badges' into fix/revise-nomad-badges
Browse files Browse the repository at this point in the history
  • Loading branch information
wlliaml authored Dec 8, 2023
2 parents 7ae71ec + 133ca36 commit 63718ff
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lang/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,10 @@
"defaultMessage": "Number of readers",
"description": "src/components/ArticleDigest/Published/FooterActions/index.tsx"
},
"iIa+u8": {
"defaultMessage": "Badge Name",
"description": "src/views/User/UserProfile/BadgeNomadLabel/index.tsx"
},
"icdrwy": {
"defaultMessage": "Followed You",
"description": "src/components/Buttons/FollowUser/FollowState.tsx"
Expand Down
4 changes: 4 additions & 0 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,10 @@
"defaultMessage": "Number of readers",
"description": "src/components/ArticleDigest/Published/FooterActions/index.tsx"
},
"iIa+u8": {
"defaultMessage": "Badge Name",
"description": "src/views/User/UserProfile/BadgeNomadLabel/index.tsx"
},
"icdrwy": {
"defaultMessage": "Followed You",
"description": "src/components/Buttons/FollowUser/FollowState.tsx"
Expand Down
4 changes: 4 additions & 0 deletions lang/zh-Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,10 @@
"defaultMessage": "读者数量",
"description": "src/components/ArticleDigest/Published/FooterActions/index.tsx"
},
"iIa+u8": {
"defaultMessage": "徽章名称",
"description": "src/views/User/UserProfile/BadgeNomadLabel/index.tsx"
},
"icdrwy": {
"defaultMessage": "追踪了你",
"description": "src/components/Buttons/FollowUser/FollowState.tsx"
Expand Down
4 changes: 4 additions & 0 deletions lang/zh-Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,10 @@
"defaultMessage": "讀者數量",
"description": "src/components/ArticleDigest/Published/FooterActions/index.tsx"
},
"iIa+u8": {
"defaultMessage": "徽章名稱",
"description": "src/views/User/UserProfile/BadgeNomadLabel/index.tsx"
},
"icdrwy": {
"defaultMessage": "追蹤了你",
"description": "src/components/Buttons/FollowUser/FollowState.tsx"
Expand Down
3 changes: 3 additions & 0 deletions src/components/Dialog/Content/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface DialogContentProps {
noSpacing?: boolean
smExtraSpacing?: boolean
fixedHeight?: boolean
fixedHeightNoFooter?: boolean
noSpacingBottom?: boolean
noMaxHeight?: boolean
}
Expand All @@ -19,13 +20,15 @@ const DialogContent: React.FC<React.PropsWithChildren<DialogContentProps>> & {
noSpacingBottom,
noMaxHeight,
fixedHeight,
fixedHeightNoFooter,
children,
}) => {
const contentClasses = classNames({
[styles.content]: true,
[styles.spacing]: !noSpacing,
[styles.smExtraSpacing]: smExtraSpacing,
[styles.fixedHeight]: !!fixedHeight,
[styles.fixedHeightNoFooter]: !!fixedHeightNoFooter,
[styles.noSpacingBottom]: !!noSpacingBottom,
[styles.noMaxHeight]: !!noMaxHeight,
})
Expand Down
6 changes: 6 additions & 0 deletions src/components/Dialog/Content/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
}
}

&.fixedHeightNoFooter {
min-height: calc(
70vh - 4.25rem + 6.75rem
); /* 4.25rem is the height of header; 6.75rem is the Footer */
}

@media (--sm-up) {
max-height: min(30rem, 64vh);
}
Expand Down
5 changes: 5 additions & 0 deletions src/components/Icon/IconArrowAction.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { ReactComponent as Icon } from '@/public/static/icons/24px/arrow-action.svg'

import { withIcon } from './withIcon'

export const IconArrowAction = withIcon(Icon)
2 changes: 1 addition & 1 deletion src/views/User/UserProfile/AsideUserProfile/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import dynamic from 'next/dynamic'
import { useContext, useEffect } from 'react'
import { FormattedMessage } from 'react-intl'

import {
OPEN_SHOW_NOMAD_BADGE_DIALOG,
TEST_ID,
Expand All @@ -28,6 +27,7 @@ import {
ArchitectBadge,
CivicLikerBadge,
GoldenMotorBadge,
// NomadBadge,
SeedBadge,
TraveloggersBadge,
} from '../Badges'
Expand Down
1 change: 1 addition & 0 deletions src/views/User/UserProfile/BadgeNomadLabel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ export const BadgeNomadLabel: React.FC<BadgeNomadLabelProps> = ({
</>
)
}

13 changes: 13 additions & 0 deletions src/views/User/UserProfile/Badges/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ import { Tooltip, Translate, withIcon } from '~/components'
import { IconArrowAction24 } from '~/components/Icon/IconArrowAction24'
import { UserStatus } from '~/gql/graphql'

import { ReactComponent as IconArchitectBadge } from '@/public/static/icons/48px/badge-architect.svg'
import { ReactComponent as IconCivicLikerBadge } from '@/public/static/icons/48px/badge-civic-liker.svg'
import { ReactComponent as IconGoldenMotorBadge } from '@/public/static/icons/48px/badge-golden-motor.svg'
import { ReactComponent as IconNomad1Badge } from '@/public/static/icons/48px/badge-nomad1-moon.svg'
import { ReactComponent as IconNomad2Badge } from '@/public/static/icons/48px/badge-nomad2-star.svg'
import { ReactComponent as IconNomad3Badge } from '@/public/static/icons/48px/badge-nomad3-light.svg'
import { ReactComponent as IconNomad4Badge } from '@/public/static/icons/48px/badge-nomad4-fire.svg'
import { ReactComponent as IconSeedBadge } from '@/public/static/icons/48px/badge-seed.svg'
import { ReactComponent as IconTraveloggersBadge } from '@/public/static/icons/48px/badge-traveloggers.svg'
import { IconArrowAction, Tooltip, Translate, withIcon } from '~/components'
import { UserStatus } from '~/gql/graphql'

import { BadgeNomadDialog } from '../BadgeNomadLabel'
import styles from './styles.module.css'

type badgePros = {
Expand Down
6 changes: 6 additions & 0 deletions src/views/User/UserProfile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ export const UserProfile = () => {
})
}, [user?.id, viewer.id])

useEffect(() => {
if (showBadges) {
window.dispatchEvent(new CustomEvent(OPEN_SHOW_NOMAD_BADGE_DIALOG))
}
}, [showBadges])

/**
* Render
*/
Expand Down

0 comments on commit 63718ff

Please sign in to comment.