Skip to content

Commit 87dcb80

Browse files
author
bensadevs
committed
fix window titles for time tracking apps
1 parent 9513e62 commit 87dcb80

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎apps/desktop/src/window/DesktopWindow.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,10 +541,6 @@ export const make = Effect.gen(function* () {
541541
}
542542
});
543543

544-
window.on("page-title-updated", (event) => {
545-
event.preventDefault();
546-
window.setTitle(environment.displayName);
547-
});
548544
window.on("resize", scheduleBoundsPersist);
549545
window.on("move", scheduleBoundsPersist);
550546
window.on("maximize", scheduleBoundsPersist);

‎apps/web/src/routes/__root.tsx‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
type ErrorComponentProps,
88
useLocation,
99
useNavigate,
10+
useParams,
1011
} from "@tanstack/react-router";
1112
import { useEffect, useEffectEvent, useRef, useState } from "react";
1213

@@ -50,7 +51,8 @@ import {
5051
primaryServerConfigEventAtom,
5152
primaryServerWelcomeAtom,
5253
} from "../state/server";
53-
import { readProject, setActiveEnvironmentId, useActiveEnvironmentId } from "../state/entities";
54+
import { readProject, setActiveEnvironmentId, useActiveEnvironmentId, useProject, useThreadShell } from "../state/entities";
55+
import { resolveThreadRouteRef } from "../threadRoutes";
5456
import {
5557
createKeybindingsUpdateToastController,
5658
type KeybindingsUpdateToastController,
@@ -193,14 +195,20 @@ function FontAppearanceSync() {
193195
}
194196

195197
function DocumentTitleSync() {
198+
const threadRef = useParams({ strict: false, select: resolveThreadRouteRef });
199+
const thread = useThreadShell(threadRef);
200+
const project = useProject(
201+
thread ? scopeProjectRef(thread.environmentId, thread.projectId) : null,
202+
);
196203
const primaryServerVersion =
197204
useAtomValue(primaryServerConfigAtom)?.environment.serverVersion ?? null;
198-
const title = resolveServerBackedAppDisplayName({
205+
const appTitle = resolveServerBackedAppDisplayName({
199206
baseName: APP_BASE_NAME,
200207
fallbackDisplayName: APP_DISPLAY_NAME,
201208
fallbackStageLabel: APP_STAGE_LABEL,
202209
primaryServerVersion,
203210
});
211+
const title = thread && project ? `${thread.title} — ${project.title}` : appTitle;
204212

205213
useEffect(() => {
206214
document.title = title;

0 commit comments

Comments
 (0)