[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:
parent
d65f0e264e
commit
171099667e
2 changed files with 3 additions and 45 deletions
|
|
@ -1,40 +1,15 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useEffect } from "react";
|
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { useSearchParams } from "next/navigation";
|
import { BarChart2 } from "lucide-react";
|
||||||
import { BarChart2, PanelRight } from "lucide-react";
|
|
||||||
// plane imports
|
// plane imports
|
||||||
import { useTranslation } from "@plane/i18n";
|
import { useTranslation } from "@plane/i18n";
|
||||||
import { Breadcrumbs, Header } from "@plane/ui";
|
import { Breadcrumbs, Header } from "@plane/ui";
|
||||||
import { cn } from "@plane/utils";
|
|
||||||
// components
|
// components
|
||||||
import { BreadcrumbLink } from "@/components/common/breadcrumb-link";
|
import { BreadcrumbLink } from "@/components/common/breadcrumb-link";
|
||||||
// hooks
|
|
||||||
import { useAppTheme } from "@/hooks/store";
|
|
||||||
|
|
||||||
export const WorkspaceAnalyticsHeader = observer(() => {
|
export const WorkspaceAnalyticsHeader = observer(() => {
|
||||||
const { t } = useTranslation();
|
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 (
|
return (
|
||||||
<Header>
|
<Header>
|
||||||
<Header.LeftItem>
|
<Header.LeftItem>
|
||||||
|
|
@ -49,23 +24,6 @@ export const WorkspaceAnalyticsHeader = observer(() => {
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</Breadcrumbs>
|
</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.LeftItem>
|
||||||
</Header>
|
</Header>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import { ProjectSelect } from "./select/project";
|
||||||
|
|
||||||
const AnalyticsFilterActions = observer(() => {
|
const AnalyticsFilterActions = observer(() => {
|
||||||
const { selectedProjects, selectedDuration, updateSelectedProjects, updateSelectedDuration } = useAnalytics();
|
const { selectedProjects, selectedDuration, updateSelectedProjects, updateSelectedDuration } = useAnalytics();
|
||||||
const { workspaceProjectIds } = useProject();
|
const { joinedProjectIds } = useProject();
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-end gap-2">
|
<div className="flex items-center justify-end gap-2">
|
||||||
<ProjectSelect
|
<ProjectSelect
|
||||||
|
|
@ -17,7 +17,7 @@ const AnalyticsFilterActions = observer(() => {
|
||||||
onChange={(val) => {
|
onChange={(val) => {
|
||||||
updateSelectedProjects(val ?? []);
|
updateSelectedProjects(val ?? []);
|
||||||
}}
|
}}
|
||||||
projectIds={workspaceProjectIds}
|
projectIds={joinedProjectIds}
|
||||||
/>
|
/>
|
||||||
{/* <DurationDropdown
|
{/* <DurationDropdown
|
||||||
buttonVariant="border-with-text"
|
buttonVariant="border-with-text"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue