[WEB-4339] fix: projects dropdown shows all projects (#7238)

* fix: projects drop only shows joined project

* refactor: removed unused things from header
This commit is contained in:
JayashTripathy
2025-06-19 15:57:19 +05:30
committed by GitHub
parent d65f0e264e
commit 171099667e
2 changed files with 3 additions and 45 deletions

View File

@@ -1,40 +1,15 @@
"use client";
import { useEffect } from "react";
import { observer } from "mobx-react";
import { useSearchParams } from "next/navigation";
import { BarChart2, PanelRight } from "lucide-react";
import { BarChart2 } from "lucide-react";
// plane imports
import { useTranslation } from "@plane/i18n";
import { Breadcrumbs, Header } from "@plane/ui";
import { cn } from "@plane/utils";
// components
import { BreadcrumbLink } from "@/components/common/breadcrumb-link";
// hooks
import { useAppTheme } from "@/hooks/store";
export const WorkspaceAnalyticsHeader = observer(() => {
const { t } = useTranslation();
const searchParams = useSearchParams();
const analytics_tab = searchParams.get("analytics_tab");
// store hooks
const { workspaceAnalyticsSidebarCollapsed, toggleWorkspaceAnalyticsSidebar } = useAppTheme();
useEffect(() => {
const handleToggleWorkspaceAnalyticsSidebar = () => {
if (window && window.innerWidth < 768) {
toggleWorkspaceAnalyticsSidebar(true);
}
if (window && workspaceAnalyticsSidebarCollapsed && window.innerWidth >= 768) {
toggleWorkspaceAnalyticsSidebar(false);
}
};
window.addEventListener("resize", handleToggleWorkspaceAnalyticsSidebar);
handleToggleWorkspaceAnalyticsSidebar();
return () => window.removeEventListener("resize", handleToggleWorkspaceAnalyticsSidebar);
}, [toggleWorkspaceAnalyticsSidebar, workspaceAnalyticsSidebarCollapsed]);
return (
<Header>
<Header.LeftItem>
@@ -49,23 +24,6 @@ export const WorkspaceAnalyticsHeader = observer(() => {
}
/>
</Breadcrumbs>
{analytics_tab === "custom" ? (
<button
className="block md:hidden"
onClick={() => {
toggleWorkspaceAnalyticsSidebar();
}}
>
<PanelRight
className={cn(
"block h-4 w-4 md:hidden",
!workspaceAnalyticsSidebarCollapsed ? "text-custom-primary-100" : "text-custom-text-200"
)}
/>
</button>
) : (
<></>
)}
</Header.LeftItem>
</Header>
);

View File

@@ -9,7 +9,7 @@ import { ProjectSelect } from "./select/project";
const AnalyticsFilterActions = observer(() => {
const { selectedProjects, selectedDuration, updateSelectedProjects, updateSelectedDuration } = useAnalytics();
const { workspaceProjectIds } = useProject();
const { joinedProjectIds } = useProject();
return (
<div className="flex items-center justify-end gap-2">
<ProjectSelect
@@ -17,7 +17,7 @@ const AnalyticsFilterActions = observer(() => {
onChange={(val) => {
updateSelectedProjects(val ?? []);
}}
projectIds={workspaceProjectIds}
projectIds={joinedProjectIds}
/>
{/* <DurationDropdown
buttonVariant="border-with-text"