Skip to content

Commit 0cd3299

Browse files
jaags-devDeepak-Kesavanjohnyrahulvishnuszipstack
authored
Feat/Updated browser title with project name (#656)
updated browser title with project name Signed-off-by: jagadeeswaran-zipstack <jagadeeswaran@zipstack.com> Co-authored-by: Deepak K <89829542+Deepak-Kesavan@users.noreply.github.com> Co-authored-by: Rahul Johny <116638720+johnyrahul@users.noreply.github.com> Co-authored-by: vishnuszipstack <117254672+vishnuszipstack@users.noreply.github.com>
1 parent b23e604 commit 0cd3299

6 files changed

Lines changed: 84 additions & 7 deletions

File tree

frontend/package-lock.json

Lines changed: 50 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"react-dom": "^18.2.0",
4141
"react-google-recaptcha": "^3.1.0",
4242
"react-gtm-module": "^2.0.11",
43+
"react-helmet-async": "^2.0.5",
4344
"react-js-cron": "^5.0.1",
4445
"react-product-fruits": "^2.2.6",
4546
"react-router-dom": "^6.11.2",

frontend/src/App.jsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import { Button, ConfigProvider, notification, theme } from "antd";
22
import { BrowserRouter } from "react-router-dom";
3+
import { HelmetProvider } from "react-helmet-async";
34

45
import { THEME } from "./helpers/GetStaticData.js";
56
import { Router } from "./routes/Router.jsx";
67
import { useAlertStore } from "./store/alert-store.js";
78
import { useSessionStore } from "./store/session-store.js";
89
import PostHogPageviewTracker from "./PostHogPageviewTracker.js";
10+
import { PageTitle } from "./components/widgets/page-title/PageTitle.jsx";
911
import { useEffect } from "react";
1012
import CustomMarkdown from "./components/helpers/custom-markdown/CustomMarkdown.jsx";
1113

@@ -72,12 +74,15 @@ function App() {
7274
},
7375
}}
7476
>
75-
<BrowserRouter>
76-
<PostHogPageviewTracker />
77-
{GoogleTagManagerHelper && <GoogleTagManagerHelper />}
78-
{contextHolder}
79-
<Router />
80-
</BrowserRouter>
77+
<HelmetProvider>
78+
<BrowserRouter>
79+
<PostHogPageviewTracker />
80+
<PageTitle title={"Unstract"} />
81+
{GoogleTagManagerHelper && <GoogleTagManagerHelper />}
82+
{contextHolder}
83+
<Router />
84+
</BrowserRouter>
85+
</HelmetProvider>
8186
</ConfigProvider>
8287
);
8388
}

frontend/src/components/agency/agency/Agency.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { useWorkflowStore } from "../../../store/workflow-store";
1818
import { LogsLabel } from "../logs-label/LogsLabel";
1919
import { SidePanel } from "../side-panel/SidePanel";
2020
import { DisplayLogs } from "../display-logs/DisplayLogs";
21+
import { PageTitle } from "../../widgets/page-title/PageTitle";
2122

2223
function Agency() {
2324
const [isCollapsed, setIsCollapsed] = useState(false);
@@ -31,7 +32,7 @@ function Agency() {
3132
const { message, setDefault } = useSocketMessagesStore();
3233
const { emptyLogs } = useSocketLogsStore();
3334
const workflowStore = useWorkflowStore();
34-
const { details, loadingType } = workflowStore;
35+
const { details, loadingType, projectName } = workflowStore;
3536
const prompt = details?.prompt_text;
3637
const [activeToolId, setActiveToolId] = useState("");
3738
const [prevLoadingType, setPrevLoadingType] = useState("");
@@ -184,6 +185,7 @@ function Agency() {
184185

185186
return (
186187
<div className="agency-layout">
188+
<PageTitle title={projectName} />
187189
<Layout className="agency-sider-layout">
188190
<Layout className="agency-sider-layout">
189191
<IslandLayout>

frontend/src/components/custom-tools/tool-ide/ToolIde.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import { SettingsModal } from "../settings-modal/SettingsModal";
1515
import { ToolsMain } from "../tools-main/ToolsMain";
1616
import "./ToolIde.css";
1717
import usePostHogEvents from "../../../hooks/usePostHogEvents.js";
18+
import { PageTitle } from "../../widgets/page-title/PageTitle.jsx";
19+
1820
let OnboardMessagesModal;
1921
let PromptShareModal;
2022
let PromptShareLink;
@@ -232,6 +234,7 @@ function ToolIde() {
232234

233235
return (
234236
<div className="tool-ide-layout">
237+
<PageTitle title={details?.tool_name} />
235238
{isPublicSource && HeaderPublic && <HeaderPublic />}
236239
<div>
237240
<Header
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Helmet } from "react-helmet-async";
2+
import PropTypes from "prop-types";
3+
4+
function PageTitle({ title }) {
5+
return (
6+
<Helmet>
7+
<title>{title ? `${title} - Unstract` : "Unstract"}</title>
8+
</Helmet>
9+
);
10+
}
11+
12+
PageTitle.propTypes = {
13+
title: PropTypes.string,
14+
};
15+
16+
export { PageTitle };

0 commit comments

Comments
 (0)