diff --git a/apps/cli/tsdown.config.ts b/apps/cli/tsdown.config.ts index 8aa34f9..a18adde 100644 --- a/apps/cli/tsdown.config.ts +++ b/apps/cli/tsdown.config.ts @@ -12,6 +12,6 @@ export default defineConfig({ env: { POSTHOG_API_KEY: "phc_8ZUxEwwfKMajJLvxz1daGd931dYbQrwKNficBmsdIrs", POSTHOG_HOST: "https://us.i.posthog.com", - MODE: process.env.MODE || "dev", + MODE: process.env.MODE || "dev", // wierd trick i know }, }); diff --git a/apps/web/src/app/(home)/_components/stack-builder.tsx b/apps/web/src/app/(home)/_components/stack-builder.tsx index 7968a20..d281bb3 100644 --- a/apps/web/src/app/(home)/_components/stack-builder.tsx +++ b/apps/web/src/app/(home)/_components/stack-builder.tsx @@ -968,8 +968,56 @@ const StackBuilder = () => { }; const shareToTwitter = () => { + const getStackSummary = (): string => { + const selectedTechs: string[] = []; + + for (const category of CATEGORY_ORDER) { + const categoryKey = category as keyof StackState; + const options = TECH_OPTIONS[category as keyof typeof TECH_OPTIONS]; + const selectedValue = stack[categoryKey]; + + if (!options) continue; + + if (Array.isArray(selectedValue)) { + if ( + selectedValue.length === 0 || + (selectedValue.length === 1 && selectedValue[0] === "none") + ) { + continue; + } + + for (const id of selectedValue) { + if (id === "none") continue; + const tech = options.find((opt) => opt.id === id); + if (tech) { + selectedTechs.push(tech.name); + } + } + } else { + const tech = options.find((opt) => opt.id === selectedValue); + if ( + !tech || + tech.id === "none" || + tech.id === "false" || + ((category === "git" || + category === "install" || + category === "auth") && + tech.id === "true") + ) { + continue; + } + selectedTechs.push(tech.name); + } + } + + return selectedTechs.length > 0 + ? selectedTechs.join(" • ") + : "Custom stack"; + }; + + const stackSummary = getStackSummary(); const text = encodeURIComponent( - "Check out this cool tech stack I configured with Create Better T Stack!\n\n", + `Check out this cool tech stack I configured with Create Better T Stack!\n\nšŸš€ ${stackSummary}\n\n`, ); if (typeof window !== "undefined") { const url = encodeURIComponent(window.location.href);