feat(webui): unify the Apps catalog (#6700)
* feat(webui): unify the Apps catalog * fix(webui): serve all channel branding locally * fix(webui): refine Apps navigation and sidebar
This commit is contained in:
1 parent
5997a714f2
commit
2b232c9133
89 files changed
+1576
-1024
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import i18n from "i18next";
|
||||
import { useMemo, type ReactNode } from "react";
|
||||
import type { ReactNode } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import {
|
||||
@@ -19,7 +19,6 @@ import type {
|
||||
import { channelValidationMessage } from "@/components/settings/channels/validationMessages";
|
||||
import { useLogoFallback } from "@/hooks/useLogoFallback";
|
||||
import { normalizeLocale } from "@/i18n/config";
|
||||
import { logoFallbackUrls } from "@/lib/provider-brand";
|
||||
import type { ChannelRuntimeStatus, NanobotFeatureInfo } from "@/lib/types";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
@@ -154,23 +153,17 @@ export function ChannelLogo({
|
||||
?? channelUiPresentation(feature.name);
|
||||
const initials = presentation?.initials ?? feature.display_name.slice(0, 2).toUpperCase();
|
||||
const Icon = presentation?.icon;
|
||||
const logoUrls = useMemo(() => {
|
||||
const fallbackUrls = logoFallbackUrls(presentation?.logoFallbackUrl ?? presentation?.logoUrl);
|
||||
return presentation?.logoUrl && presentation.logoFallbackUrl
|
||||
? [...new Set([presentation.logoUrl, ...fallbackUrls])]
|
||||
: fallbackUrls;
|
||||
}, [presentation?.logoUrl, presentation?.logoFallbackUrl]);
|
||||
const { logoUrl, logoLoaded, onLogoError, onLogoLoad } = useLogoFallback(logoUrls);
|
||||
const showRemoteLogo = showBrandLogos && Boolean(logoUrl);
|
||||
const showLoadedLogo = showRemoteLogo && logoLoaded;
|
||||
const isLogoTile = presentation?.logoLayout === "tile" && logoUrl === presentation.logoUrl;
|
||||
const brandLogoUrl = presentation?.logoUrl;
|
||||
const { logoUrl, logoLoaded, onLogoError, onLogoLoad } = useLogoFallback(brandLogoUrl ? [brandLogoUrl] : undefined);
|
||||
const showLogo = showBrandLogos && Boolean(logoUrl);
|
||||
const showLoadedLogo = showLogo && logoLoaded;
|
||||
|
||||
return (
|
||||
<span
|
||||
data-testid={`channel-logo-${feature.name}`}
|
||||
className={cn(
|
||||
"relative grid h-8 w-8 shrink-0 place-items-center overflow-hidden rounded-[9px] text-[11px] font-semibold text-muted-foreground",
|
||||
showLoadedLogo ? (isLogoTile ? "bg-transparent" : "bg-white") : "bg-muted",
|
||||
showLoadedLogo ? "bg-white" : "bg-muted",
|
||||
)}
|
||||
aria-hidden
|
||||
>
|
||||
@@ -180,7 +173,7 @@ export function ChannelLogo({
|
||||
)}>
|
||||
{Icon ? <Icon className="h-6 w-6" strokeWidth={2} /> : initials}
|
||||
</span>
|
||||
{showRemoteLogo ? <img
|
||||
{showLogo ? <img
|
||||
src={logoUrl}
|
||||
alt=""
|
||||
decoding="async"
|
||||
@@ -188,8 +181,7 @@ export function ChannelLogo({
|
||||
referrerPolicy="no-referrer"
|
||||
draggable={false}
|
||||
className={cn(
|
||||
"absolute object-contain transition-opacity duration-150 motion-reduce:transition-none",
|
||||
isLogoTile ? "h-8 w-8" : "h-6 w-6",
|
||||
"absolute h-6 w-6 object-contain transition-opacity duration-150 motion-reduce:transition-none",
|
||||
logoLoaded ? "opacity-100" : "opacity-0",
|
||||
)}
|
||||
onLoad={onLogoLoad}
|
||||
|
||||
Reference in new issue
Block a user