Skip to content

Commit 9dbeea8

Browse files
update share tweet text
1 parent 1bec912 commit 9dbeea8

2 files changed

Lines changed: 50 additions & 2 deletions

File tree

apps/cli/tsdown.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ export default defineConfig({
1212
env: {
1313
POSTHOG_API_KEY: "phc_8ZUxEwwfKMajJLvxz1daGd931dYbQrwKNficBmsdIrs",
1414
POSTHOG_HOST: "https://us.i.posthog.com",
15-
MODE: process.env.MODE || "dev",
15+
MODE: process.env.MODE || "dev", // wierd trick i know
1616
},
1717
});

apps/web/src/app/(home)/_components/stack-builder.tsx

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,8 +968,56 @@ const StackBuilder = () => {
968968
};
969969

970970
const shareToTwitter = () => {
971+
const getStackSummary = (): string => {
972+
const selectedTechs: string[] = [];
973+
974+
for (const category of CATEGORY_ORDER) {
975+
const categoryKey = category as keyof StackState;
976+
const options = TECH_OPTIONS[category as keyof typeof TECH_OPTIONS];
977+
const selectedValue = stack[categoryKey];
978+
979+
if (!options) continue;
980+
981+
if (Array.isArray(selectedValue)) {
982+
if (
983+
selectedValue.length === 0 ||
984+
(selectedValue.length === 1 && selectedValue[0] === "none")
985+
) {
986+
continue;
987+
}
988+
989+
for (const id of selectedValue) {
990+
if (id === "none") continue;
991+
const tech = options.find((opt) => opt.id === id);
992+
if (tech) {
993+
selectedTechs.push(tech.name);
994+
}
995+
}
996+
} else {
997+
const tech = options.find((opt) => opt.id === selectedValue);
998+
if (
999+
!tech ||
1000+
tech.id === "none" ||
1001+
tech.id === "false" ||
1002+
((category === "git" ||
1003+
category === "install" ||
1004+
category === "auth") &&
1005+
tech.id === "true")
1006+
) {
1007+
continue;
1008+
}
1009+
selectedTechs.push(tech.name);
1010+
}
1011+
}
1012+
1013+
return selectedTechs.length > 0
1014+
? selectedTechs.join(" • ")
1015+
: "Custom stack";
1016+
};
1017+
1018+
const stackSummary = getStackSummary();
9711019
const text = encodeURIComponent(
972-
"Check out this cool tech stack I configured with Create Better T Stack!\n\n",
1020+
`Check out this cool tech stack I configured with Create Better T Stack!\n\n🚀 ${stackSummary}\n\n`,
9731021
);
9741022
if (typeof window !== "undefined") {
9751023
const url = encodeURIComponent(window.location.href);

0 commit comments

Comments
 (0)