设置 Web 页面标题
This commit is contained in:
@@ -74,6 +74,14 @@ function CommitPageInner() {
|
||||
}
|
||||
}, [hasValidFolderId, normalizedFolderId])
|
||||
|
||||
const pageTitle = folder
|
||||
? `${t("title")} · ${folder.name}`
|
||||
: t("title")
|
||||
|
||||
useEffect(() => {
|
||||
document.title = `${pageTitle} - codeg`
|
||||
}, [pageTitle])
|
||||
|
||||
return (
|
||||
<div className="flex h-screen flex-col overflow-hidden bg-background text-foreground">
|
||||
<AppTitleBar
|
||||
|
||||
@@ -50,6 +50,17 @@ import {
|
||||
} from "@/components/ui/resizable"
|
||||
import type { AgentType } from "@/lib/types"
|
||||
import { cn } from "@/lib/utils"
|
||||
import { useFolderContext } from "@/contexts/folder-context"
|
||||
|
||||
function FolderDocumentTitle() {
|
||||
const { folder } = useFolderContext()
|
||||
|
||||
useEffect(() => {
|
||||
document.title = folder ? `${folder.name} - codeg` : "codeg"
|
||||
}, [folder])
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
const TOAST_DURATION_MS = 15000
|
||||
const WORKSPACE_PANEL_GROUP_ID = "workspace-panel-group"
|
||||
@@ -663,6 +674,7 @@ function FolderLayoutInner({ children }: { children: React.ReactNode }) {
|
||||
initialConversationId={conversationId ? Number(conversationId) : null}
|
||||
initialAgentType={agentType}
|
||||
>
|
||||
<FolderDocumentTitle />
|
||||
<AlertProvider>
|
||||
<GitCredentialProvider>
|
||||
<TaskProvider>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { useState } from "react"
|
||||
import { useEffect, useState } from "react"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { isDesktop } from "@/lib/platform"
|
||||
|
||||
@@ -10,6 +10,10 @@ export default function LoginPage() {
|
||||
const [error, setError] = useState("")
|
||||
const [loading, setLoading] = useState(false)
|
||||
|
||||
useEffect(() => {
|
||||
document.title = "Login - codeg"
|
||||
}, [])
|
||||
|
||||
// Desktop users skip login entirely
|
||||
if (isDesktop()) {
|
||||
router.replace("/welcome")
|
||||
|
||||
@@ -76,6 +76,14 @@ function MergePageInner() {
|
||||
}
|
||||
}, [hasValidFolderId, normalizedFolderId])
|
||||
|
||||
const pageTitle = folder
|
||||
? `${t("title")} · ${folder.name}`
|
||||
: t("title")
|
||||
|
||||
useEffect(() => {
|
||||
document.title = `${pageTitle} - codeg`
|
||||
}, [pageTitle])
|
||||
|
||||
return (
|
||||
<div className="flex h-screen flex-col overflow-hidden bg-background text-foreground">
|
||||
<AppTitleBar
|
||||
|
||||
@@ -74,6 +74,14 @@ function PushPageInner() {
|
||||
}
|
||||
}, [hasValidFolderId, normalizedFolderId])
|
||||
|
||||
const pageTitle = folder
|
||||
? `${t("title")} · ${folder.name}`
|
||||
: t("title")
|
||||
|
||||
useEffect(() => {
|
||||
document.title = `${pageTitle} - codeg`
|
||||
}, [pageTitle])
|
||||
|
||||
return (
|
||||
<div className="flex h-screen flex-col overflow-hidden bg-background text-foreground">
|
||||
<AppTitleBar
|
||||
|
||||
@@ -64,6 +64,14 @@ function StashPageInner() {
|
||||
}
|
||||
}, [hasValidFolderId, normalizedFolderId])
|
||||
|
||||
const pageTitle = folder
|
||||
? `${t("title")} · ${folder.name}`
|
||||
: t("title")
|
||||
|
||||
useEffect(() => {
|
||||
document.title = `${pageTitle} - codeg`
|
||||
}, [pageTitle])
|
||||
|
||||
return (
|
||||
<div className="flex h-screen flex-col overflow-hidden bg-background text-foreground">
|
||||
<AppTitleBar
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
"use client"
|
||||
|
||||
import { useEffect } from "react"
|
||||
import { useTranslations } from "next-intl"
|
||||
import { WelcomeScreen } from "@/components/welcome/welcome-screen"
|
||||
|
||||
export default function WelcomePage() {
|
||||
const t = useTranslations("WelcomePage")
|
||||
|
||||
useEffect(() => {
|
||||
document.title = `${t("title")} - codeg`
|
||||
}, [t])
|
||||
|
||||
return <WelcomeScreen />
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
"use client"
|
||||
|
||||
import { useCallback, type ComponentType, type ReactNode } from "react"
|
||||
import { useCallback, useEffect, type ComponentType, type ReactNode } from "react"
|
||||
import {
|
||||
Bot,
|
||||
BookOpenText,
|
||||
@@ -99,6 +99,10 @@ export function SettingsShell({ children }: SettingsShellProps) {
|
||||
const router = useRouter()
|
||||
const normalizedPathname = normalizePath(pathname)
|
||||
|
||||
useEffect(() => {
|
||||
document.title = `${t("title")} - codeg`
|
||||
}, [t])
|
||||
|
||||
const navigateTo = useCallback(
|
||||
(href: string) => {
|
||||
if (typeof window === "undefined") return
|
||||
|
||||
Reference in New Issue
Block a user