Add basic simplify title in the navbar.

This commit is contained in:
Howard 2025-05-29 23:56:33 +08:00
parent fe965e84a5
commit 122a01fe73

View File

@ -263,6 +263,22 @@ onMounted(async () => {
} }
}); });
const navBarDisplayText = (text: string) => {
if (!text) {
return;
}
const trimSpaces = text.trim();
const regex = /.{0,7}/;
console.log("asdasda");
if (trimSpaces.length <= 7) {
return text;
}
const maxStay = text.match(regex);
const filterToMax7Chars = maxStay[0] + "..."
return filterToMax7Chars;
}
const findAndOpenWindow = (windowName: string, windowTitle?: string) => { const findAndOpenWindow = (windowName: string, windowTitle?: string) => {
const app = associAppWindow.find((app) => app.name === windowName); const app = associAppWindow.find((app) => app.name === windowName);
@ -301,13 +317,13 @@ const findAndOpenWindow = (windowName: string, windowTitle?: string) => {
// Add to navbar // Add to navbar
const windowNameVal2 = const windowNameVal2 =
globalWindowVal.value.get(windowName).windowCount === 1 globalWindowVal.value.get(windowName).windowCount === 1
? app.title ? navBarDisplayText(app.title)
: app.title + : navBarDisplayText(app.title) +
"(" + "(" +
globalWindowVal.value.get(windowName).windowCount + globalWindowVal.value.get(windowName).windowCount +
")"; ")";
currentNavBar.value.push({ currentNavBar.value.push({
name: windowTitle || windowNameVal2, name: navBarDisplayText(windowTitle) || windowNameVal2,
icon: "anything", icon: "anything",
action: "idk", action: "idk",
flash: true, flash: true,