Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion apps/marketing/public/harnesses/openai_dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 66 additions & 3 deletions apps/mobile/src/components/ProjectFavicon.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { SymbolView } from "./AppSymbol";
import { AppText } from "./AppText";
import { Image } from "expo-image";
import { useLayoutEffect, useMemo, useState } from "react";
import { View } from "react-native";
import type { EnvironmentId } from "@t3tools/contracts";
import type { EnvironmentId, ProjectIconOverride } from "@t3tools/contracts";
import {
getProjectFaviconCacheKey,
getProjectFaviconResourceKey,
Expand All @@ -11,6 +12,12 @@ import {
import { useAtomValue } from "@effect/atom-react";
import { Atom } from "effect/unstable/reactivity";
import { projectFaviconUrlAtom } from "../state/assets";
import {
countGlyphs,
projectIconColorClassNames,
resolveProjectIconGlyph,
type ProjectIconGlyph,
} from "../lib/projectIcon";

import {
beginProjectFaviconRequest,
Expand All @@ -30,10 +37,12 @@ export function ProjectFavicon(props: {
readonly projectTitle: string;
readonly workspaceRoot?: string | null;
readonly faviconPath?: string | null;
readonly projectIcon?: ProjectIconOverride | null;
}) {
const size = props.size ?? 42;
const glyph = resolveProjectIconGlyph(props.projectIcon, props.projectTitle);
const faviconUrl = useAtomValue(
props.workspaceRoot == null
props.workspaceRoot == null || glyph !== null
? EMPTY_FAVICON_URL
: projectFaviconUrlAtom({
environmentId: props.environmentId,
Expand All @@ -51,6 +60,10 @@ export function ProjectFavicon(props: {
: getProjectFaviconCacheKey(props.environmentId, props.workspaceRoot, renderableFaviconUrl)
: null;

if (glyph !== null) {
return <ProjectIconGlyphView glyph={glyph} size={size} />;
}

return (
<ProjectFaviconImage
key={cacheKey}
Expand All @@ -63,6 +76,56 @@ export function ProjectFavicon(props: {
);
}

function ProjectIconGlyphView(props: { readonly glyph: ProjectIconGlyph; readonly size: number }) {
const { glyph, size } = props;
if (glyph.kind === "emoji") {
return (
<View style={{ width: size, height: size, alignItems: "center", justifyContent: "center" }}>
<AppText
allowFontScaling={false}
style={{
fontSize: size * 0.8,
lineHeight: size,
textAlign: "center",
includeFontPadding: false,
}}
>
{glyph.emoji}
</AppText>
</View>
);
}

const colors = projectIconColorClassNames(glyph.color);
return (
<View
className={colors.background}
style={{
width: size,
height: size,
borderRadius: size * 0.25,
alignItems: "center",
justifyContent: "center",
}}
>
<AppText
allowFontScaling={false}
numberOfLines={1}
className={`font-mono ${colors.text}`}
style={{
fontWeight: "700",
fontSize: size * (countGlyphs(glyph.text) === 1 ? 0.6 : 0.515625),
lineHeight: size,
textAlign: "center",
includeFontPadding: false,
}}
>
{glyph.text}
</AppText>
</View>
);
}

function ProjectFaviconImage(props: {
readonly cacheKey: string | null;
readonly faviconUrl: string | null;
Expand Down Expand Up @@ -105,7 +168,7 @@ function ProjectFaviconImage(props: {
{!showImage ? (
<SymbolView
name={{ ios: "folder.fill", android: props.open ? "folder_open" : "folder" }}
size={props.size * 0.78}
size={props.size}
tintColorClassName={"accent-icon-subtle"}
type="monochrome"
/>
Expand Down
6 changes: 4 additions & 2 deletions apps/mobile/src/components/ProviderIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,12 @@ export function ProviderIcon(props: ProviderIconProps) {

// codex (and unknown drivers)
return (
<Svg width={size} height={size} viewBox="0 0 256 260" fill="none">
<Svg width={size} height={size} viewBox="100 100 411 411" fill="none">
<Path
fill={mono}
d="M239.184 106.203a64.716 64.716 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.716 64.716 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.665 64.665 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.767 64.767 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483Zm-97.56 136.338a48.397 48.397 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.595 8.595 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601Zm-104.466-44.61a48.345 48.345 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.339 8.339 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803ZM23.549 85.38a48.499 48.499 0 0 1 25.58-21.333v61.39a8.288 8.288 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.819.819 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466 41.695-63.08-36.63L161.73 77.86a.819.819 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.544 8.544 0 0 0-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.716.716 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391v.205ZM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.595 8.595 0 0 0-4.246 7.367l-.051 72.697Zm11.868-25.58 28.138-16.217 28.188 16.218v32.434l-28.086 16.218-28.188-16.218-.052-32.434Z"
fillRule="evenodd"
clipRule="evenodd"
d="M252.794 108.802C289.191 99.0484 326.265 110.305 351.148 135.135C385.113 126.072 422.85 134.862 449.492 161.505C476.136 188.149 484.925 225.888 475.862 259.85V259.854C500.696 284.735 511.95 321.81 502.198 358.207C492.447 394.602 464.161 421.084 430.215 430.217C421.083 464.162 394.603 492.448 358.206 502.199C321.812 511.951 284.734 500.693 259.852 475.864C225.887 484.927 188.15 476.137 161.507 449.495C134.864 422.851 126.073 385.111 135.136 351.149C110.304 326.266 99.0496 289.192 108.801 252.795C118.552 216.4 146.84 189.918 180.784 180.785C189.917 146.841 216.396 118.553 252.794 108.802ZM374.292 407.145C374.292 411.271 372.092 415.086 368.517 417.148L283.723 466.102C302.487 480.585 327.555 486.459 352.217 479.852C386.997 470.532 410.068 439.312 410.555 405.006V317.717C410.555 315.08 409.125 312.621 406.843 311.303L374.292 292.509V407.145ZM251.868 415.897C248.296 417.959 243.893 417.959 240.317 415.897L155.526 366.942C152.366 390.436 159.811 415.08 177.866 433.136H177.863C203.325 458.594 241.896 462.962 271.85 446.232L347.449 402.586C349.735 401.268 351.148 398.8 351.148 396.163V358.579L251.868 415.897ZM368.602 220.628C366.319 219.309 363.474 219.318 361.191 220.637L328.641 239.431L427.921 296.749C431.496 298.811 433.697 302.627 433.697 306.752V404.661C455.622 395.654 473.244 376.881 479.851 352.218C489.169 317.442 473.668 281.85 444.201 264.274L368.602 220.628ZM177.303 206.34C155.377 215.348 137.756 234.122 131.148 258.783C121.832 293.561 137.331 329.153 166.799 346.727L242.398 390.373C244.68 391.692 247.525 391.684 249.807 390.366L282.357 371.572L183.078 314.253C179.504 312.189 177.303 308.375 177.303 304.251V206.34ZM259.849 279.145V331.858L305.5 358.213L351.15 331.858V279.145L305.5 252.789L259.849 279.145ZM327.276 144.9C308.512 130.418 283.445 124.543 258.782 131.15C224.002 140.471 200.931 171.691 200.445 205.995V293.286C200.445 295.923 201.875 298.381 204.158 299.7L236.707 318.493V203.856C236.707 199.731 238.909 195.916 242.483 193.853L327.276 144.9ZM433.137 177.867C407.675 152.407 369.103 148.038 339.149 164.769L263.55 208.415C261.265 209.734 259.852 212.202 259.852 214.838V252.423L359.132 195.105C362.703 193.041 367.108 193.041 370.682 195.105L455.473 244.06C458.635 220.567 451.189 195.922 433.135 177.867H433.137Z"
/>
</Svg>
);
Expand Down
1 change: 1 addition & 0 deletions apps/mobile/src/features/archive/ArchivedThreadsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ function ProjectGroupLabel(props: {
<ProjectFavicon
environmentId={props.project.environmentId}
faviconPath={props.project.faviconPath}
projectIcon={props.project.projectIcon}
projectTitle={props.project.title}
size={18}
workspaceRoot={props.project.workspaceRoot}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,10 @@ function ProjectOverviewContent(props: {
<View className="flex-row items-center gap-4 px-2">
<ProjectFavicon
environmentId={representative.environmentId}
projectTitle={displayName}
projectTitle={representative.title}
workspaceRoot={representative.workspaceRoot}
faviconPath={representative.faviconPath}
projectIcon={representative.projectIcon}
size={48}
/>
<View className="min-w-0 flex-1">
Expand Down
2 changes: 2 additions & 0 deletions apps/mobile/src/features/threads/NewTaskRouteScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
<ProjectFavicon
environmentId={scope.representative.environmentId}
faviconPath={scope.representative.faviconPath}
projectIcon={scope.representative.projectIcon}
size={24}
projectTitle={scope.title}
workspaceRoot={scope.representative.workspaceRoot}
Expand All @@ -357,6 +358,7 @@ export function NewTaskRouteScreen({ route }: StaticScreenProps<NewTaskRoutePara
<ProjectFavicon
environmentId={scope.representative.environmentId}
faviconPath={scope.representative.faviconPath}
projectIcon={scope.representative.projectIcon}
size={20}
projectTitle={scope.title}
workspaceRoot={scope.representative.workspaceRoot}
Expand Down
9 changes: 6 additions & 3 deletions apps/mobile/src/features/threads/thread-list-v2-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,9 @@ export const ThreadListV2PendingRow = memo(function ThreadListV2PendingRow(props
<ProjectFavicon
environmentId={pendingTask.environmentId}
faviconPath={props.project.faviconPath}
projectIcon={props.project.projectIcon}
size={15}
projectTitle={projectTitle}
projectTitle={props.project.title}
workspaceRoot={props.project.workspaceRoot}
/>
) : null}
Expand Down Expand Up @@ -890,8 +891,9 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
<ProjectFavicon
environmentId={thread.environmentId}
faviconPath={props.project.faviconPath}
projectIcon={props.project.projectIcon}
size={15}
projectTitle={props.projectTitle ?? props.project.title}
projectTitle={props.project.title}
workspaceRoot={props.project.workspaceRoot}
/>
) : null}
Expand Down Expand Up @@ -1124,8 +1126,9 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
<ProjectFavicon
environmentId={thread.environmentId}
faviconPath={props.project.faviconPath}
projectIcon={props.project.projectIcon}
size={15}
projectTitle={props.projectTitle ?? props.project.title}
projectTitle={props.project.title}
workspaceRoot={props.project.workspaceRoot}
/>
</View>
Expand Down
Loading
Loading