fix(ui): provider-aware context tab icon
This commit is contained in:
@@ -193,6 +193,7 @@ const getTabLabel = (
|
|||||||
const getTabIcon = (
|
const getTabIcon = (
|
||||||
tab: { mode: ContextPanelMode; targetPath: string | null },
|
tab: { mode: ContextPanelMode; targetPath: string | null },
|
||||||
faviconByOrigin: Record<string, string> = {},
|
faviconByOrigin: Record<string, string> = {},
|
||||||
|
gitProvider: GitProvider | null,
|
||||||
): React.ReactNode | undefined => {
|
): React.ReactNode | undefined => {
|
||||||
if (tab.mode === 'file') {
|
if (tab.mode === 'file') {
|
||||||
return tab.targetPath
|
return tab.targetPath
|
||||||
@@ -213,7 +214,7 @@ const getTabIcon = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tab.mode === 'pr') {
|
if (tab.mode === 'pr') {
|
||||||
return <Icon name="github" className="h-3.5 w-3.5" />;
|
return <Icon name={gitProvider === 'gitlab' ? 'git-merge' : 'github'} className="h-3.5 w-3.5" />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tab.mode === 'notes') {
|
if (tab.mode === 'notes') {
|
||||||
@@ -930,7 +931,7 @@ export const ContextPanel: React.FC = () => {
|
|||||||
return {
|
return {
|
||||||
id: tab.id,
|
id: tab.id,
|
||||||
label,
|
label,
|
||||||
icon: getTabIcon(tab, faviconByOrigin),
|
icon: getTabIcon(tab, faviconByOrigin, gitProvider),
|
||||||
title: tabPathLabel ? `${rawLabel}: ${tabPathLabel}` : rawLabel,
|
title: tabPathLabel ? `${rawLabel}: ${tabPathLabel}` : rawLabel,
|
||||||
closeLabel: t('contextPanel.tab.closeTabAria', { label }),
|
closeLabel: t('contextPanel.tab.closeTabAria', { label }),
|
||||||
};
|
};
|
||||||
@@ -1006,7 +1007,7 @@ export const ContextPanel: React.FC = () => {
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="flex min-w-0 flex-1 items-center gap-1.5 px-3">
|
<div className="flex min-w-0 flex-1 items-center gap-1.5 px-3">
|
||||||
{activeTab ? getTabIcon(activeTab, faviconByOrigin) : null}
|
{activeTab ? getTabIcon(activeTab, faviconByOrigin, gitProvider) : null}
|
||||||
<span className="truncate typography-ui-label text-foreground">
|
<span className="truncate typography-ui-label text-foreground">
|
||||||
{activeTab ? getModeLabel(activeTab.mode, t, gitProvider) : null}
|
{activeTab ? getModeLabel(activeTab.mode, t, gitProvider) : null}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user