You've already forked AstralRinth
forked from didirus/AstralRinth
Add download stat on organization pages (#1581)
* Add download stat to organization page * Fix plural in projects stat
This commit is contained in:
@@ -86,13 +86,23 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="primary-stat no-margin">
|
<div class="primary-stat">
|
||||||
<BoxIcon class="primary-stat__icon" aria-hidden="true" />
|
<BoxIcon class="primary-stat__icon" aria-hidden="true" />
|
||||||
<div class="primary-stat__text">
|
<div class="primary-stat__text">
|
||||||
<span class="primary-stat__counter">
|
<span class="primary-stat__counter">
|
||||||
{{ $formatNumber(projects?.length || 0) }}
|
{{ $formatNumber(projects?.length || 0) }}
|
||||||
</span>
|
</span>
|
||||||
project<span v-if="organization.projects?.length !== 1">s</span>
|
project<span v-if="projects?.length !== 1">s</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="primary-stat no-margin">
|
||||||
|
<DownloadIcon class="primary-stat__icon" aria-hidden="true" />
|
||||||
|
<div class="primary-stat__text">
|
||||||
|
<span class="primary-stat__counter">
|
||||||
|
{{ formatCompactNumber(sumDownloads) }}
|
||||||
|
</span>
|
||||||
|
download<span v-if="sumDownloads !== 1">s</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -224,12 +234,15 @@ import UpToDate from '~/assets/images/illustrations/up_to_date.svg'
|
|||||||
import ProjectCard from '~/components/ui/ProjectCard.vue'
|
import ProjectCard from '~/components/ui/ProjectCard.vue'
|
||||||
|
|
||||||
import OrganizationIcon from '~/assets/images/utils/organization.svg'
|
import OrganizationIcon from '~/assets/images/utils/organization.svg'
|
||||||
|
import DownloadIcon from '~/assets/images/utils/download.svg'
|
||||||
import CrownIcon from '~/assets/images/utils/crown.svg'
|
import CrownIcon from '~/assets/images/utils/crown.svg'
|
||||||
import { acceptTeamInvite, removeTeamMember } from '~/helpers/teams.js'
|
import { acceptTeamInvite, removeTeamMember } from '~/helpers/teams.js'
|
||||||
|
|
||||||
const vintl = useVIntl()
|
const vintl = useVIntl()
|
||||||
const { formatMessage } = vintl
|
const { formatMessage } = vintl
|
||||||
|
|
||||||
|
const formatCompactNumber = useCompactNumber()
|
||||||
|
|
||||||
const auth = await useAuth()
|
const auth = await useAuth()
|
||||||
const user = await useUser()
|
const user = await useUser()
|
||||||
const cosmetics = useCosmetics()
|
const cosmetics = useCosmetics()
|
||||||
@@ -326,6 +339,15 @@ const projectTypes = computed(() => {
|
|||||||
|
|
||||||
return Object.keys(obj)
|
return Object.keys(obj)
|
||||||
})
|
})
|
||||||
|
const sumDownloads = computed(() => {
|
||||||
|
let sum = 0
|
||||||
|
|
||||||
|
for (const project of projects.value) {
|
||||||
|
sum += project.downloads
|
||||||
|
}
|
||||||
|
|
||||||
|
return sum
|
||||||
|
})
|
||||||
|
|
||||||
const patchIcon = async (icon) => {
|
const patchIcon = async (icon) => {
|
||||||
const ext = icon.name.split('.').pop()
|
const ext = icon.name.split('.').pop()
|
||||||
|
|||||||
Reference in New Issue
Block a user