13 lines
489 B
TypeScript
13 lines
489 B
TypeScript
import type { SidebarWorkspaceEntry } from "@/hooks/use-sidebar-workspaces-list";
|
|
import type { WorkspaceTitleSource } from "@/hooks/use-settings";
|
|
|
|
export function resolveSidebarWorkspacePrimaryLabel(input: {
|
|
workspace: Pick<SidebarWorkspaceEntry, "name" | "currentBranch">;
|
|
workspaceTitleSource: WorkspaceTitleSource;
|
|
}): string {
|
|
if (input.workspaceTitleSource === "branch") {
|
|
return input.workspace.currentBranch ?? input.workspace.name;
|
|
}
|
|
return input.workspace.name;
|
|
}
|