mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
20 lines
686 B
TypeScript
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;
|
|
}
|