-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[WEB-2846] feat: home integrations #6321
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
15ff3ee
wip
gakshita ae89bed
chore: wip
gakshita 8b43497
Merge branch 'preview' of https://github.com/makeplane/plane into fea…
gakshita 1c020f0
Merge branch 'preview' of https://github.com/makeplane/plane into fea…
gakshita c2412bb
fix: preserved old component
gakshita 2254d50
fix
gakshita a031765
fix: seperate route added
gakshita 0d564e6
fix
gakshita 0263021
Merge branch 'preview' of https://github.com/makeplane/plane into fea…
gakshita bba8436
Only return user ID of project members
sangeethailango 99d9702
Return issue ID
sangeethailango ff29170
fix: recents api integrations
gakshita fb9c364
fix: types
gakshita 5a1c521
fix: types
gakshita 314f714
fix: added tooltips
gakshita afa330e
chore: added apis
gakshita db6e569
Merge branch 'preview' into feat-home-integrations
NarayanBavisetti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,76 @@ | ||
| import { TLogoProps } from "./common"; | ||
| import { TIssuePriorities } from "./issues"; | ||
|
|
||
| export type TRecentActivityFilterKeys = "all item" | "issue" | "page" | "project"; | ||
| export type THomeWidgetKeys = "quick_links" | "recent_activity" | "stickies"; | ||
|
|
||
| export type THomeWidgetProps = { | ||
| workspaceSlug: string; | ||
| }; | ||
|
|
||
| export type TPageEntityData = { | ||
| id: string; | ||
| name: string; | ||
| logo_props: TLogoProps; | ||
| project_id: string; | ||
| owned_by: string; | ||
| project_identifier: string; | ||
| }; | ||
|
|
||
| export type TProjectEntityData = { | ||
| id: string; | ||
| name: string; | ||
| logo_props: TLogoProps; | ||
| project_members: string[]; | ||
| identifier: string; | ||
| }; | ||
|
|
||
| export type TIssueEntityData = { | ||
| id: string; | ||
| name: string; | ||
| state: string; | ||
| priority: TIssuePriorities; | ||
| assignees: string[]; | ||
| type: string | null; | ||
| sequence_id: number; | ||
| project_id: string; | ||
| project_identifier: string; | ||
| }; | ||
|
|
||
| export type TActivityEntityData = { | ||
| id: string; | ||
| entity_name: "page" | "project" | "issue"; | ||
| entity_identifier: string; | ||
| visited_at: string; | ||
| entity_data: TPageEntityData | TProjectEntityData | TIssueEntityData; | ||
| }; | ||
|
|
||
| export type TLinkEditableFields = { | ||
| title: string; | ||
| url: string; | ||
| }; | ||
|
|
||
| export type TLink = TLinkEditableFields & { | ||
| created_by_id: string; | ||
| id: string; | ||
| metadata: any; | ||
| workspace_slug: string; | ||
|
|
||
| //need | ||
| created_at: Date; | ||
| }; | ||
|
|
||
| export type TLinkMap = { | ||
| [workspace_slug: string]: TLink; | ||
| }; | ||
|
|
||
| export type TLinkIdMap = { | ||
| [workspace_slug: string]: string[]; | ||
| }; | ||
|
|
||
| export type TWidgetEntityData = { | ||
| key: string; | ||
| name: string; | ||
| is_enabled: boolean; | ||
| sort_order: number; | ||
| }; | ||
This file contains hidden or 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 hidden or 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,60 @@ | ||
| "use client"; | ||
|
|
||
| import Image from "next/image"; | ||
| import { useTheme } from "next-themes"; | ||
| import { Home } from "lucide-react"; | ||
| // images | ||
| import githubBlackImage from "/public/logos/github-black.png"; | ||
| import githubWhiteImage from "/public/logos/github-white.png"; | ||
| // ui | ||
| import { Breadcrumbs, Header } from "@plane/ui"; | ||
| // components | ||
| import { BreadcrumbLink } from "@/components/common"; | ||
| // constants | ||
| import { GITHUB_REDIRECTED } from "@/constants/event-tracker"; | ||
| // hooks | ||
| import { useEventTracker } from "@/hooks/store"; | ||
|
|
||
| export const WorkspaceDashboardHeader = () => { | ||
| // hooks | ||
| const { captureEvent } = useEventTracker(); | ||
| const { resolvedTheme } = useTheme(); | ||
|
|
||
| return ( | ||
| <> | ||
| <Header> | ||
| <Header.LeftItem> | ||
| <div> | ||
| <Breadcrumbs> | ||
| <Breadcrumbs.BreadcrumbItem | ||
| type="text" | ||
| link={<BreadcrumbLink label="Home" icon={<Home className="h-4 w-4 text-custom-text-300" />} />} | ||
| /> | ||
| </Breadcrumbs> | ||
| </div> | ||
| </Header.LeftItem> | ||
| <Header.RightItem> | ||
| <a | ||
| onClick={() => | ||
| captureEvent(GITHUB_REDIRECTED, { | ||
| element: "navbar", | ||
| }) | ||
| } | ||
| className="flex flex-shrink-0 items-center gap-1.5 rounded bg-custom-background-80 px-3 py-1.5" | ||
| href="https://github.com/makeplane/plane" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| > | ||
| <Image | ||
| src={resolvedTheme === "dark" ? githubWhiteImage : githubBlackImage} | ||
| height={16} | ||
| width={16} | ||
| alt="GitHub Logo" | ||
| /> | ||
| <span className="hidden text-xs font-medium sm:hidden md:block">Star us on GitHub</span> | ||
| </a> | ||
| </Header.RightItem> | ||
| </Header> | ||
| </> | ||
| ); | ||
| }; |
This file contains hidden or 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,28 @@ | ||
| "use client"; | ||
|
|
||
| import { observer } from "mobx-react"; | ||
| // components | ||
| import { PageHead, AppHeader, ContentWrapper } from "@/components/core"; | ||
| // hooks | ||
| import { WorkspaceHomeView } from "@/components/home"; | ||
| import { useWorkspace } from "@/hooks/store"; | ||
| // local components | ||
| import { WorkspaceDashboardHeader } from "../header"; | ||
|
|
||
| const WorkspaceDashboardPage = observer(() => { | ||
| const { currentWorkspace } = useWorkspace(); | ||
| // derived values | ||
| const pageTitle = currentWorkspace?.name ? `${currentWorkspace?.name} - Home` : undefined; | ||
|
|
||
| return ( | ||
| <> | ||
| <AppHeader header={<WorkspaceDashboardHeader />} /> | ||
| <ContentWrapper> | ||
| <PageHead title={pageTitle} /> | ||
| <WorkspaceHomeView /> | ||
| </ContentWrapper> | ||
| </> | ||
| ); | ||
| }); | ||
|
|
||
| export default WorkspaceDashboardPage; |
This file contains hidden or 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 @@ | ||
| export const HomePageHeader = () => <></>; |
This file contains hidden or 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 @@ | ||
| export * from "./widget"; |
This file contains hidden or 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 @@ | ||
| export const StickiesWidget = () => <></>; |
This file contains hidden or 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 hidden or 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,51 @@ | ||
| import { observer } from "mobx-react"; | ||
| import { useParams } from "next/navigation"; | ||
| // types | ||
| import { THomeWidgetKeys, THomeWidgetProps } from "@plane/types"; | ||
| // hooks | ||
| import { useHome } from "@/hooks/store/use-home"; | ||
| // components | ||
| import { HomePageHeader } from "@/plane-web/components/home/header"; | ||
| import { StickiesWidget } from "@/plane-web/components/stickies"; | ||
| import { RecentActivityWidget } from "./widgets"; | ||
| import { DashboardQuickLinks } from "./widgets/links"; | ||
| import { ManageWidgetsModal } from "./widgets/manage"; | ||
|
|
||
| const WIDGETS_LIST: { | ||
| [key in THomeWidgetKeys]: { component: React.FC<THomeWidgetProps>; fullWidth: boolean }; | ||
| } = { | ||
| quick_links: { component: DashboardQuickLinks, fullWidth: false }, | ||
| recent_activity: { component: RecentActivityWidget, fullWidth: false }, | ||
| stickies: { component: StickiesWidget, fullWidth: false }, | ||
| }; | ||
|
|
||
| export const DashboardWidgets = observer(() => { | ||
| // router | ||
| const { workspaceSlug } = useParams(); | ||
| // store hooks | ||
| const { toggleWidgetSettings, showWidgetSettings } = useHome(); | ||
|
|
||
| if (!workspaceSlug) return null; | ||
|
|
||
| return ( | ||
| <div className="relative flex flex-col gap-7"> | ||
| <HomePageHeader /> | ||
| <ManageWidgetsModal | ||
| workspaceSlug={workspaceSlug.toString()} | ||
| isModalOpen={showWidgetSettings} | ||
| handleOnClose={() => toggleWidgetSettings(false)} | ||
| /> | ||
|
|
||
| {Object.entries(WIDGETS_LIST).map(([key, widget]) => { | ||
| const WidgetComponent = widget.component; | ||
| if (widget.fullWidth) | ||
| return ( | ||
| <div key={key} className="lg:col-span-2"> | ||
| <WidgetComponent workspaceSlug={workspaceSlug.toString()} /> | ||
| </div> | ||
| ); | ||
| else return <WidgetComponent key={key} workspaceSlug={workspaceSlug.toString()} />; | ||
| })} | ||
| </div> | ||
| ); | ||
| }); |
This file contains hidden or 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,4 @@ | ||
| export * from "./widgets"; | ||
| export * from "./home-dashboard-widgets"; | ||
| export * from "./project-empty-state"; | ||
| export * from "./root"; |
This file contains hidden or 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,46 @@ | ||
| "use client"; | ||
|
|
||
| import { observer } from "mobx-react"; | ||
| import Image from "next/image"; | ||
| // ui | ||
| import { Button } from "@plane/ui"; | ||
| // hooks | ||
| import { useCommandPalette, useEventTracker, useUserPermissions } from "@/hooks/store"; | ||
| import { EUserPermissions, EUserPermissionsLevel } from "@/plane-web/constants/user-permissions"; | ||
| // assets | ||
| import ProjectEmptyStateImage from "@/public/empty-state/onboarding/dashboard-light.webp"; | ||
|
|
||
| export const DashboardProjectEmptyState = observer(() => { | ||
| // store hooks | ||
| const { toggleCreateProjectModal } = useCommandPalette(); | ||
| const { setTrackElement } = useEventTracker(); | ||
| const { allowPermissions } = useUserPermissions(); | ||
|
|
||
| // derived values | ||
| const canCreateProject = allowPermissions([EUserPermissions.ADMIN], EUserPermissionsLevel.WORKSPACE); | ||
|
|
||
| return ( | ||
| <div className="mx-auto flex h-full flex-col justify-center space-y-4 lg:w-3/5"> | ||
| <h4 className="text-xl font-semibold">Overview of your projects, activity, and metrics</h4> | ||
| <p className="text-custom-text-300"> | ||
| Welcome to Plane, we are excited to have you here. Create your first project and track your issues, and this | ||
| page will transform into a space that helps you progress. Admins will also see items which help their team | ||
| progress. | ||
| </p> | ||
| <Image src={ProjectEmptyStateImage} className="w-full" alt="Project empty state" /> | ||
| {canCreateProject && ( | ||
| <div className="flex justify-center"> | ||
| <Button | ||
| variant="primary" | ||
| onClick={() => { | ||
| setTrackElement("Project empty state"); | ||
| toggleCreateProjectModal(true); | ||
| }} | ||
| > | ||
| Build your first project | ||
| </Button> | ||
| </div> | ||
| )} | ||
| </div> | ||
| ); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Revisit the
"all item"literal.The union type
"all item"is potentially ambiguous or unintentional. Consider renaming to"all"or"all_items"to improve clarity and avoid confusion when filtering recent activities.