import { firstLetterUpperCase } from "~~/shared/utils/text"; export function useExplanations(projectType: Ref, stat: Ref) { const explanation = computed(() => { return getExplanations(projectType.value, stat.value); }); const title = computed(() => { return getTitle(projectType.value, stat.value); }); const description = computed(() => { return getDescription(projectType.value, stat.value); }); return { explanation, title, description }; } function getTitle(type: string, stat: string): string | undefined { function getDescriptionContext(s: string, t: string): string { const statLower = s.toLowerCase(); const typeLower = t.toLowerCase(); switch (statLower) { case "downloads": return `Analyze ${typeLower} downloads overtime`; case "versions": return `Analyze number of ${typeLower} versions overtime`; case "count": return `Analyze number of ${typeLower} projects overtime`; default: return `${typeLower} ${statLower} analytics`; } } switch (type.toLowerCase()) { case "mod": case "plugin": case "datapack": case "shader": case "resourcepack": case "modpack": return `Modrinth ${firstLetterUpperCase(type)} ${firstLetterUpperCase(stat)} - ${getDescriptionContext(stat, type)}`; case "projects": return `Modrinth Projects Statistics - Platform Analytics`; case "versions": return `Modrinth Versions Statistics - Platform Analytics`; case "authors": return `Modrinth Authors Statistics - Platform Analytics`; case "files": return `Modrinth Files Statistics - Platform Analytics`; case "revenue": return `Modrinth Revenue Statistics - Platform Analytics`; } } function getDescription(type: string, stat: string): string | undefined { function getDescriptionContext(s: string, t: string): string { const statLower = s.toLowerCase(); const typeLower = t.toLowerCase(); switch (statLower) { case "downloads": return `${typeLower} download trends and popularity across minecraft verions and modding loaders`; case "versions": return `${typeLower} versions uploaded to modrinth across minecraft verions and modding loaders`; case "count": return `the total number of unique ${typeLower} projects on all of modrinth across minecraft verions and modding loaders`; default: return `${typeLower} ${statLower} analytics`; } } switch (type.toLowerCase()) { case "mod": case "plugin": case "datapack": case "shader": case "resourcepack": case "modpack": return `Analyze ${getDescriptionContext(stat, type)}. Get deep insights into game version growth, loader distribution (Fabric/Forge/Quilt), and community adoption.`; case "projects": return `Analyze how the number of unique projects on Modrinth has changed over time.`; case "versions": return `Analyze how the number of versions uploaded to Modrinth has changed over time.`; case "authors": return `Analyze how the number of unique authors on Modrinth has changed over time.`; case "files": return `Analyze how the number of files uploaded to Modrinth has changed over time.`; case "revenue": return `Analyze how the revenue generated by Modrinth has changed over time. See how much money has generated and distributed to creators.`; } } function getExplanations(type: string, stat: string): string | undefined { switch (type.toLowerCase()) { case "mod": case "plugin": case "datapack": case "shader": case "resourcepack": case "modpack": return getProjectStatsExplanation(stat, type); case "projects": return `

Number of Projects across all ProjectTypes

This chart tracks the combined number of Mods, Plugins, Datapacks, Shaders, and Modpacks. It represents the overall scale of Modrinth and the amount of different content available to players.

`; case "versions": return `

Number of Versions across all ProjectTypes

This chart tracks the combined number of versions across Mods, Plugins, Datapacks, Shaders, and Modpacks. This metric highlights how active creators are in maintaining their content across all of Modrinth's supported project types.

`; case "authors": return `

Number of Authors on Modrinth

This tracks the number of unique developers and artists contributing to the platform. A growing author count indicates a healthy, expanding modding ecosystem.

`; case "files": return `

Number of Files hosted on Modrinth

The total count of individual files hosted on Modrinth. This reflects the massive amount of data managed by Modrinth.

`; case "revenue": return `

Revenue Generated by Modrinth in USD

Total revenue generated in USD. Modrinth operates on a creator-first model, where funds are split between platform maintenance and direct payouts to the developers who make the community possible.

`; } } function getProjectStatsExplanation(stat: string, type: string) { const typeUpper = firstLetterUpperCase(type); switch (stat.toLowerCase()) { case "versions": return `

${typeUpper} Versions Support by each Loader/Game-Version

This tracks how many individual versions support specific loaders (like Fabric, Forge, or Quilt). A single version supporting three loaders will count three times here to accurately reflect loader availability. This can cause a bias though multi-loader projects, as they may increase popularity of niche loaders (such as Quilt) due to their cross-platform nature.

`; case "count": return `

Number of ${typeUpper}s Supporting Each Loader/Game-Version

Unlike the versions metric, this tracks unique ${typeUpper}s. Even if a mod has 20 updates for Minecraft 1.20.1 or multiple versions within a version group, it is only counted once here to show the actual variety of projects available. A single mod supporting three loaders will count three times here to accurately reflect loader availability. This can cause a bias though multi-loader projects, as they may increase popularity of niche loaders (such as Quilt) due to their cross-platform nature.

`; case "downloads": return `

${typeUpper} Downloads per Loader/Game-Version

Analysis of downloads across different game versions and loaders. When a file supports multiple versions or loaders, downloads are split. This can cause a bias though multi-loader projects, as they may increase popularity of niche loaders (such as Quilt) due to their cross-platform nature.

`; } }