mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
fix: module conflicts
This commit is contained in:
parent
63b6bfd6e0
commit
87f56f8ba4
@ -11,7 +11,7 @@ import { Avatar, AvatarGroup, Tooltip, setPromiseToast } from "@plane/ui";
|
|||||||
import { FavoriteStar } from "@/components/core";
|
import { FavoriteStar } from "@/components/core";
|
||||||
import { ModuleQuickActions } from "@/components/modules";
|
import { ModuleQuickActions } from "@/components/modules";
|
||||||
// constants
|
// constants
|
||||||
import { MODULE_FAVORITED, MODULE_UNFAVORITED } from "@/constants/event-tracker";
|
import { E_MODULES, MODULE_FAVORITED, MODULE_UNFAVORITED } from "@/constants/event-tracker";
|
||||||
import { MODULE_STATUS } from "@/constants/module";
|
import { MODULE_STATUS } from "@/constants/module";
|
||||||
import { EUserProjectRoles } from "@/constants/project";
|
import { EUserProjectRoles } from "@/constants/project";
|
||||||
// helpers
|
// helpers
|
||||||
@ -60,7 +60,7 @@ export const ModuleListItemAction: FC<Props> = observer((props) => {
|
|||||||
() => {
|
() => {
|
||||||
captureEvent(MODULE_FAVORITED, {
|
captureEvent(MODULE_FAVORITED, {
|
||||||
module_id: moduleId,
|
module_id: moduleId,
|
||||||
element: "Grid layout",
|
element: E_MODULES,
|
||||||
state: "SUCCESS",
|
state: "SUCCESS",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ export const ModuleListItemAction: FC<Props> = observer((props) => {
|
|||||||
).then(() => {
|
).then(() => {
|
||||||
captureEvent(MODULE_UNFAVORITED, {
|
captureEvent(MODULE_UNFAVORITED, {
|
||||||
module_id: moduleId,
|
module_id: moduleId,
|
||||||
element: "Grid layout",
|
element: E_MODULES,
|
||||||
state: "SUCCESS",
|
state: "SUCCESS",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -11,9 +11,15 @@ import { Tooltip } from "@plane/ui";
|
|||||||
import { FiltersDropdown } from "@/components/issues";
|
import { FiltersDropdown } from "@/components/issues";
|
||||||
import { ModuleFiltersSelection, ModuleOrderByDropdown } from "@/components/modules/dropdowns";
|
import { ModuleFiltersSelection, ModuleOrderByDropdown } from "@/components/modules/dropdowns";
|
||||||
// constants
|
// constants
|
||||||
|
import {
|
||||||
|
MODULES_FILTER_APPLIED,
|
||||||
|
MODULES_FILTER_REMOVED,
|
||||||
|
MODULES_LAYOUT_CHANGED,
|
||||||
|
MODULES_SORT_UPDATED,
|
||||||
|
} from "@/constants/event-tracker";
|
||||||
import { MODULE_VIEW_LAYOUTS } from "@/constants/module";
|
import { MODULE_VIEW_LAYOUTS } from "@/constants/module";
|
||||||
// hooks
|
// hooks
|
||||||
import { useMember, useModuleFilter } from "@/hooks/store";
|
import { useEventTracker, useMember, useModuleFilter } from "@/hooks/store";
|
||||||
import useOutsideClickDetector from "@/hooks/use-outside-click-detector";
|
import useOutsideClickDetector from "@/hooks/use-outside-click-detector";
|
||||||
import { usePlatformOS } from "@/hooks/use-platform-os";
|
import { usePlatformOS } from "@/hooks/use-platform-os";
|
||||||
|
|
||||||
@ -27,6 +33,7 @@ export const ModuleViewHeader: FC = observer(() => {
|
|||||||
|
|
||||||
// hooks
|
// hooks
|
||||||
const { isMobile } = usePlatformOS();
|
const { isMobile } = usePlatformOS();
|
||||||
|
const { captureEvent } = useEventTracker();
|
||||||
|
|
||||||
// store hooks
|
// store hooks
|
||||||
const {
|
const {
|
||||||
@ -48,7 +55,7 @@ export const ModuleViewHeader: FC = observer(() => {
|
|||||||
const handleFilters = useCallback(
|
const handleFilters = useCallback(
|
||||||
(key: keyof TModuleFilters, value: string | string[]) => {
|
(key: keyof TModuleFilters, value: string | string[]) => {
|
||||||
if (!projectId) return;
|
if (!projectId) return;
|
||||||
const newValues = filters?.[key] ?? [];
|
const newValues = Array.from(filters?.[key] ?? []);
|
||||||
|
|
||||||
if (Array.isArray(value))
|
if (Array.isArray(value))
|
||||||
value.forEach((val) => {
|
value.forEach((val) => {
|
||||||
@ -59,10 +66,14 @@ export const ModuleViewHeader: FC = observer(() => {
|
|||||||
if (filters?.[key]?.includes(value)) newValues.splice(newValues.indexOf(value), 1);
|
if (filters?.[key]?.includes(value)) newValues.splice(newValues.indexOf(value), 1);
|
||||||
else newValues.push(value);
|
else newValues.push(value);
|
||||||
}
|
}
|
||||||
|
captureEvent((filters?.[key] ?? []).length > newValues.length ? MODULES_FILTER_REMOVED : MODULES_FILTER_APPLIED, {
|
||||||
|
filter_type: key,
|
||||||
|
filter_property: value,
|
||||||
|
current_filters: filters,
|
||||||
|
});
|
||||||
updateFilters(projectId.toString(), { [key]: newValues });
|
updateFilters(projectId.toString(), { [key]: newValues });
|
||||||
},
|
},
|
||||||
[filters, projectId, updateFilters]
|
[filters, projectId, updateFilters, captureEvent]
|
||||||
);
|
);
|
||||||
|
|
||||||
const handleInputKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
const handleInputKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
@ -128,11 +139,19 @@ export const ModuleViewHeader: FC = observer(() => {
|
|||||||
|
|
||||||
<ModuleOrderByDropdown
|
<ModuleOrderByDropdown
|
||||||
value={displayFilters?.order_by}
|
value={displayFilters?.order_by}
|
||||||
onChange={(val) => {
|
onChange={(property, val) => {
|
||||||
if (!projectId || val === displayFilters?.order_by) return;
|
if (!projectId || val === displayFilters?.order_by) return;
|
||||||
updateDisplayFilters(projectId.toString(), {
|
updateDisplayFilters(projectId.toString(), {
|
||||||
order_by: val,
|
order_by: val,
|
||||||
});
|
});
|
||||||
|
captureEvent(MODULES_SORT_UPDATED, {
|
||||||
|
changed_property: property,
|
||||||
|
change_details: val.replaceAll("-", ""),
|
||||||
|
current_sort: {
|
||||||
|
order_by: displayFilters?.order_by?.replaceAll("-", ""),
|
||||||
|
sort_by: displayFilters?.order_by?.startsWith("-") ? "desc" : "asc",
|
||||||
|
},
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<FiltersDropdown icon={<ListFilter className="h-3 w-3" />} title="Filters" placement="bottom-end">
|
<FiltersDropdown icon={<ListFilter className="h-3 w-3" />} title="Filters" placement="bottom-end">
|
||||||
@ -142,6 +161,11 @@ export const ModuleViewHeader: FC = observer(() => {
|
|||||||
handleDisplayFiltersUpdate={(val) => {
|
handleDisplayFiltersUpdate={(val) => {
|
||||||
if (!projectId) return;
|
if (!projectId) return;
|
||||||
updateDisplayFilters(projectId.toString(), val);
|
updateDisplayFilters(projectId.toString(), val);
|
||||||
|
captureEvent(!val.favorites ? MODULES_FILTER_REMOVED : MODULES_FILTER_APPLIED, {
|
||||||
|
filter_type: "favorites",
|
||||||
|
filter_property: val.favorites,
|
||||||
|
current_filters: filters,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
handleFiltersUpdate={handleFilters}
|
handleFiltersUpdate={handleFilters}
|
||||||
memberIds={workspaceMemberIds ?? undefined}
|
memberIds={workspaceMemberIds ?? undefined}
|
||||||
@ -161,6 +185,9 @@ export const ModuleViewHeader: FC = observer(() => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!projectId) return;
|
if (!projectId) return;
|
||||||
updateDisplayFilters(projectId.toString(), { layout: layout.key });
|
updateDisplayFilters(projectId.toString(), { layout: layout.key });
|
||||||
|
captureEvent(MODULES_LAYOUT_CHANGED, {
|
||||||
|
layout: layout.key,
|
||||||
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<layout.icon
|
<layout.icon
|
||||||
|
Loading…
Reference in New Issue
Block a user