-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: pages layout refactor * chore: view layout refactor * chore: view layout refactor * chore: inbox layout refactor * chore: draft issue layout refactor * chore: archived issue layout refactor * chore: draft issue header layout fix * chore: layout code refactor * chore: code refactor * chore: project setting layout fix
- Loading branch information
1 parent
d7a36f5
commit 1786a39
Showing
24 changed files
with
461 additions
and
429 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { FC } from "react"; | ||
import Link from "next/link"; | ||
import { useRouter } from "next/router"; | ||
import { observer } from "mobx-react-lite"; | ||
import { Plus } from "lucide-react"; | ||
// hooks | ||
import { useMobxStore } from "lib/mobx/store-provider"; | ||
// ui | ||
import { Breadcrumbs, BreadcrumbItem, Button } from "@plane/ui"; | ||
// helper | ||
import { truncateText } from "helpers/string.helper"; | ||
|
||
export interface IPagesHeaderProps { | ||
showButton?: boolean; | ||
} | ||
|
||
export const PagesHeader: FC<IPagesHeaderProps> = observer((props) => { | ||
const { showButton = false } = props; | ||
const router = useRouter(); | ||
const { workspaceSlug, projectId } = router.query; | ||
|
||
const { project: projectStore } = useMobxStore(); | ||
|
||
const projectDetails = | ||
workspaceSlug && projectId | ||
? projectStore.getProjectById(workspaceSlug.toString(), projectId.toString()) | ||
: undefined; | ||
|
||
return ( | ||
<div className="relative flex w-full flex-shrink-0 flex-row z-10 items-center justify-between gap-x-2 gap-y-4 border-b border-custom-border-200 bg-custom-sidebar-background-100 p-4"> | ||
<div className="flex items-center gap-2 flex-grow w-full whitespace-nowrap overflow-ellipsis"> | ||
<div> | ||
<Breadcrumbs onBack={() => router.back()}> | ||
<BreadcrumbItem | ||
link={ | ||
<Link href={`/${workspaceSlug}/projects`}> | ||
<a className={`border-r-2 border-custom-sidebar-border-200 px-3 text-sm `}> | ||
<p>Projects</p> | ||
</a> | ||
</Link> | ||
} | ||
/> | ||
<BreadcrumbItem title={`${truncateText(projectDetails?.name ?? "Project", 32)} Pages`} /> | ||
</Breadcrumbs> | ||
</div> | ||
</div> | ||
{showButton && ( | ||
<div className="flex items-center gap-2"> | ||
<Button | ||
variant="primary" | ||
prependIcon={<Plus />} | ||
size="sm" | ||
onClick={() => { | ||
const e = new KeyboardEvent("keydown", { key: "d" }); | ||
document.dispatchEvent(e); | ||
}} | ||
> | ||
Create Page | ||
</Button> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { FC } from "react"; | ||
import useSWR from "swr"; | ||
import Link from "next/link"; | ||
import { useRouter } from "next/router"; | ||
import { observer } from "mobx-react-lite"; | ||
// hooks | ||
import { useMobxStore } from "lib/mobx/store-provider"; | ||
// ui | ||
import { Breadcrumbs, BreadcrumbItem } from "@plane/ui"; | ||
// helper | ||
import { truncateText } from "helpers/string.helper"; | ||
// types | ||
import { IIssue } from "types"; | ||
// constants | ||
import { ISSUE_DETAILS } from "constants/fetch-keys"; | ||
// services | ||
import { IssueArchiveService } from "services/issue"; | ||
|
||
const issueArchiveService = new IssueArchiveService(); | ||
|
||
export const ProjectArchivedIssueDetailsHeader: FC = observer(() => { | ||
const router = useRouter(); | ||
const { workspaceSlug, projectId, archivedIssueId } = router.query; | ||
|
||
const { project: projectStore } = useMobxStore(); | ||
|
||
const projectDetails = | ||
workspaceSlug && projectId | ||
? projectStore.getProjectById(workspaceSlug.toString(), projectId.toString()) | ||
: undefined; | ||
|
||
const { data: issueDetails } = useSWR<IIssue | undefined>( | ||
workspaceSlug && projectId && archivedIssueId ? ISSUE_DETAILS(archivedIssueId as string) : null, | ||
workspaceSlug && projectId && archivedIssueId | ||
? () => | ||
issueArchiveService.retrieveArchivedIssue( | ||
workspaceSlug as string, | ||
projectId as string, | ||
archivedIssueId as string | ||
) | ||
: null | ||
); | ||
|
||
return ( | ||
<div className="relative flex w-full flex-shrink-0 flex-row z-10 items-center justify-between gap-x-2 gap-y-4 border-b border-custom-border-200 bg-custom-sidebar-background-100 p-4"> | ||
<div className="flex items-center gap-2 flex-grow w-full whitespace-nowrap overflow-ellipsis"> | ||
<div> | ||
<Breadcrumbs onBack={() => router.back()}> | ||
<Link href={`/${workspaceSlug}/projects/${projectId as string}/issues`}> | ||
<a className={`border-r-2 border-custom-sidebar-border-200 px-3 text-sm `}> | ||
<p className="truncate">{`${truncateText( | ||
issueDetails?.project_detail.name ?? "Project", | ||
32 | ||
)} Issues`}</p> | ||
</a> | ||
</Link> | ||
|
||
<BreadcrumbItem title={`${truncateText(projectDetails?.name ?? "Project", 32)} Archived Issues`} /> | ||
</Breadcrumbs> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { FC } from "react"; | ||
import Link from "next/link"; | ||
import { useRouter } from "next/router"; | ||
import { observer } from "mobx-react-lite"; | ||
// hooks | ||
import { useMobxStore } from "lib/mobx/store-provider"; | ||
// ui | ||
import { Breadcrumbs, BreadcrumbItem } from "@plane/ui"; | ||
// helper | ||
import { truncateText } from "helpers/string.helper"; | ||
|
||
export const ProjectArchivedIssuesHeader: FC = observer(() => { | ||
const router = useRouter(); | ||
const { workspaceSlug, projectId } = router.query; | ||
|
||
const { project: projectStore } = useMobxStore(); | ||
|
||
const projectDetails = | ||
workspaceSlug && projectId | ||
? projectStore.getProjectById(workspaceSlug.toString(), projectId.toString()) | ||
: undefined; | ||
|
||
return ( | ||
<div className="relative flex w-full flex-shrink-0 flex-row z-10 items-center justify-between gap-x-2 gap-y-4 border-b border-custom-border-200 bg-custom-sidebar-background-100 p-4"> | ||
<div className="flex items-center gap-2 flex-grow w-full whitespace-nowrap overflow-ellipsis"> | ||
<div> | ||
<Breadcrumbs onBack={() => router.back()}> | ||
<Link href={`/${workspaceSlug}/projects`}> | ||
<a className={`border-r-2 border-custom-sidebar-border-200 px-3 text-sm `}> | ||
<p>Projects</p> | ||
</a> | ||
</Link> | ||
|
||
<BreadcrumbItem title={`${truncateText(projectDetails?.name ?? "Project", 32)} Archived Issues`} /> | ||
</Breadcrumbs> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { FC } from "react"; | ||
import Link from "next/link"; | ||
import { useRouter } from "next/router"; | ||
import { observer } from "mobx-react-lite"; | ||
// hooks | ||
import { useMobxStore } from "lib/mobx/store-provider"; | ||
// ui | ||
import { Breadcrumbs, BreadcrumbItem } from "@plane/ui"; | ||
// helper | ||
import { truncateText } from "helpers/string.helper"; | ||
|
||
export const ProjectDraftIssueHeader: FC = observer(() => { | ||
const router = useRouter(); | ||
const { workspaceSlug, projectId } = router.query; | ||
|
||
const { project: projectStore } = useMobxStore(); | ||
|
||
const projectDetails = | ||
workspaceSlug && projectId | ||
? projectStore.getProjectById(workspaceSlug.toString(), projectId.toString()) | ||
: undefined; | ||
|
||
return ( | ||
<div className="relative flex w-full flex-shrink-0 flex-row z-10 items-center justify-between gap-x-2 gap-y-4 border-b border-custom-border-200 bg-custom-sidebar-background-100 p-4"> | ||
<div className="flex items-center gap-2 flex-grow w-full whitespace-nowrap overflow-ellipsis"> | ||
<div> | ||
<Breadcrumbs onBack={() => router.back()}> | ||
<BreadcrumbItem | ||
link={ | ||
<Link href={`/${workspaceSlug}/projects`}> | ||
<a className={`border-r-2 border-custom-sidebar-border-200 px-3 text-sm `}> | ||
<p>Projects</p> | ||
</a> | ||
</Link> | ||
} | ||
/> | ||
|
||
<BreadcrumbItem title={`${truncateText(projectDetails?.name ?? "Project", 32)} Draft Issues`} /> | ||
</Breadcrumbs> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,54 @@ | ||
import { useState } from "react"; | ||
|
||
import { FC, useState } from "react"; | ||
import Link from "next/link"; | ||
import { useRouter } from "next/router"; | ||
import { observer } from "mobx-react-lite"; | ||
import { Plus } from "lucide-react"; | ||
// hooks | ||
import { useMobxStore } from "lib/mobx/store-provider"; | ||
// ui | ||
import { Breadcrumbs, BreadcrumbItem, Button } from "@plane/ui"; | ||
// components | ||
import { CreateInboxIssueModal } from "components/inbox"; | ||
// ui | ||
import { Button } from "@plane/ui"; | ||
// icons | ||
import { Plus } from "lucide-react"; | ||
// helper | ||
import { truncateText } from "helpers/string.helper"; | ||
|
||
export const ProjectInboxHeader = () => { | ||
export const ProjectInboxHeader: FC = observer(() => { | ||
const router = useRouter(); | ||
const { workspaceSlug, projectId } = router.query; | ||
const [createIssueModal, setCreateIssueModal] = useState(false); | ||
|
||
const { project: projectStore } = useMobxStore(); | ||
|
||
const projectDetails = | ||
workspaceSlug && projectId | ||
? projectStore.getProjectById(workspaceSlug.toString(), projectId.toString()) | ||
: undefined; | ||
|
||
return ( | ||
<> | ||
<CreateInboxIssueModal isOpen={createIssueModal} onClose={() => setCreateIssueModal(false)} /> | ||
<Button onClick={() => setCreateIssueModal(true)} size="sm" prependIcon={<Plus />}> | ||
Add Issue | ||
</Button> | ||
</> | ||
<div className="relative flex w-full flex-shrink-0 flex-row z-10 items-center justify-between gap-x-2 gap-y-4 border-b border-custom-border-200 bg-custom-sidebar-background-100 p-4"> | ||
<div className="flex items-center gap-2 flex-grow w-full whitespace-nowrap overflow-ellipsis"> | ||
<div> | ||
<Breadcrumbs onBack={() => router.back()}> | ||
<BreadcrumbItem | ||
link={ | ||
<Link href={`/${workspaceSlug}/projects`}> | ||
<a className={`border-r-2 border-custom-sidebar-border-200 px-3 text-sm `}> | ||
<p>Projects</p> | ||
</a> | ||
</Link> | ||
} | ||
/> | ||
<BreadcrumbItem title={`${truncateText(projectDetails?.name ?? "Project", 32)} Inbox`} /> | ||
</Breadcrumbs> | ||
</div> | ||
</div> | ||
|
||
<div className="flex items-center gap-2"> | ||
<CreateInboxIssueModal isOpen={createIssueModal} onClose={() => setCreateIssueModal(false)} /> | ||
<Button variant="primary" prependIcon={<Plus />} size="sm" onClick={() => setCreateIssueModal(true)}> | ||
Add Issue | ||
</Button> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
}); |
Oops, something went wrong.