fix(web,mobile): muse code uses meta's official blue logo (#19562)
This commit is contained in:
1 parent
e47bfe4617
commit
348f217a85
5 files changed
+102
-13
No files matched your search
@@ -1,8 +1,8 @@
|
||||
import { Image } from "expo-image";
|
||||
import { Path, Svg } from "react-native-svg";
|
||||
import { Defs, LinearGradient, Path, Stop, Svg } from "react-native-svg";
|
||||
import { View } from "react-native";
|
||||
import { providerInstanceInitials } from "@t3tools/client-runtime/state/provider-instance-display";
|
||||
import { useState } from "react";
|
||||
import { useId, useState } from "react";
|
||||
import { resolveOfficialAcpRegistryIconUrl } from "@t3tools/contracts";
|
||||
import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
|
||||
import { AppText as Text } from "./AppText";
|
||||
@@ -66,6 +66,7 @@ function AcpRegistryProviderIcon(props: {
|
||||
export function ProviderIcon(props: ProviderIconProps) {
|
||||
const { themeAppearance } = useAppearancePreferences();
|
||||
const isDarkMode = themeAppearance === "dark";
|
||||
const gradientId = useId();
|
||||
const size = props.size ?? 16;
|
||||
const mono = isDarkMode ? "#e5e5e5" : "#171717";
|
||||
|
||||
@@ -99,12 +100,35 @@ export function ProviderIcon(props: ProviderIconProps) {
|
||||
isDarkMode ? fill.dark : fill.light;
|
||||
return (
|
||||
<Svg width={size} height={size} viewBox={packageIcon.viewBox} fill="none">
|
||||
{packageIcon.paths.map((path) => (
|
||||
<Defs>
|
||||
{packageIcon.paths.map((path, index) =>
|
||||
path.gradient ? (
|
||||
<LinearGradient
|
||||
key={path.d}
|
||||
id={`${gradientId}-${index}`}
|
||||
x1={path.gradient.x1}
|
||||
y1={path.gradient.y1}
|
||||
x2={path.gradient.x2}
|
||||
y2={path.gradient.y2}
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
{path.gradient.stops.map((stop) => (
|
||||
<Stop key={stop.offset} offset={stop.offset} stopColor={stop.color} />
|
||||
))}
|
||||
</LinearGradient>
|
||||
) : null,
|
||||
)}
|
||||
</Defs>
|
||||
{packageIcon.paths.map((path, index) => (
|
||||
<Path
|
||||
key={path.d}
|
||||
d={path.d}
|
||||
fillRule={path.fillRule}
|
||||
fill={themeFill(path.fill ?? packageIcon.fill)}
|
||||
fill={
|
||||
path.gradient
|
||||
? `url(#${gradientId}-${index})`
|
||||
: themeFill(path.fill ?? packageIcon.fill)
|
||||
}
|
||||
/>
|
||||
))}
|
||||
</Svg>
|
||||
|
||||
@@ -5649,7 +5649,8 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
|
||||
activeProviderIconClassName: cn(
|
||||
composerProviderState.modelPickerIconClassName,
|
||||
composerControlsCollapsed &&
|
||||
"fill-muted-foreground/70! text-muted-foreground/70! [&_path]:fill-muted-foreground/70! [&_rect]:fill-muted-foreground/70! [&_[data-icon-detail]]:fill-transparent!",
|
||||
// Package glyphs get opaque fills and one opacity, so overlapping paths don't band.
|
||||
"fill-muted-foreground/70! text-muted-foreground/70! [&_path]:fill-muted-foreground/70! [&_rect]:fill-muted-foreground/70! [&_[data-icon-detail]]:fill-transparent! [&[data-provider-package-icon]]:opacity-70 [&[data-provider-package-icon]_path:not([data-icon-detail])]:fill-muted-foreground!",
|
||||
),
|
||||
}
|
||||
: {})}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { CSSProperties, SVGProps } from "react";
|
||||
import { useId, type CSSProperties, type SVGProps } from "react";
|
||||
|
||||
import type { ProviderIcon } from "@t3tools/provider-core/client";
|
||||
|
||||
@@ -13,11 +13,14 @@ export function ProviderPackageIcon({
|
||||
className,
|
||||
...props
|
||||
}: { readonly icon: ProviderIcon } & SVGProps<SVGSVGElement>) {
|
||||
const gradientId = useId();
|
||||
return (
|
||||
<svg
|
||||
{...props}
|
||||
viewBox={icon.viewBox}
|
||||
fill="none"
|
||||
// Lets monochrome renderings dim the whole glyph once instead of each path.
|
||||
data-provider-package-icon
|
||||
className={cn("fill-(--icon-light) dark:fill-(--icon-dark)", className)}
|
||||
style={
|
||||
{
|
||||
@@ -26,11 +29,34 @@ export function ProviderPackageIcon({
|
||||
} as CSSProperties
|
||||
}
|
||||
>
|
||||
{icon.paths.map((path) => (
|
||||
{icon.paths.some((path) => path.gradient) ? (
|
||||
<defs>
|
||||
{icon.paths.map((path, index) =>
|
||||
path.gradient ? (
|
||||
<linearGradient
|
||||
key={path.d}
|
||||
id={`${gradientId}-${index}`}
|
||||
x1={path.gradient.x1}
|
||||
y1={path.gradient.y1}
|
||||
x2={path.gradient.x2}
|
||||
y2={path.gradient.y2}
|
||||
gradientUnits="userSpaceOnUse"
|
||||
>
|
||||
{path.gradient.stops.map((stop) => (
|
||||
<stop key={stop.offset} offset={stop.offset} stopColor={stop.color} />
|
||||
))}
|
||||
</linearGradient>
|
||||
) : null,
|
||||
)}
|
||||
</defs>
|
||||
) : null}
|
||||
{icon.paths.map((path, index) => (
|
||||
<path
|
||||
key={path.d}
|
||||
d={path.d}
|
||||
fillRule={path.fillRule}
|
||||
// An attribute, so monochrome renderings can still override it from CSS.
|
||||
fill={path.gradient ? `url(#${gradientId}-${index})` : undefined}
|
||||
// Monochrome renderings (the collapsed composer) clear these detail paths.
|
||||
data-icon-detail={path.fill ? true : undefined}
|
||||
className={path.fill ? "fill-(--path-light) dark:fill-(--path-dark)" : undefined}
|
||||
|
||||
@@ -33,8 +33,8 @@ export interface ProviderEnvironmentField {
|
||||
|
||||
/**
|
||||
* A provider glyph as plain data, so web and mobile can each draw it with
|
||||
* their own SVG renderer. Colors are per theme; a path without a fill uses
|
||||
* the icon's `fill`.
|
||||
* their own SVG renderer. Colors are per theme; a path without a fill or
|
||||
* gradient uses the icon's `fill`.
|
||||
*/
|
||||
export interface ProviderIcon {
|
||||
readonly viewBox: string;
|
||||
@@ -43,9 +43,19 @@ export interface ProviderIcon {
|
||||
readonly d: string;
|
||||
readonly fillRule?: "evenodd" | "nonzero";
|
||||
readonly fill?: { readonly light: string; readonly dark: string };
|
||||
/** A brand gradient, the same in both themes. Coordinates are in viewBox units. */
|
||||
readonly gradient?: ProviderIconGradient;
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface ProviderIconGradient {
|
||||
readonly x1: number;
|
||||
readonly y1: number;
|
||||
readonly x2: number;
|
||||
readonly y2: number;
|
||||
readonly stops: ReadonlyArray<{ readonly offset: number; readonly color: string }>;
|
||||
}
|
||||
|
||||
export interface ProviderClientDefinition {
|
||||
readonly driverKind: ProviderDriverKind;
|
||||
readonly label: string;
|
||||
|
||||
@@ -14,13 +14,41 @@ export const museClient = defineProviderClient({
|
||||
label: "Muse Code",
|
||||
settingsSchema: MuseSettings,
|
||||
badgeLabel: "Beta",
|
||||
// Meta's symbol (https://commons.wikimedia.org/wiki/File:Meta_Platforms_Inc._logo_(cropped).svg).
|
||||
icon: {
|
||||
viewBox: "0 0 150.4828 100",
|
||||
fill: { light: "#171717", dark: "#e5e5e5" },
|
||||
viewBox: "0 0 287.56 191",
|
||||
fill: { light: "#0081fb", dark: "#0081fb" },
|
||||
paths: [
|
||||
{
|
||||
d: "M107.9999847,0.0000013c-12.3391113,0-21.984787,9.2935991-30.7164001,21.0993118 C65.2847366,5.821527,55.2499847,0,43.2413788,0C18.7586193,0,0,31.8620682,0,65.5862122 C0,86.6896515,10.2095623,100,27.3103466,100c12.3080502,0,21.1600361-5.8025894,36.8965454-33.3103409 c0,0,6.5597382-11.5841255,11.0725021-19.563858c1.5813522,2.5531845,3.2431107,5.3001404,4.9964676,8.2535095 l7.379303,12.4137955C102.0298843,91.8478851,110.039032,100,124.5517273,100 c16.6595764,0,25.9310303-13.4923325,25.9310303-35.0344849 C150.4827576,29.6551723,131.301178,0.0000013,107.9999847,0.0000013z M52.2068977,59.2413788 c-12.7586212,20-17.1724167,24.4827576-24.2758656,24.4827576c-7.3103428,0-11.6551704-6.4178314-11.6551704-17.8620682 c0-24.4827576,12.2068977-49.5172424,26.7586231-49.5172424c7.880127,0,14.4653816,4.5510426,24.5522308,18.9913158 C58.0087967,50.0272293,52.2068977,59.2413788,52.2068977,59.2413788z M100.3597336,56.7235756L91.5367355,42.00877 c-2.3876724-3.8832092-4.6757278-7.451458-6.8838348-10.7230263 c7.951973-12.273531,14.5113449-18.3891907,22.3126144-18.3891907c16.2069016,0,29.1724243,23.8620682,29.1724243,53.1724091 c0,11.1724167-3.6593475,17.6551743-11.2413864,17.6551743 C117.6294937,83.7241364,114.1578674,78.924736,100.3597336,56.7235756z",
|
||||
fillRule: "evenodd",
|
||||
d: "m31.06,125.96c0,10.98 2.41,19.41 5.56,24.51 4.13,6.68 10.29,9.51 16.57,9.51 8.1,0 15.51-2.01 29.79-21.76 11.44-15.83 24.92-38.05 33.99-51.98l15.36-23.6c10.67-16.39 23.02-34.61 37.18-46.96 11.56-10.08 24.03-15.68 36.58-15.68 21.07,0 41.14,12.21 56.5,35.11 16.81,25.08 24.97,56.67 24.97,89.27 0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75l0-31.02c17.63,0 22.03-16.2 22.03-34.74 0-26.42-6.16-55.74-19.73-76.69-9.63-14.86-22.11-23.94-35.84-23.94-14.85,0-26.8,11.2-40.23,31.17-7.14,10.61-14.47,23.54-22.7,38.13l-9.06,16.05c-18.2,32.27-22.81,39.62-31.91,51.75-15.95,21.24-29.57,29.29-47.5,29.29-21.27,0-34.72-9.21-43.05-23.09-6.8-11.31-10.14-26.15-10.14-43.06z",
|
||||
},
|
||||
{
|
||||
d: "m24.49,37.3c14.24-21.95 34.79-37.3 58.36-37.3 13.65,0 27.22,4.04 41.39,15.61 15.5,12.65 32.02,33.48 52.63,67.81l7.39,12.32c17.84,29.72 27.99,45.01 33.93,52.22 7.64,9.26 12.99,12.02 19.94,12.02 17.63,0 22.03-16.2 22.03-34.74l27.4-.86c0,19.38-3.82,33.62-10.32,44.87-6.28,10.88-18.52,21.75-39.11,21.75-12.8,0-24.14-2.78-36.68-14.61-9.64-9.08-20.91-25.21-29.58-39.71l-25.79-43.08c-12.94-21.62-24.81-37.74-31.68-45.04-7.39-7.85-16.89-17.33-32.05-17.33-12.27,0-22.69,8.61-31.41,21.78z",
|
||||
gradient: {
|
||||
x1: 61,
|
||||
y1: 117,
|
||||
x2: 259,
|
||||
y2: 127,
|
||||
stops: [
|
||||
{ offset: 0, color: "#0064e1" },
|
||||
{ offset: 0.4, color: "#0064e1" },
|
||||
{ offset: 0.83, color: "#0073ee" },
|
||||
{ offset: 1, color: "#0082fb" },
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
d: "m82.35,31.23c-12.27,0-22.69,8.61-31.41,21.78-12.33,18.61-19.88,46.33-19.88,72.95 0,10.98 2.41,19.41 5.56,24.51l-26.48,17.44c-6.8-11.31-10.14-26.15-10.14-43.06 0-30.75 8.44-62.8 24.49-87.55 14.24-21.95 34.79-37.3 58.36-37.3z",
|
||||
gradient: {
|
||||
x1: 45,
|
||||
y1: 139,
|
||||
x2: 45,
|
||||
y2: 66,
|
||||
stops: [
|
||||
{ offset: 0, color: "#0082fb" },
|
||||
{ offset: 1, color: "#0064e0" },
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user