mirror of
https://github.com/alphaXiv/OpenResearch.git
synced 2026-10-02 01:34:34 +08:00
OR-244 feat(ui): name the open project in the browser tab title (#269)
* feat(ui): name the open project in the browser tab title
The tab now reads "OpenResearch - {Project Name}" while a project is open,
so multiple dashboard tabs are distinguishable.
The title falls back to plain "OpenResearch" on every screen that renders
instead of a project — projects home, the startup-error page, and the
loading spinner — since a partial startup failure or an SSE project event
can leave `projects` populated behind those. The project name is wrapped in
`autoDir` so an RTL name cannot reorder the brand prefix, matching how
project names are interpolated elsewhere.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* fix(ui): lead the tab title with the project name
Browser tabs truncate from the right, so the invariant "OpenResearch"
prefix survived while the project name — the part that distinguishes one
tab from another — was clipped first. The title now reads
"{Project Name} - OpenResearch".
The autoDir isolate around the name becomes load-bearing in a second way
here: as the leading run it would otherwise supply the title's first strong
character, so an RTL project name would flip the whole title's base
direction. FSI is skipped by the base-direction scan, keeping it LTR.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
01473da5d7
commit
d69717f42e
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -49,7 +49,7 @@
|
||||
html { background: #ffffff; }
|
||||
html[data-theme="dark"] { background: #0e0c0c; }
|
||||
</style>
|
||||
<script type="module" crossorigin src="/assets/index-Bptg68DR.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-KJ5h54vp.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BmXdr9Hq.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
+9
-1
@@ -1,6 +1,7 @@
|
||||
import { m } from "./paraglide/messages.js";
|
||||
import { getLocale } from "./paraglide/runtime.js";
|
||||
import { useLocale } from "./locale";
|
||||
import { autoDir } from "./i18n";
|
||||
import {
|
||||
ChartSpline,
|
||||
Check,
|
||||
@@ -801,6 +802,14 @@ export default function App() {
|
||||
openDemoWelcome();
|
||||
}, [projectId, homeOpen, onboarded, openDemoWelcome, uiState?.tourCompleted]);
|
||||
|
||||
const activeProject = projects?.find((p) => p.id === projectId) ?? null;
|
||||
|
||||
// The home, error, and loading screens leave projects populated but show no project.
|
||||
useEffect(() => {
|
||||
const name = homeOpen || startupError || uiState === null ? null : activeProject?.name;
|
||||
document.title = name ? `${autoDir(name)} - OpenResearch` : "OpenResearch";
|
||||
}, [homeOpen, startupError, uiState, activeProject]);
|
||||
|
||||
const projectIdRef = useRef(projectId);
|
||||
projectIdRef.current = projectId;
|
||||
|
||||
@@ -1572,7 +1581,6 @@ export default function App() {
|
||||
onClose={() => closeFileTab(tab)}
|
||||
/>
|
||||
);
|
||||
const activeProject = projects?.find((p) => p.id === projectId) ?? null;
|
||||
const tabExperiment = expTab ? (experiments.find((e) => e.id === expTab.id) ?? null) : null;
|
||||
const codeExperiment = codeTab
|
||||
? (experiments.find((experiment) => experiment.id === codeTab.experimentId) ?? null)
|
||||
|
||||
Reference in New Issue
Block a user