Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/Updated browser title with project name #656

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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";

let GoogleTagManagerHelper;
try {
Expand Down Expand Up @@ -67,12 +69,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 @@ -224,6 +226,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 };
Loading