Skip to content

Commit

Permalink
Feat/Updated browser title with project name (#656)
Browse files Browse the repository at this point in the history
updated browser title with project name

Signed-off-by: jagadeeswaran-zipstack <[email protected]>
Co-authored-by: Deepak K <[email protected]>
Co-authored-by: Rahul Johny <[email protected]>
Co-authored-by: vishnuszipstack <[email protected]>
  • Loading branch information
4 people authored Jan 6, 2025
1 parent b23e604 commit 0cd3299
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 7 deletions.
50 changes: 50 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"react-dom": "^18.2.0",
"react-google-recaptcha": "^3.1.0",
"react-gtm-module": "^2.0.11",
"react-helmet-async": "^2.0.5",
"react-js-cron": "^5.0.1",
"react-product-fruits": "^2.2.6",
"react-router-dom": "^6.11.2",
Expand Down
17 changes: 11 additions & 6 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { Button, ConfigProvider, notification, theme } from "antd";
import { BrowserRouter } from "react-router-dom";
import { HelmetProvider } from "react-helmet-async";

import { THEME } from "./helpers/GetStaticData.js";
import { Router } from "./routes/Router.jsx";
import { useAlertStore } from "./store/alert-store.js";
import { useSessionStore } from "./store/session-store.js";
import PostHogPageviewTracker from "./PostHogPageviewTracker.js";
import { PageTitle } from "./components/widgets/page-title/PageTitle.jsx";
import { useEffect } from "react";
import CustomMarkdown from "./components/helpers/custom-markdown/CustomMarkdown.jsx";

Expand Down Expand Up @@ -72,12 +74,15 @@ function App() {
},
}}
>
<BrowserRouter>
<PostHogPageviewTracker />
{GoogleTagManagerHelper && <GoogleTagManagerHelper />}
{contextHolder}
<Router />
</BrowserRouter>
<HelmetProvider>
<BrowserRouter>
<PostHogPageviewTracker />
<PageTitle title={"Unstract"} />
{GoogleTagManagerHelper && <GoogleTagManagerHelper />}
{contextHolder}
<Router />
</BrowserRouter>
</HelmetProvider>
</ConfigProvider>
);
}
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/components/agency/agency/Agency.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useWorkflowStore } from "../../../store/workflow-store";
import { LogsLabel } from "../logs-label/LogsLabel";
import { SidePanel } from "../side-panel/SidePanel";
import { DisplayLogs } from "../display-logs/DisplayLogs";
import { PageTitle } from "../../widgets/page-title/PageTitle";

function Agency() {
const [isCollapsed, setIsCollapsed] = useState(false);
Expand All @@ -31,7 +32,7 @@ function Agency() {
const { message, setDefault } = useSocketMessagesStore();
const { emptyLogs } = useSocketLogsStore();
const workflowStore = useWorkflowStore();
const { details, loadingType } = workflowStore;
const { details, loadingType, projectName } = workflowStore;
const prompt = details?.prompt_text;
const [activeToolId, setActiveToolId] = useState("");
const [prevLoadingType, setPrevLoadingType] = useState("");
Expand Down Expand Up @@ -184,6 +185,7 @@ function Agency() {

return (
<div className="agency-layout">
<PageTitle title={projectName} />
<Layout className="agency-sider-layout">
<Layout className="agency-sider-layout">
<IslandLayout>
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/components/custom-tools/tool-ide/ToolIde.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { SettingsModal } from "../settings-modal/SettingsModal";
import { ToolsMain } from "../tools-main/ToolsMain";
import "./ToolIde.css";
import usePostHogEvents from "../../../hooks/usePostHogEvents.js";
import { PageTitle } from "../../widgets/page-title/PageTitle.jsx";

let OnboardMessagesModal;
let PromptShareModal;
let PromptShareLink;
Expand Down Expand Up @@ -232,6 +234,7 @@ function ToolIde() {

return (
<div className="tool-ide-layout">
<PageTitle title={details?.tool_name} />
{isPublicSource && HeaderPublic && <HeaderPublic />}
<div>
<Header
Expand Down
16 changes: 16 additions & 0 deletions frontend/src/components/widgets/page-title/PageTitle.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Helmet } from "react-helmet-async";
import PropTypes from "prop-types";

function PageTitle({ title }) {
return (
<Helmet>
<title>{title ? `${title} - Unstract` : "Unstract"}</title>
</Helmet>
);
}

PageTitle.propTypes = {
title: PropTypes.string,
};

export { PageTitle };

0 comments on commit 0cd3299

Please sign in to comment.