Skip to content

Commit

Permalink
[WEB-472] fix: Page title for global view (#3723)
Browse files Browse the repository at this point in the history
* fix: Page title for global view

* fix: global-view-id type
  • Loading branch information
1akhanBaheti authored Feb 20, 2024
1 parent 952eb87 commit 95871b0
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions web/pages/[workspaceSlug]/workspace-views/[globalViewId].tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,37 @@
import { ReactElement } from "react";
import { useRouter } from "next/router";
import { observer } from "mobx-react";
// layouts
import { AppLayout } from "layouts/app-layout";
// hooks
import { useGlobalView, useWorkspace } from "hooks/store";
// components
import { GlobalViewsHeader } from "components/workspace";
import { AllIssueLayoutRoot } from "components/issues";
import { GlobalIssuesHeader } from "components/headers";
import { PageHead } from "components/core";
// types
import { NextPageWithLayout } from "lib/types";
import { observer } from "mobx-react";
import { useWorkspace } from "hooks/store";
import { PageHead } from "components/core";
// constants
import { DEFAULT_GLOBAL_VIEWS_LIST } from "constants/workspace";

const GlobalViewIssuesPage: NextPageWithLayout = observer(() => {
// router
const router = useRouter();
const { globalViewId } = router.query;
// store hooks
const { currentWorkspace } = useWorkspace();
const { getViewDetailsById } = useGlobalView();
// derived values
const pageTitle = currentWorkspace?.name ? `${currentWorkspace?.name} - Views` : undefined;
const globalViewDetails = globalViewId ? getViewDetailsById(globalViewId.toString()) : undefined;
const defaultView = DEFAULT_GLOBAL_VIEWS_LIST.find((view) => view.key === globalViewId);
const pageTitle =
currentWorkspace?.name && defaultView?.label
? `${currentWorkspace?.name} - ${defaultView?.label}`
: currentWorkspace?.name && globalViewDetails?.name
? `${currentWorkspace?.name} - ${globalViewDetails?.name}`
: undefined;

return (
<>
<PageHead title={pageTitle} />
Expand Down

0 comments on commit 95871b0

Please sign in to comment.