forked from github/plane
[WEB-472] fix: Page title for global view (#3723)
* fix: Page title for global view * fix: global-view-id type
This commit is contained in:
parent
952eb871df
commit
95871b0049
@ -1,20 +1,37 @@
|
|||||||
import { ReactElement } from "react";
|
import { ReactElement } from "react";
|
||||||
|
import { useRouter } from "next/router";
|
||||||
|
import { observer } from "mobx-react";
|
||||||
// layouts
|
// layouts
|
||||||
import { AppLayout } from "layouts/app-layout";
|
import { AppLayout } from "layouts/app-layout";
|
||||||
|
// hooks
|
||||||
|
import { useGlobalView, useWorkspace } from "hooks/store";
|
||||||
// components
|
// components
|
||||||
import { GlobalViewsHeader } from "components/workspace";
|
import { GlobalViewsHeader } from "components/workspace";
|
||||||
import { AllIssueLayoutRoot } from "components/issues";
|
import { AllIssueLayoutRoot } from "components/issues";
|
||||||
import { GlobalIssuesHeader } from "components/headers";
|
import { GlobalIssuesHeader } from "components/headers";
|
||||||
|
import { PageHead } from "components/core";
|
||||||
// types
|
// types
|
||||||
import { NextPageWithLayout } from "lib/types";
|
import { NextPageWithLayout } from "lib/types";
|
||||||
import { observer } from "mobx-react";
|
// constants
|
||||||
import { useWorkspace } from "hooks/store";
|
import { DEFAULT_GLOBAL_VIEWS_LIST } from "constants/workspace";
|
||||||
import { PageHead } from "components/core";
|
|
||||||
|
|
||||||
const GlobalViewIssuesPage: NextPageWithLayout = observer(() => {
|
const GlobalViewIssuesPage: NextPageWithLayout = observer(() => {
|
||||||
|
// router
|
||||||
|
const router = useRouter();
|
||||||
|
const { globalViewId } = router.query;
|
||||||
|
// store hooks
|
||||||
const { currentWorkspace } = useWorkspace();
|
const { currentWorkspace } = useWorkspace();
|
||||||
|
const { getViewDetailsById } = useGlobalView();
|
||||||
// derived values
|
// 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 (
|
return (
|
||||||
<>
|
<>
|
||||||
<PageHead title={pageTitle} />
|
<PageHead title={pageTitle} />
|
||||||
|
Loading…
Reference in New Issue
Block a user