Skip to content

Commit 63b8eb1

Browse files
GA16-24claude
andcommitted
fix(mobile): No project shows a dashed square instead of NP
The server gives the No project folder the Lucide icon message-square-dashed. Mobile does not bundle Lucide, so it drew the project's initials. Map that icon to the native square.dashed symbol (Tabler IconSquareDashed on Android), tinted in the icon's color. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 483abff commit 63b8eb1

3 files changed

Lines changed: 57 additions & 24 deletions

File tree

‎apps/mobile/src/components/AppSymbol.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ import IconSearch from "@tabler/icons-react-native/IconSearch";
9393
import IconServer from "@tabler/icons-react-native/IconServer";
9494
import IconSettings from "@tabler/icons-react-native/IconSettings";
9595
import IconSparkles from "@tabler/icons-react-native/IconSparkles";
96+
import IconSquareDashed from "@tabler/icons-react-native/IconSquareDashed";
9697
import IconStack2 from "@tabler/icons-react-native/IconStack2";
9798
import IconStar from "@tabler/icons-react-native/IconStar";
9899
import IconStarFilled from "@tabler/icons-react-native/IconStarFilled";
@@ -210,6 +211,7 @@ const ANDROID_ICON_BY_SF_SYMBOL = {
210211
"sidebar.right": IconLayoutSidebarRight,
211212
"slider.horizontal.3": IconAdjustmentsHorizontal,
212213
"square.and.pencil": IconEdit,
214+
"square.dashed": IconSquareDashed,
213215
"square.on.square": IconCopy,
214216
"square.grid.2x2": IconApps,
215217
"square.split.2x1": IconLayoutColumns,

‎apps/mobile/src/components/ProjectFavicon.tsx‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,17 @@ function ProjectIconGlyphView(props: { readonly glyph: ProjectIconGlyph; readonl
111111
}
112112

113113
const colors = projectIconColorClassNames(glyph.color);
114+
if (glyph.kind === "symbol") {
115+
return (
116+
<SymbolView
117+
name={glyph.name}
118+
size={size}
119+
tintColorClassName={colors.tint}
120+
type="monochrome"
121+
/>
122+
);
123+
}
124+
114125
return (
115126
<View
116127
className={colors.background}

‎apps/mobile/src/lib/projectIcon.ts‎

Lines changed: 44 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
import type { ProjectIconColor, ProjectIconOverride } from "@t3tools/contracts";
2+
import type { AppSymbolName } from "../components/AppSymbol";
23

34
export type ProjectIconGlyph =
45
| { readonly kind: "emoji"; readonly emoji: string }
5-
| { readonly kind: "monogram"; readonly text: string; readonly color: ProjectIconColor };
6+
| { readonly kind: "monogram"; readonly text: string; readonly color: ProjectIconColor }
7+
| { readonly kind: "symbol"; readonly name: AppSymbolName; readonly color: ProjectIconColor };
8+
9+
/** Native stand-ins for the Lucide icons the server assigns on its own. */
10+
const SYMBOL_BY_LUCIDE_NAME: Partial<Record<string, AppSymbolName>> = {
11+
// No project. Neither SF Symbols nor Tabler has a dashed chat bubble.
12+
"message-square-dashed": "square.dashed",
13+
};
614

715
/**
816
* Visible glyph count for sizing monogram text. Hermes has no Intl.Segmenter, so combining
@@ -33,8 +41,8 @@ export function projectMonogram(projectName: string): string {
3341

3442
/**
3543
* Picks what mobile draws for an assigned project icon. Mobile does not bundle
36-
* the Lucide set, so a Lucide override keeps its color and falls back to the
37-
* project's monogram instead of the folder glyph.
44+
* the Lucide set, so a Lucide override keeps its color and draws a native
45+
* stand-in when one exists, else the project's monogram instead of the folder glyph.
3846
*/
3947
export function resolveProjectIconGlyph(
4048
projectIcon: ProjectIconOverride | null | undefined,
@@ -45,35 +53,47 @@ export function resolveProjectIconGlyph(
4553
return { kind: "emoji", emoji: projectIcon.emoji };
4654
case "monogram":
4755
return { kind: "monogram", text: projectIcon.text, color: projectIcon.color };
48-
case "lucide":
49-
return { kind: "monogram", text: projectMonogram(projectTitle), color: projectIcon.color };
56+
case "lucide": {
57+
const symbol = SYMBOL_BY_LUCIDE_NAME[projectIcon.name];
58+
return symbol
59+
? { kind: "symbol", name: symbol, color: projectIcon.color }
60+
: { kind: "monogram", text: projectMonogram(projectTitle), color: projectIcon.color };
61+
}
5062
case undefined:
5163
return null;
5264
}
5365
}
5466

5567
const PROJECT_ICON_COLOR_CLASSES: Record<
5668
ProjectIconColor,
57-
{ readonly text: string; readonly background: string }
69+
{ readonly text: string; readonly tint: string; readonly background: string }
5870
> = {
59-
gray: { text: "text-gray-500", background: "bg-gray-500/15" },
60-
red: { text: "text-red-500", background: "bg-red-500/15" },
61-
orange: { text: "text-orange-500", background: "bg-orange-500/15" },
62-
amber: { text: "text-amber-500", background: "bg-amber-500/15" },
63-
yellow: { text: "text-yellow-500", background: "bg-yellow-500/15" },
64-
lime: { text: "text-lime-500", background: "bg-lime-500/15" },
65-
green: { text: "text-green-500", background: "bg-green-500/15" },
66-
emerald: { text: "text-emerald-500", background: "bg-emerald-500/15" },
67-
teal: { text: "text-teal-500", background: "bg-teal-500/15" },
68-
cyan: { text: "text-cyan-500", background: "bg-cyan-500/15" },
69-
sky: { text: "text-sky-500", background: "bg-sky-500/15" },
70-
blue: { text: "text-blue-500", background: "bg-blue-500/15" },
71-
indigo: { text: "text-indigo-500", background: "bg-indigo-500/15" },
72-
violet: { text: "text-violet-500", background: "bg-violet-500/15" },
73-
purple: { text: "text-purple-500", background: "bg-purple-500/15" },
74-
fuchsia: { text: "text-fuchsia-500", background: "bg-fuchsia-500/15" },
75-
pink: { text: "text-pink-500", background: "bg-pink-500/15" },
76-
rose: { text: "text-rose-500", background: "bg-rose-500/15" },
71+
gray: { text: "text-gray-500", tint: "accent-gray-500", background: "bg-gray-500/15" },
72+
red: { text: "text-red-500", tint: "accent-red-500", background: "bg-red-500/15" },
73+
orange: { text: "text-orange-500", tint: "accent-orange-500", background: "bg-orange-500/15" },
74+
amber: { text: "text-amber-500", tint: "accent-amber-500", background: "bg-amber-500/15" },
75+
yellow: { text: "text-yellow-500", tint: "accent-yellow-500", background: "bg-yellow-500/15" },
76+
lime: { text: "text-lime-500", tint: "accent-lime-500", background: "bg-lime-500/15" },
77+
green: { text: "text-green-500", tint: "accent-green-500", background: "bg-green-500/15" },
78+
emerald: {
79+
text: "text-emerald-500",
80+
tint: "accent-emerald-500",
81+
background: "bg-emerald-500/15",
82+
},
83+
teal: { text: "text-teal-500", tint: "accent-teal-500", background: "bg-teal-500/15" },
84+
cyan: { text: "text-cyan-500", tint: "accent-cyan-500", background: "bg-cyan-500/15" },
85+
sky: { text: "text-sky-500", tint: "accent-sky-500", background: "bg-sky-500/15" },
86+
blue: { text: "text-blue-500", tint: "accent-blue-500", background: "bg-blue-500/15" },
87+
indigo: { text: "text-indigo-500", tint: "accent-indigo-500", background: "bg-indigo-500/15" },
88+
violet: { text: "text-violet-500", tint: "accent-violet-500", background: "bg-violet-500/15" },
89+
purple: { text: "text-purple-500", tint: "accent-purple-500", background: "bg-purple-500/15" },
90+
fuchsia: {
91+
text: "text-fuchsia-500",
92+
tint: "accent-fuchsia-500",
93+
background: "bg-fuchsia-500/15",
94+
},
95+
pink: { text: "text-pink-500", tint: "accent-pink-500", background: "bg-pink-500/15" },
96+
rose: { text: "text-rose-500", tint: "accent-rose-500", background: "bg-rose-500/15" },
7797
};
7898

7999
export function projectIconColorClassNames(color: ProjectIconColor) {

0 commit comments

Comments
 (0)