diff --git a/src/i18n/locales/en/views/compatibility.json b/src/i18n/locales/en/views/compatibility.json index 5ee40cb..49cdfc9 100644 --- a/src/i18n/locales/en/views/compatibility.json +++ b/src/i18n/locales/en/views/compatibility.json @@ -1,9 +1,12 @@ { - "title": "Compatibility", - "description": "Ryujinx sure can play a lot of games", + "title": "Play Anything", + "subtitle": "Compatibility", + "description": "Ryujinx can play thousands of games perfectly. From Breath of the Wild to Xenoblade, it just works, and the list is expanding all the time.", "playable": "Playable", "ingame": "In-Game", "menus": "Menus", "boots": "Boots", - "nothing": "Nothing" + "nothing": "Nothing", + "title2": "See the Full List", + "description2": "Browse the compatibility list on GitHub to see if your favourite game is supported." } \ No newline at end of file diff --git a/src/views/CompatibilityPage.vue b/src/views/CompatibilityPage.vue index 6a9acfb..1158af1 100644 --- a/src/views/CompatibilityPage.vue +++ b/src/views/CompatibilityPage.vue @@ -3,8 +3,9 @@ import { IssueSearch } from "@/types"; import axios from "axios"; import { onMounted, ref } from "vue"; import { useI18n } from "vue-i18n"; -import { Doughnut } from "vue-chartjs"; -import { Chart, ArcElement, Title, Legend, Tooltip, Colors, ChartData } from 'chart.js' +import { Bar } from "vue-chartjs"; +import { Chart, CategoryScale, LinearScale, BarElement, Title, Legend, Tooltip, Colors, ChartData } from 'chart.js' +import { ChartDataset } from "chart.js"; const { t } = useI18n(); const STATS_KEY = "git-stats"; @@ -79,15 +80,14 @@ function getWithExpiry(key: string): PlayableTier[] { return item.value } -function setData() { +function setData(this: any) { chartData.value = ({ - labels: tierData.value.flatMap((tier) => t(`views.compatibility.${tier.localeKey}`)), - datasets: [ - { - data: tierData.value.flatMap((tier) => tier.count), - backgroundColor: tierData.value.flatMap((tier) => tier.color), - } - ] + labels: ["label"], + datasets: tierData.value.map((tier: PlayableTier): ChartDataset<'bar', number[]> => ({ + data: [tier.count], + label: t(`views.compatibility.${tier.localeKey}`), + backgroundColor: tier.color + })).reverse(), }) } @@ -115,23 +115,25 @@ const fetchStats = async () => { } } -const chartData = ref>({ +const chartData = ref>({ + labels: [], datasets: [] -}) +}); const chartOptions = { + indexAxis: 'y' as const, + scales: { + x: { + stacked: true, + }, + y: { + display: false, + stacked: true + } + }, plugins: { legend: { - reverse: true, - labels: { - color: "black", - padding: 20, - usePointStyle: true, - font: { - family: "Inter", - size: 16 - } - } + display: false, }, tooltip: { usePointStyle: true, @@ -144,21 +146,11 @@ const chartOptions = { family: "Inter", size: 14 } - } - }, - onClick: (e: any, activeEls: any) => { - let datasetIndex = activeEls[0].datasetIndex; - let dataIndex = activeEls[0].index; - let value = e.chart.data.datasets[datasetIndex].data[dataIndex]; - var tier = tierData.value.find((tier) => tier.count == value); - - if (tier != null) { - window.location.href = import.meta.env.VITE_LABEL_URL + tier.labelName; - } + }, } -} +}; -Chart.register(ArcElement, Title, Legend, Tooltip, Colors); +Chart.register(CategoryScale, LinearScale, BarElement, Title, Legend, Tooltip, Colors); Tooltip.positioners.cursor = function(elements, eventPosition) { return { x: eventPosition.x, @@ -168,12 +160,31 @@ Tooltip.positioners.cursor = function(elements, eventPosition) { onMounted(() => { fetchStats(); -}); +}) + + + \ No newline at end of file