Files
paseo/packages/app/src/utils/project-display-name.ts
2026-03-21 20:22:15 +07:00

20 lines
686 B
TypeScript

export function projectDisplayNameFromProjectId(projectId: string): string {
const githubRemotePrefix = "remote:github.com/";
if (projectId.startsWith(githubRemotePrefix)) {
return projectId.slice(githubRemotePrefix.length) || projectId;
}
const segments = projectId.split(/[\\/]/).filter(Boolean);
return segments[segments.length - 1] || projectId;
}
export function projectIconPlaceholderLabelFromDisplayName(displayName: string): string {
const trimmedDisplayName = displayName.trim();
if (!trimmedDisplayName) {
return "";
}
const segments = trimmedDisplayName.split("/").filter(Boolean);
return segments[segments.length - 1] || trimmedDisplayName;
}