feat: update document title based on selected project (#448)

Show dynamic browser tab title based on selected project's name, post-fixed with "CloudCLI UI" when a project is selected, improving navigation across tabs.
This commit is contained in:
Xì Gà
2026-02-27 22:51:26 +07:00
committed by GitHub
parent 9c0e864532
commit 9e22f42a3d

View File

@@ -1,3 +1,4 @@
import { useEffect } from 'react';
import type { TFunction } from 'i18next';
import type { LoadingProgress, Project, ProjectSession, SessionProvider } from '../../../../types/app';
import type {
@@ -103,6 +104,15 @@ export default function SidebarProjectList({
/>
);
useEffect(() => {
let baseTitle = 'CloudCLI UI';
const displayName = selectedProject?.displayName?.trim();
if (displayName) {
baseTitle = `${displayName} - ${baseTitle}`;
}
document.title = baseTitle;
}, [selectedProject]);
const showProjects = !isLoading && projects.length > 0 && filteredProjects.length > 0;
return (