mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: module empty state (#4004)
This commit is contained in:
parent
180f1d74e8
commit
054dd2bb7d
@ -10,6 +10,7 @@ import { CycleModuleBoardLayout, CycleModuleListLayout, GanttLayoutLoader } from
|
|||||||
// assets
|
// assets
|
||||||
// constants
|
// constants
|
||||||
import { EmptyStateType } from "@/constants/empty-state";
|
import { EmptyStateType } from "@/constants/empty-state";
|
||||||
|
import { calculateTotalFilters } from "@/helpers/filter.helper";
|
||||||
import { useApplication, useEventTracker, useModule, useModuleFilter } from "@/hooks/store";
|
import { useApplication, useEventTracker, useModule, useModuleFilter } from "@/hooks/store";
|
||||||
import AllFiltersImage from "public/empty-state/module/all-filters.svg";
|
import AllFiltersImage from "public/empty-state/module/all-filters.svg";
|
||||||
import NameFilterImage from "public/empty-state/module/name-filter.svg";
|
import NameFilterImage from "public/empty-state/module/name-filter.svg";
|
||||||
@ -22,10 +23,12 @@ export const ModulesListView: React.FC = observer(() => {
|
|||||||
const { commandPalette: commandPaletteStore } = useApplication();
|
const { commandPalette: commandPaletteStore } = useApplication();
|
||||||
const { setTrackElement } = useEventTracker();
|
const { setTrackElement } = useEventTracker();
|
||||||
const { getFilteredModuleIds, loader } = useModule();
|
const { getFilteredModuleIds, loader } = useModule();
|
||||||
const { currentProjectDisplayFilters: displayFilters, searchQuery } = useModuleFilter();
|
const { currentProjectDisplayFilters: displayFilters, searchQuery, currentProjectFilters } = useModuleFilter();
|
||||||
// derived values
|
// derived values
|
||||||
const filteredModuleIds = projectId ? getFilteredModuleIds(projectId.toString()) : undefined;
|
const filteredModuleIds = projectId ? getFilteredModuleIds(projectId.toString()) : undefined;
|
||||||
|
|
||||||
|
const totalFilters = calculateTotalFilters(currentProjectFilters ?? {});
|
||||||
|
|
||||||
if (loader || !filteredModuleIds)
|
if (loader || !filteredModuleIds)
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -35,7 +38,7 @@ export const ModulesListView: React.FC = observer(() => {
|
|||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
if (filteredModuleIds.length === 0)
|
if (totalFilters > 0 || searchQuery.trim() !== "")
|
||||||
return (
|
return (
|
||||||
<div className="h-full w-full grid place-items-center">
|
<div className="h-full w-full grid place-items-center">
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
|
Loading…
Reference in New Issue
Block a user