Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
0301f4a
feat: implement analytics route in api client
tdgao Apr 21, 2026
1db663b
remove: delete current analytics implementation
tdgao Apr 22, 2026
e09845b
feat: wire up shared analytics dashboard page
tdgao Apr 22, 2026
1c368d8
feat: initial implementation of analytics DI, query builder component…
tdgao Apr 22, 2026
661765d
feat: style consistency updates
tdgao Apr 22, 2026
5234270
feat: implement analytics chart
tdgao Apr 22, 2026
31f13a2
feat: improve query builder styles
tdgao Apr 22, 2026
e52d642
feat: add query to url params for query builder
tdgao Apr 22, 2026
97fde95
feat: implement analytics table and breakdown
tdgao Apr 23, 2026
5297b17
fix: date display to show time conditionally
tdgao Apr 23, 2026
fbc996b
fix: query builder disable group-by options if not relavant
tdgao Apr 23, 2026
6ce8be3
feat: style improvements
tdgao Apr 23, 2026
270e73f
remove: events toggle button for now since it does nothing
tdgao Apr 23, 2026
fd07f8e
fix: type error
tdgao Apr 23, 2026
8840a13
refactor: pnpm prepr
tdgao Apr 23, 2026
3daa527
feat: improve query builder styles and timeframes
tdgao Apr 23, 2026
b126bc4
feat: add table empty state
tdgao Apr 23, 2026
d5239bd
feat: implement disabled statcard for non-applicable ones
tdgao Apr 23, 2026
bfdb386
refactor: object destructure for context
tdgao Apr 23, 2026
f17b978
feat: filter server projects
tdgao Apr 24, 2026
ec723c7
feat: style improvements to project select
tdgao Apr 27, 2026
4231250
feat: separate out query filter component
tdgao Apr 27, 2026
34b392b
fix: type
tdgao Apr 27, 2026
43abf27
fix: triangle safe area for query filter sub menus
tdgao Apr 28, 2026
ff0968b
implement header slot for table
tdgao Apr 28, 2026
5cf6941
feat: implement multiselect input content slow
tdgao Apr 28, 2026
329cc3b
feat: use mutliselect for active filtered by options and use table he…
tdgao Apr 28, 2026
40d8007
Merge branch 'main' into truman/analytics
tdgao Apr 28, 2026
8694971
refactor: pnpm prepr
tdgao Apr 28, 2026
8c7e485
fix: broken lock file
tdgao Apr 28, 2026
34b736f
feat: implement adding project id analytics
tdgao Apr 28, 2026
df8aff2
feat: hide/show specific series in graph, formatted legend labels, lo…
tdgao Apr 28, 2026
849edf0
fix: queries not caching properly
tdgao Apr 28, 2026
53a04cf
feat: update columns widths
tdgao Apr 28, 2026
628712e
refactor: pnpm prepr
tdgao Apr 28, 2026
0cedf43
feat: add dropdown width and min dropdown width on combobox and multi…
tdgao Apr 29, 2026
0c99170
fix: QA Issues
tdgao Apr 29, 2026
c6a4749
feat: improve query filter menu styles and switch out of Menu
tdgao Apr 29, 2026
4414ea8
feat: implement better chart tooltip menu anchoring and dragging on m…
tdgao Apr 29, 2026
a0144f5
feat: small style improvements
tdgao Apr 29, 2026
2eee097
feat: improve query filter and how it commits changes
tdgao Apr 29, 2026
4b31e46
fix: remove projects from filters
tdgao Apr 29, 2026
05cd300
feat: update combobox active item to green
tdgao Apr 29, 2026
c8ad19c
fix: version_id breakdown incorrectly named
tdgao Apr 29, 2026
b3eea2c
feat: add anchored line to analytics chart and remove darkening points
tdgao Apr 29, 2026
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
1 change: 1 addition & 0 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"@vueuse/core": "^11.1.0",
"ace-builds": "^1.36.2",
"ansi-to-html": "^0.7.2",
"chart.js": "^4.5.1",
"dayjs": "^1.11.7",
"dompurify": "^3.1.7",
"floating-vue": "^5.2.2",
Expand Down
52 changes: 52 additions & 0 deletions apps/frontend/src/components/analytics/AnalyticsDashboard.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<template>
<div class="flex flex-col gap-4 pb-20 lg:pl-4 lg:pt-1.5">
<div class="flex flex-col gap-2">
<div class="flex justify-between">
<span class="text-xl font-semibold text-contrast md:text-2xl">Analytics</span>
<ButtonStyled type="outlined">
<button
type="button"
:disabled="!fetchRequest || isRefetching"
@click="refreshAnalyticsQuery"
>
<RefreshCwIcon :class="isRefetching ? 'animate-spin' : ''" />
Refresh
</button>
</ButtonStyled>
</div>
<QueryBuilder />
</div>
<StatCards />
<AnalyticsGraph />
<AnalyticsTable />
</div>
</template>

<script setup lang="ts">
import { ButtonStyled, injectProjectPageContext } from '@modrinth/ui'

import {
createAnalyticsDashboardContext,
provideAnalyticsDashboardContext,
} from '~/providers/analytics/analytics'
import { injectOrganizationContext } from '~/providers/organization-context'

import { RefreshCwIcon } from '@modrinth/assets'
import AnalyticsGraph from './graph/AnalyticsGraph.vue'
import QueryBuilder from './query-builder/QueryBuilder.vue'
import StatCards from './stat-cards/StatCards.vue'
import AnalyticsTable from './table/AnalyticsTable.vue'

const auth = await useAuth()
const projectPageContext = injectProjectPageContext(null)
const organizationContext = injectOrganizationContext(null)

const analyticsDashboardContext = createAnalyticsDashboardContext({
auth,
projectPageContext,
organizationContext,
})
const { fetchRequest, isRefetching, refreshAnalyticsQuery } = analyticsDashboardContext

provideAnalyticsDashboardContext(analyticsDashboardContext)
</script>
38 changes: 38 additions & 0 deletions apps/frontend/src/components/analytics/breakdown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import type { Labrinth } from '@modrinth/api-client'

import type { AnalyticsBreakdownPreset } from '~/providers/analytics/analytics'

export const ALL_BREAKDOWN_VALUE = 'All'

export function getAnalyticsBreakdownValue(
point: Labrinth.Analytics.v3.ProjectAnalytics,
selectedBreakdown: AnalyticsBreakdownPreset,
): string {
switch (selectedBreakdown) {
case 'none':
return ALL_BREAKDOWN_VALUE
case 'country':
return normalizeBreakdownValue('country' in point ? point.country : undefined)
case 'monetization': {
if ('monetized' in point && typeof point.monetized === 'boolean') {
return point.monetized ? 'monetized' : 'unmonetized'
}
return ALL_BREAKDOWN_VALUE
}
case 'download_source':
return normalizeBreakdownValue('domain' in point ? point.domain : undefined)
case 'version_id':
return normalizeBreakdownValue('version_id' in point ? point.version_id : undefined)
case 'loader':
return normalizeBreakdownValue('loader' in point ? point.loader : undefined)
case 'game_version':
return normalizeBreakdownValue('game_version' in point ? point.game_version : undefined)
default:
return ALL_BREAKDOWN_VALUE
}
}

function normalizeBreakdownValue(value: string | undefined): string {
const normalized = value?.trim()
return normalized && normalized.length > 0 ? normalized : ALL_BREAKDOWN_VALUE
}
Loading
Loading