[WEB-4098] feat: noindex/nofollow (#7088)
* feat: noindex/nofollow - On login: nofollow - On app pages: noindex, nofollow https://app.plane.so/plane/browse/WEB-4098/ - https://nextjs.org/docs/app/api-reference/file-conventions/layout - https://nextjs.org/docs/app/building-your-application/routing/route-groups#creating-multiple-root-layouts - https://nextjs.org/docs/app/api-reference/functions/generate-metadata#link-relpreload * chore: address PR feedback
This commit is contained in:
parent
a3b9152a9b
commit
f8ca1e46b1
142 changed files with 92 additions and 16 deletions
75
web/app/(all)/[workspaceSlug]/(projects)/drafts/header.tsx
Normal file
75
web/app/(all)/[workspaceSlug]/(projects)/drafts/header.tsx
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { PenSquare } from "lucide-react";
|
||||
import { EIssuesStoreType, EUserPermissions, EUserPermissionsLevel } from "@plane/constants";
|
||||
import { useTranslation } from "@plane/i18n";
|
||||
// ui
|
||||
import { Breadcrumbs, Button, Header } from "@plane/ui";
|
||||
// components
|
||||
import { BreadcrumbLink, CountChip } from "@/components/common";
|
||||
import { CreateUpdateIssueModal } from "@/components/issues";
|
||||
|
||||
// hooks
|
||||
import { useProject, useUserPermissions, useWorkspaceDraftIssues } from "@/hooks/store";
|
||||
|
||||
export const WorkspaceDraftHeader = observer(() => {
|
||||
// state
|
||||
const [isDraftIssueModalOpen, setIsDraftIssueModalOpen] = useState(false);
|
||||
// store hooks
|
||||
const { allowPermissions } = useUserPermissions();
|
||||
const { paginationInfo } = useWorkspaceDraftIssues();
|
||||
const { joinedProjectIds } = useProject();
|
||||
|
||||
const { t } = useTranslation();
|
||||
// check if user is authorized to create draft work item
|
||||
const isAuthorizedUser = allowPermissions(
|
||||
[EUserPermissions.ADMIN, EUserPermissions.MEMBER],
|
||||
EUserPermissionsLevel.WORKSPACE
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<CreateUpdateIssueModal
|
||||
isOpen={isDraftIssueModalOpen}
|
||||
storeType={EIssuesStoreType.WORKSPACE_DRAFT}
|
||||
onClose={() => setIsDraftIssueModalOpen(false)}
|
||||
isDraft
|
||||
/>
|
||||
<Header>
|
||||
<Header.LeftItem>
|
||||
<div className="flex items-center gap-2.5">
|
||||
<Breadcrumbs>
|
||||
<Breadcrumbs.BreadcrumbItem
|
||||
type="text"
|
||||
link={
|
||||
<BreadcrumbLink label={t("drafts")} icon={<PenSquare className="h-4 w-4 text-custom-text-300" />} />
|
||||
}
|
||||
/>
|
||||
</Breadcrumbs>
|
||||
{paginationInfo?.total_count && paginationInfo?.total_count > 0 ? (
|
||||
<CountChip count={paginationInfo?.total_count} />
|
||||
) : (
|
||||
<></>
|
||||
)}
|
||||
</div>
|
||||
</Header.LeftItem>
|
||||
|
||||
<Header.RightItem>
|
||||
{joinedProjectIds && joinedProjectIds.length > 0 && (
|
||||
<Button
|
||||
variant="primary"
|
||||
size="sm"
|
||||
className="items-center gap-1"
|
||||
onClick={() => setIsDraftIssueModalOpen(true)}
|
||||
disabled={!isAuthorizedUser}
|
||||
>
|
||||
{t("workspace_draft_issues.draft_an_issue")}
|
||||
</Button>
|
||||
)}
|
||||
</Header.RightItem>
|
||||
</Header>
|
||||
</>
|
||||
);
|
||||
});
|
||||
13
web/app/(all)/[workspaceSlug]/(projects)/drafts/layout.tsx
Normal file
13
web/app/(all)/[workspaceSlug]/(projects)/drafts/layout.tsx
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
"use client";
|
||||
|
||||
import { AppHeader, ContentWrapper } from "@/components/core";
|
||||
import { WorkspaceDraftHeader } from "./header";
|
||||
|
||||
export default function WorkspaceDraftLayout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<>
|
||||
<AppHeader header={<WorkspaceDraftHeader />} />
|
||||
<ContentWrapper>{children}</ContentWrapper>
|
||||
</>
|
||||
);
|
||||
}
|
||||
27
web/app/(all)/[workspaceSlug]/(projects)/drafts/page.tsx
Normal file
27
web/app/(all)/[workspaceSlug]/(projects)/drafts/page.tsx
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
"use client";
|
||||
|
||||
import { useParams } from "next/navigation";
|
||||
// components
|
||||
import { PageHead } from "@/components/core";
|
||||
import { WorkspaceDraftIssuesRoot } from "@/components/issues/workspace-draft";
|
||||
|
||||
const WorkspaceDraftPage = () => {
|
||||
// router
|
||||
const { workspaceSlug: routeWorkspaceSlug } = useParams();
|
||||
const pageTitle = "Workspace Draft";
|
||||
|
||||
// derived values
|
||||
const workspaceSlug = (routeWorkspaceSlug as string) || undefined;
|
||||
|
||||
if (!workspaceSlug) return null;
|
||||
return (
|
||||
<>
|
||||
<PageHead title={pageTitle} />
|
||||
<div className="relative h-full w-full overflow-hidden overflow-y-auto">
|
||||
<WorkspaceDraftIssuesRoot workspaceSlug={workspaceSlug} />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default WorkspaceDraftPage;
|
||||
Loading…
Add table
Add a link
Reference in a new issue