fix analytics

This commit is contained in:
Aman Varshney
2025-06-04 01:44:41 +05:30
parent 4cea350602
commit b449e19e10

View File

@@ -175,7 +175,7 @@ const dbSetupConfig = {
color: "hsl(var(--chart-1))", color: "hsl(var(--chart-1))",
}, },
"prisma-postgres": { "prisma-postgres": {
label: "Prisma + PostgreSQL", label: "Prisma Postgres",
color: "hsl(var(--chart-2))", color: "hsl(var(--chart-2))",
}, },
"mongodb-atlas": { "mongodb-atlas": {
@@ -225,7 +225,7 @@ const frontendConfig = {
color: "hsl(var(--chart-3))", color: "hsl(var(--chart-3))",
}, },
next: { next: {
label: "Next.js", label: "Next",
color: "hsl(var(--chart-4))", color: "hsl(var(--chart-4))",
}, },
nuxt: { nuxt: {
@@ -233,11 +233,11 @@ const frontendConfig = {
color: "hsl(var(--chart-5))", color: "hsl(var(--chart-5))",
}, },
"native-nativewind": { "native-nativewind": {
label: "Native NativeWind", label: "Expo NativeWind",
color: "hsl(var(--chart-6))", color: "hsl(var(--chart-6))",
}, },
"native-unistyles": { "native-unistyles": {
label: "Native Unistyles", label: "Expo Unistyles",
color: "hsl(var(--chart-7))", color: "hsl(var(--chart-7))",
}, },
svelte: { svelte: {
@@ -301,7 +301,7 @@ const authConfig = {
const gitConfig = { const gitConfig = {
enabled: { enabled: {
label: "Git Initialized", label: "Git Init",
color: "hsl(var(--chart-1))", color: "hsl(var(--chart-1))",
}, },
disabled: { disabled: {
@@ -676,9 +676,21 @@ export default function AnalyticsPage() {
const getFrontendData = () => { const getFrontendData = () => {
const frontendCounts = data.reduce( const frontendCounts = data.reduce(
(acc, item) => { (acc, item) => {
const frontend = item.frontend0 || item.frontend1 || "none"; // Count frontend0 if it exists and is not empty
if (frontend && frontend !== "none") { if (
acc[frontend] = (acc[frontend] || 0) + 1; item.frontend0 &&
item.frontend0 !== "none" &&
item.frontend0 !== ""
) {
acc[item.frontend0] = (acc[item.frontend0] || 0) + 1;
}
// Count frontend1 if it exists and is not empty
if (
item.frontend1 &&
item.frontend1 !== "none" &&
item.frontend1 !== ""
) {
acc[item.frontend1] = (acc[item.frontend1] || 0) + 1;
} }
return acc; return acc;
}, },
@@ -950,9 +962,18 @@ export default function AnalyticsPage() {
const getPopularStackCombinations = () => { const getPopularStackCombinations = () => {
const comboCounts = data.reduce( const comboCounts = data.reduce(
(acc, item) => { (acc, item) => {
const frontend = item.frontend0 || item.frontend1 || "none"; const frontends = [item.frontend0, item.frontend1].filter(
(f) => f && f !== "none" && f !== "",
);
const backend = item.backend || "none"; const backend = item.backend || "none";
const combo = `${frontend} + ${backend}`;
// Build the combo string with all frontends + backend
const parts = [...frontends];
if (backend !== "none") {
parts.push(backend);
}
const combo = parts.length > 0 ? parts.join(" + ") : "none";
acc[combo] = (acc[combo] || 0) + 1; acc[combo] = (acc[combo] || 0) + 1;
return acc; return acc;
}, },