diff --git a/web/components/issues/issue-layouts/empty-states/global-view.tsx b/web/components/issues/issue-layouts/empty-states/global-view.tsx index 7151b5ddc..bbe5f16a5 100644 --- a/web/components/issues/issue-layouts/empty-states/global-view.tsx +++ b/web/components/issues/issue-layouts/empty-states/global-view.tsx @@ -1,27 +1,49 @@ +// next +import { useRouter } from "next/router"; import { observer } from "mobx-react-lite"; -import { PlusIcon } from "lucide-react"; // mobx store import { useMobxStore } from "lib/mobx/store-provider"; // components import { EmptyState } from "components/common"; // assets import emptyIssue from "public/empty-state/issue.svg"; +import emptyProject from "public/empty-state/project.svg"; +// icons +import { Plus, PlusIcon } from "lucide-react"; export const GlobalViewEmptyState: React.FC = observer(() => { - const { commandPalette: commandPaletteStore } = useMobxStore(); + const router = useRouter(); + const { workspaceSlug } = router.query; + + const { commandPalette: commandPaletteStore, project: projectStore } = useMobxStore(); + + const projects = workspaceSlug ? projectStore.projects[workspaceSlug.toString()] : null; return (
- , - onClick: () => commandPaletteStore.toggleCreateIssueModal(true), - }} - /> + {!projects || projects?.length === 0 ? ( + , + text: "New Project", + onClick: () => commandPaletteStore.toggleCreateProjectModal(true), + }} + /> + ) : ( + , + onClick: () => commandPaletteStore.toggleCreateIssueModal(true), + }} + /> + )}
); }); diff --git a/web/components/issues/issue-layouts/roots/global-view-layout-root.tsx b/web/components/issues/issue-layouts/roots/global-view-layout-root.tsx index 018a63d2a..345a33db3 100644 --- a/web/components/issues/issue-layouts/roots/global-view-layout-root.tsx +++ b/web/components/issues/issue-layouts/roots/global-view-layout-root.tsx @@ -28,12 +28,15 @@ export const GlobalViewLayoutRoot: React.FC = observer((props) => { workspaceFilter: workspaceFilterStore, workspace: workspaceStore, issueDetail: issueDetailStore, + project: projectStore, } = useMobxStore(); const viewDetails = globalViewId ? globalViewsStore.globalViewDetails[globalViewId.toString()] : undefined; const storedFilters = globalViewId ? globalViewFiltersStore.storedFilters[globalViewId.toString()] : undefined; + const projects = workspaceSlug ? projectStore.projects[workspaceSlug.toString()] : null; + useSWR( workspaceSlug && globalViewId && viewDetails ? `GLOBAL_VIEW_ISSUES_${globalViewId.toString()}` : null, workspaceSlug && globalViewId && viewDetails @@ -94,7 +97,7 @@ export const GlobalViewLayoutRoot: React.FC = observer((props) => { return (
- {issues?.length === 0 ? ( + {issues?.length === 0 || !projects || projects?.length === 0 ? ( ) : (