fix: show full desktop instance label in header

This commit is contained in:
Bohdan Triapitsyn
2026-09-03 11:49:34 +03:00
parent a87f068256
commit e8ba8e996f
+2 -27
View File
@@ -124,7 +124,6 @@ const HeaderIconActionButton = React.memo(function HeaderIconActionButton({
type DesktopServicesMenuProps = { type DesktopServicesMenuProps = {
isDesktopApp: boolean; isDesktopApp: boolean;
currentInstanceLabel: string; currentInstanceLabel: string;
compactCurrentInstanceLabel: string;
currentInstanceIsLocal: boolean; currentInstanceIsLocal: boolean;
isDesktopServicesOpen: boolean; isDesktopServicesOpen: boolean;
setIsDesktopServicesOpen: React.Dispatch<React.SetStateAction<boolean>>; setIsDesktopServicesOpen: React.Dispatch<React.SetStateAction<boolean>>;
@@ -139,7 +138,6 @@ type DesktopServicesMenuProps = {
const DesktopServicesMenu = React.memo(function DesktopServicesMenu({ const DesktopServicesMenu = React.memo(function DesktopServicesMenu({
isDesktopApp, isDesktopApp,
currentInstanceLabel, currentInstanceLabel,
compactCurrentInstanceLabel,
currentInstanceIsLocal, currentInstanceIsLocal,
isDesktopServicesOpen, isDesktopServicesOpen,
setIsDesktopServicesOpen, setIsDesktopServicesOpen,
@@ -171,12 +169,12 @@ const DesktopServicesMenu = React.memo(function DesktopServicesMenu({
: t('header.services.open')} : t('header.services.open')}
className={cn( className={cn(
DESKTOP_HEADER_ICON_BUTTON_CLASS, DESKTOP_HEADER_ICON_BUTTON_CLASS,
isDesktopApp ? 'w-auto max-w-[14rem] justify-start gap-1.5 px-2.5' : 'h-8 w-8' isDesktopApp ? 'w-auto max-w-[20rem] justify-start gap-1.5 px-2.5' : 'h-8 w-8'
)} )}
> >
<Icon name="server" className="h-[18px] w-[18px]" /> <Icon name="server" className="h-[18px] w-[18px]" />
{isDesktopApp ? ( {isDesktopApp ? (
<span className="truncate typography-ui-label font-medium text-foreground">{compactCurrentInstanceLabel}</span> <span className="truncate typography-ui-label font-medium text-foreground">{currentInstanceLabel}</span>
) : null} ) : null}
</button> </button>
</DropdownMenuTrigger> </DropdownMenuTrigger>
@@ -251,27 +249,6 @@ const isSameContextUsage = (
&& (a.lastMessageId ?? '') === (b.lastMessageId ?? ''); && (a.lastMessageId ?? '') === (b.lastMessageId ?? '');
}; };
const formatCompactHeaderLabel = (value: string): string => {
const trimmed = value.trim();
if (!trimmed) {
return '';
}
const words = trimmed.split(/\s+/).filter(Boolean);
if (words.length >= 2) {
const first = words[0];
const second = words[1].slice(0, 3);
const shortTwoWord = `${first} ${second}`.trim();
if (words.length > 2 || shortTwoWord.length < trimmed.length) {
return `${shortTwoWord}...`;
}
return shortTwoWord;
}
return trimmed.length > 12 ? `${trimmed.slice(0, 9).trimEnd()}...` : trimmed;
};
const normalize = (value: string): string => { const normalize = (value: string): string => {
if (!value) return ''; if (!value) return '';
const replaced = value.replace(/\\/g, '/'); const replaced = value.replace(/\\/g, '/');
@@ -447,7 +424,6 @@ export const Header: React.FC = () => {
const [remoteUpdateInfo, setRemoteUpdateInfo] = React.useState<UpdateInfo | null>(null); const [remoteUpdateInfo, setRemoteUpdateInfo] = React.useState<UpdateInfo | null>(null);
const [remoteUpdateChecking, setRemoteUpdateChecking] = React.useState(false); const [remoteUpdateChecking, setRemoteUpdateChecking] = React.useState(false);
const [remoteUpdateError, setRemoteUpdateError] = React.useState<string | null>(null); const [remoteUpdateError, setRemoteUpdateError] = React.useState<string | null>(null);
const compactCurrentInstanceLabel = React.useMemo(() => formatCompactHeaderLabel(currentInstanceLabel), [currentInstanceLabel]);
const isVSCode = React.useMemo(() => isVSCodeRuntime(), []); const isVSCode = React.useMemo(() => isVSCodeRuntime(), []);
// While the work-status panel is on screen it already reports the project, // While the work-status panel is on screen it already reports the project,
// the branch and the context fill — three paces away in the same window. // the branch and the context fill — three paces away in the same window.
@@ -1293,7 +1269,6 @@ export const Header: React.FC = () => {
<DesktopServicesMenu <DesktopServicesMenu
isDesktopApp={isDesktopApp} isDesktopApp={isDesktopApp}
currentInstanceLabel={currentInstanceLabel} currentInstanceLabel={currentInstanceLabel}
compactCurrentInstanceLabel={compactCurrentInstanceLabel}
currentInstanceIsLocal={currentInstanceIsLocal} currentInstanceIsLocal={currentInstanceIsLocal}
isDesktopServicesOpen={isDesktopServicesOpen} isDesktopServicesOpen={isDesktopServicesOpen}
setIsDesktopServicesOpen={setIsDesktopServicesOpen} setIsDesktopServicesOpen={setIsDesktopServicesOpen}