Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 1 addition & 43 deletions web/app/(all)/[workspaceSlug]/(projects)/analytics/header.tsx
Original file line number Diff line number Diff line change
@@ -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>
Expand All @@ -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>
);
Expand Down
4 changes: 2 additions & 2 deletions web/core/components/analytics/analytics-filter-actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ 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
value={selectedProjects}
onChange={(val) => {
updateSelectedProjects(val ?? []);
}}
projectIds={workspaceProjectIds}
projectIds={joinedProjectIds}
/>
{/* <DurationDropdown
buttonVariant="border-with-text"
Expand Down