fix(web): derive project rail labels from names
This commit is contained in:
@@ -47,7 +47,7 @@ export function ProjectRail({
|
||||
style={{ '--project-color': project.color } as CSSProperties}
|
||||
title={project.name}
|
||||
>
|
||||
{project.short}
|
||||
{projectNameLabel(project.name)}
|
||||
</button>
|
||||
</Badge>
|
||||
))}
|
||||
@@ -56,3 +56,9 @@ export function ProjectRail({
|
||||
</Sider>
|
||||
)
|
||||
}
|
||||
|
||||
function projectNameLabel(name: string) {
|
||||
const characters = Array.from(name.trim())
|
||||
const limit = characters.some((character) => /\p{Script=Han}/u.test(character)) ? 2 : 4
|
||||
return characters.slice(0, limit).join('')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user