Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
14 changes: 14 additions & 0 deletions packages/ui/src/components/user/UserPageHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@
:value="projectsCount"
:label="formatMessage(messages.profileProjectCountLabel, { count: projectsCount })"
/>
<PageHeaderMetadataNumberItem
:icon="HeartIcon"
:value="followers"
:label="formatMessage(messages.profileFollowerCountLabel, { count: followers })"
:tooltip="followersTooltip"
/>
<PageHeaderMetadataNumberItem
:icon="DownloadIcon"
:value="downloads"
Expand Down Expand Up @@ -110,6 +116,7 @@ import {
CurrencyIcon,
DownloadIcon,
EditIcon,
HeartIcon,
InfoIcon,
KeyIcon,
LockIcon,
Expand Down Expand Up @@ -191,6 +198,10 @@ const messages = defineMessages({
id: 'profile.label.download-count',
defaultMessage: '{count, plural, one {download} other {downloads}}',
},
profileFollowerCountLabel: {
id: 'profile.label.follower-count',
defaultMessage: '{count, plural, one {follower} other {followers}}',
},
removeAffiliateButton: {
id: 'profile.button.remove-affiliate',
defaultMessage: 'Remove as affiliate',
Expand Down Expand Up @@ -238,6 +249,7 @@ const props = withDefaults(
isBlocked?: boolean
projectsCount?: number
downloads?: number
followers?: number
}>(),
{
summary: null,
Expand All @@ -254,6 +266,7 @@ const props = withDefaults(
isBlocked: false,
projectsCount: 0,
downloads: 0,
followers: 0,
},
)

Expand Down Expand Up @@ -282,6 +295,7 @@ const formatDateTime = useFormatDateTime({
dateStyle: 'long',
})
const downloadsTooltip = computed(() => formatNumber(props.downloads))
const followersTooltip = computed(() => formatNumber(props.followers))
const joinedTooltip = computed(() => formatDateTime(props.user.created))

const moreActions = computed<ButtonMenuOption[]>(() => [
Expand Down
5 changes: 5 additions & 0 deletions packages/ui/src/layouts/shared/user-profile/layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@
:is-blocked="isBlocked"
:projects-count="projects.length"
:downloads="sumDownloads"
:followers="sumFollowers"
@manage-projects="openPath('/dashboard/projects')"
@report="reportProfile"
@block="handleBlockAction"
Expand Down Expand Up @@ -898,6 +899,10 @@ const navLinks = computed(() => {
const sumDownloads = computed(() =>
projects.value.reduce((total, project) => total + project.downloads, 0),
)

const sumFollowers = computed(() =>
projects.value.reduce((total, project) => total + project.followers, 0),
)
const profileHeaderSummary = computed(() => {
if (!user.value) return ''
if (user.value.bio) return user.value.bio
Expand Down
3 changes: 3 additions & 0 deletions packages/ui/src/locales/en-US/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -3425,6 +3425,9 @@
"profile.label.download-count": {
"defaultMessage": "{count, plural, one {download} other {downloads}}"
},
"profile.label.follower-count": {
"defaultMessage": "{count, plural, one {follower} other {followers}}"
},
"profile.label.joined": {
"defaultMessage": "Joined"
},
Expand Down
Loading