[WEB-2917] Fix home widget (#6560)

* fix: home loading state

* fix: quickstart guide

* fix: link handling

* fix: home completed state

* fix: translations
This commit is contained in:
Akshita Goyal 2025-02-07 20:00:59 +05:30 committed by GitHub
parent c2da3ea4c8
commit 456c7f55a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 158 additions and 56 deletions

View file

@ -1,17 +1,18 @@
import { observer } from "mobx-react";
import { useParams } from "next/navigation";
import { useParams, usePathname } from "next/navigation";
// plane imports
import { useTranslation } from "@plane/i18n";
import { THomeWidgetKeys, THomeWidgetProps } from "@plane/types";
// components
import { SimpleEmptyState } from "@/components/empty-state";
// hooks
import { useProject } from "@/hooks/store";
import { useHome } from "@/hooks/store/use-home";
// plane web components
import { useResolvedAssetPath } from "@/hooks/use-resolved-asset-path";
import { HomePageHeader } from "@/plane-web/components/home/header";
import { StickiesWidget } from "../stickies";
import { RecentActivityWidget } from "./widgets";
import { HomeLoader, NoProjectsEmptyState, RecentActivityWidget } from "./widgets";
import { DashboardQuickLinks } from "./widgets/links";
import { ManageWidgetsModal } from "./widgets/manage";
@ -52,14 +53,21 @@ export const HOME_WIDGETS_LIST: {
export const DashboardWidgets = observer(() => {
// router
const { workspaceSlug } = useParams();
// navigation
const pathname = usePathname();
// store hooks
const { toggleWidgetSettings, widgetsMap, showWidgetSettings, orderedWidgets, isAnyWidgetEnabled, loading } =
useHome();
const { loader } = useProject();
// plane hooks
const { t } = useTranslation();
// store hooks
const { toggleWidgetSettings, widgetsMap, showWidgetSettings, orderedWidgets, isAnyWidgetEnabled } = useHome();
// derived values
const noWidgetsResolvedPath = useResolvedAssetPath({ basePath: "/empty-state/dashboard/widgets" });
// derived values
const isWikiApp = pathname.includes(`/${workspaceSlug.toString()}/pages`);
if (!workspaceSlug) return null;
if (loading || loader !== "loaded") return <HomeLoader />;
return (
<div className="h-full w-full relative flex flex-col gap-7">
@ -69,6 +77,8 @@ export const DashboardWidgets = observer(() => {
isModalOpen={showWidgetSettings}
handleOnClose={() => toggleWidgetSettings(false)}
/>
{!isWikiApp && <NoProjectsEmptyState />}
{isAnyWidgetEnabled ? (
<div className="flex flex-col divide-y-[1px] divide-custom-border-100">
{orderedWidgets.map((key) => {