Skip to content
TypeScript

fix(web): make project icons the default (#9457)

maria4e89d74436a1
diff --git a/apps/web/src/components/ProjectFavicon.test.tsx b/apps/web/src/components/ProjectFavicon.test.tsx
index 557f4d722ad..bfb5487031b 100644
--- a/apps/web/src/components/ProjectFavicon.test.tsx
+++ b/apps/web/src/components/ProjectFavicon.test.tsx
@@ -115,28 +115,40 @@ describe("ProjectFavicon", () => {
testState.faviconUrl = "https://environment.test/api/assets/token-a/v1-20-favicon.svg";
});
- it("shows a project-name emoji when no favicon exists", () => {
+ it("shows a project-name icon when no favicon exists", () => {
testState.faviconUrl = `https://environment.test/api/assets/token/${PROJECT_FAVICON_FALLBACK_MARKER}`;
const element = ProjectFavicon({
environmentId: "environment-test" as EnvironmentId,
cwd: "/workspace/analytics-db",
projectName: "analytics-db",
- }) as ReactElement<{ readonly emoji?: string }>;
+ }) as ReactElement<{
+ readonly colorClassName?: string;
+ readonly emoji?: string;
+ readonly icon?: ComponentType<{ className?: string }>;
+ }>;
- expect(element.props.emoji).toBe("๐Ÿ—„๏ธ");
+ expect(element.props.icon).toBeDefined();
+ expect(element.props.emoji).toBeUndefined();
+ expect(element.props.colorClassName).toContain("text-cyan-600");
});
- it("chooses a deterministic semantic emoji", () => {
+ it("chooses a deterministic semantic icon", () => {
testState.faviconUrl = `https://environment.test/api/assets/token/${PROJECT_FAVICON_FALLBACK_MARKER}`;
const element = ProjectFavicon({
environmentId: "environment-test" as EnvironmentId,
cwd: "/workspace/agent-runtime",
projectName: "agent-runtime",
- }) as ReactElement<{ readonly emoji?: string }>;
+ }) as ReactElement<{
+ readonly colorClassName?: string;
+ readonly emoji?: string;
+ readonly icon?: ComponentType<{ className?: string }>;
+ }>;
- expect(element.props.emoji).toBe("๐Ÿค–");
+ expect(element.props.icon).toBeDefined();
+ expect(element.props.emoji).toBeUndefined();
+ expect(element.props.colorClassName).toContain("text-violet-600");
});
it("renders a saved Lucide icon and color ahead of an uploaded favicon", () => {
diff --git a/apps/web/src/components/settings/ProjectIconPickerDialog.test.tsx b/apps/web/src/components/settings/ProjectIconPickerDialog.test.tsx
index 9098b359d1e..2280395ecf4 100644
--- a/apps/web/src/components/settings/ProjectIconPickerDialog.test.tsx
+++ b/apps/web/src/components/settings/ProjectIconPickerDialog.test.tsx
@@ -39,13 +39,13 @@ vi.mock("../ui/toggle-group", () => ({
import { ProjectIconPickerDialog } from "./ProjectIconPickerDialog";
describe("ProjectIconPickerDialog", () => {
- it("shows emoji first and selects it for an automatic project", () => {
+ it("shows icons first and selects them for an automatic project", () => {
const markup = renderToStaticMarkup(
<ProjectIconPickerDialog current={null} open onOpenChange={() => {}} onSelect={() => {}} />,
);
- expect(markup).toContain('data-current="emoji"');
- expect(markup.indexOf(">Emoji<")).toBeLessThan(markup.indexOf(">Icons<"));
- expect(markup).toContain("Or paste any emoji");
+ expect(markup).toContain('data-current="lucide"');
+ expect(markup.indexOf(">Icons<")).toBeLessThan(markup.indexOf(">Emoji<"));
+ expect(markup).toContain('aria-label="Icon color"');
});
});
diff --git a/apps/web/src/components/settings/ProjectIconPickerDialog.tsx b/apps/web/src/components/settings/ProjectIconPickerDialog.tsx
index 4ecdb0f653c..7fce7a4fbb5 100644
--- a/apps/web/src/components/settings/ProjectIconPickerDialog.tsx
+++ b/apps/web/src/components/settings/ProjectIconPickerDialog.tsx
@@ -45,7 +45,7 @@ export function ProjectIconPickerDialog({
readonly onSelect: (icon: ProjectIconOverride) => void;
}) {
const [mode, setMode] = useState<"lucide" | "emoji">(
- current?.kind === "lucide" ? "lucide" : "emoji",
+ current?.kind === "emoji" ? "emoji" : "lucide",
);
const [iconName, setIconName] = useState<IconName>(
current?.kind === "lucide" ? (current.name as IconName) : DEFAULT_ICON,
@@ -60,7 +60,7 @@ export function ProjectIconPickerDialog({
useEffect(() => {
if (open && !previousOpenRef.current) {
- setMode(current?.kind === "lucide" ? "lucide" : "emoji");
+ setMode(current?.kind === "emoji" ? "emoji" : "lucide");
setIconName(current?.kind === "lucide" ? (current.name as IconName) : DEFAULT_ICON);
setColor(current?.kind === "lucide" ? current.color : DEFAULT_COLOR);
setEmoji(current?.kind === "emoji" ? current.emoji : "๐Ÿ’ป");
@@ -84,7 +84,7 @@ export function ProjectIconPickerDialog({
<DialogPopup className="w-full sm:w-[32rem]">
<DialogHeader>
<DialogTitle>Choose project icon</DialogTitle>
- <DialogDescription>Pick an emoji, or choose any Lucide icon and color.</DialogDescription>
+ <DialogDescription>Pick any Lucide icon and color, or use an emoji.</DialogDescription>
</DialogHeader>
<DialogPanel className="flex min-h-0 flex-col gap-4">
<ToggleGroup
@@ -96,8 +96,8 @@ export function ProjectIconPickerDialog({
if (value === "lucide" || value === "emoji") setMode(value);
}}
>
- <Toggle value="emoji">Emoji</Toggle>
<Toggle value="lucide">Icons</Toggle>
+ <Toggle value="emoji">Emoji</Toggle>
</ToggleGroup>
{mode === "lucide" ? (
diff --git a/apps/web/src/projectIconModel.test.ts b/apps/web/src/projectIconModel.test.ts
index a2d6842d969..77e0ca2acb1 100644
--- a/apps/web/src/projectIconModel.test.ts
+++ b/apps/web/src/projectIconModel.test.ts
@@ -19,18 +19,17 @@ describe("selectProjectIcon", () => {
expect(selectProjectIcon("", "C:\\work\\mobile-app").icon).toBe("mobile");
});
- it("uses emoji for automatic project icons", () => {
+ it("uses Lucide icons for automatic project icons", () => {
expect(selectProjectIcon("agent-runtime", "/workspace/agent-runtime")).toEqual({
- kind: "emoji",
+ kind: "lucide",
icon: "ai",
- emoji: "๐Ÿค–",
});
});
it("gives unknown names a stable generic icon", () => {
const icon = selectProjectIcon("mercury", "/workspace/mercury");
- expect(icon.kind).toBe("emoji");
+ expect(icon.kind).toBe("lucide");
expect(PROJECT_ICON_NAMES).toContain(icon.icon);
expect(selectProjectIcon("mercury", "/elsewhere/mercury")).toEqual(icon);
});
diff --git a/apps/web/src/projectIconModel.ts b/apps/web/src/projectIconModel.ts
index 6f32e638101..8614ff2a41f 100644
--- a/apps/web/src/projectIconModel.ts
+++ b/apps/web/src/projectIconModel.ts
@@ -131,31 +131,6 @@ const GENERIC_PROJECT_ICONS: ReadonlyArray<ProjectIconName> = [
"layers",
];
-const PROJECT_ICON_EMOJIS: Record<ProjectIconName, string> = {
- ai: "๐Ÿค–",
- book: "๐Ÿ“š",
- braces: "๐Ÿงฉ",
- circuit: "โšก",
- cloud: "โ˜๏ธ",
- code: "๐Ÿ’ป",
- database: "๐Ÿ—„๏ธ",
- desktop: "๐Ÿ–ฅ๏ธ",
- "folder-code": "๐Ÿ› ๏ธ",
- game: "๐ŸŽฎ",
- image: "๐Ÿ–ผ๏ธ",
- layers: "โœจ",
- mobile: "๐Ÿ“ฑ",
- music: "๐ŸŽต",
- package: "๐Ÿ“ฆ",
- security: "๐Ÿ”’",
- server: "โš™๏ธ",
- shopping: "๐Ÿ›๏ธ",
- terminal: "โŒจ๏ธ",
- test: "๐Ÿงช",
- video: "๐ŸŽฌ",
- web: "๐ŸŒ",
-};
-
const projectIconCache = new Map<string, ProjectIconSelection>();
function projectNameTokens(value: string): ReadonlyArray<string> {
@@ -211,11 +186,7 @@ export function selectProjectIcon(
const iconName =
bestIcon ?? GENERIC_PROJECT_ICONS[stableIndex(cacheKey, GENERIC_PROJECT_ICONS.length)]!;
- const icon: ProjectIconSelection = {
- kind: "emoji",
- icon: iconName,
- emoji: PROJECT_ICON_EMOJIS[iconName],
- };
+ const icon: ProjectIconSelection = { kind: "lucide", icon: iconName };
projectIconCache.set(cacheKey, icon);
return icon;
}
diff --git a/docs/user/project-settings.md b/docs/user/project-settings.md
index 047f8baf546..ef15a041c13 100644
--- a/docs/user/project-settings.md
+++ b/docs/user/project-settings.md
@@ -2,7 +2,7 @@
T3 Code selects a project icon automatically. It checks `t3.json`, common favicon and app icon
paths, and icon links in project HTML files. If it does not find an image, it chooses a built-in
-emoji from the project name.
+icon from the project name.
To choose a different icon or emoji: