chore: added sign-up/in, onboarding, dashboard, all-issues related events (#3595)
* chore: added event constants * chore: added workspace events * chore: added workspace group for events * chore: member invitation event added * chore: added project pages related events. * fix: member integer role to string * chore: added sign-up & sign-in events * chore: added global-view related events * chore: added notification related events * chore: project, cycle property change added * chore: cycle favourite, and change-properties added * chore: module davorite, and sidebar property changes added * fix: build errors * chore: all events defined in constants
This commit is contained in:
parent
8d730e6680
commit
4f72ebded9
80 changed files with 1276 additions and 507 deletions
|
|
@ -4,12 +4,14 @@ import { Dialog, Transition } from "@headlessui/react";
|
|||
import { observer } from "mobx-react-lite";
|
||||
import { AlertTriangle } from "lucide-react";
|
||||
// store hooks
|
||||
import { useGlobalView } from "hooks/store";
|
||||
import { useGlobalView, useEventTracker } from "hooks/store";
|
||||
import useToast from "hooks/use-toast";
|
||||
// ui
|
||||
import { Button } from "@plane/ui";
|
||||
// types
|
||||
import { IWorkspaceView } from "@plane/types";
|
||||
// constants
|
||||
import { GLOBAL_VIEW_DELETED } from "constants/event-tracker";
|
||||
|
||||
type Props = {
|
||||
data: IWorkspaceView;
|
||||
|
|
@ -26,6 +28,7 @@ export const DeleteGlobalViewModal: React.FC<Props> = observer((props) => {
|
|||
const { workspaceSlug } = router.query;
|
||||
// store hooks
|
||||
const { deleteGlobalView } = useGlobalView();
|
||||
const { captureEvent } = useEventTracker();
|
||||
// toast alert
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
|
|
@ -39,13 +42,23 @@ export const DeleteGlobalViewModal: React.FC<Props> = observer((props) => {
|
|||
setIsDeleteLoading(true);
|
||||
|
||||
await deleteGlobalView(workspaceSlug.toString(), data.id)
|
||||
.catch(() =>
|
||||
.then(() => {
|
||||
captureEvent(GLOBAL_VIEW_DELETED, {
|
||||
view_id: data.id,
|
||||
state: "SUCCESS",
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
captureEvent(GLOBAL_VIEW_DELETED, {
|
||||
view_id: data.id,
|
||||
state: "FAILED",
|
||||
});
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
title: "Error!",
|
||||
message: "Something went wrong while deleting the view. Please try again.",
|
||||
})
|
||||
)
|
||||
});
|
||||
})
|
||||
.finally(() => {
|
||||
setIsDeleteLoading(false);
|
||||
handleClose();
|
||||
|
|
|
|||
|
|
@ -4,11 +4,12 @@ import Link from "next/link";
|
|||
import { observer } from "mobx-react-lite";
|
||||
import { Plus } from "lucide-react";
|
||||
// store hooks
|
||||
import { useGlobalView, useUser } from "hooks/store";
|
||||
import { useEventTracker, useGlobalView, useUser } from "hooks/store";
|
||||
// components
|
||||
import { CreateUpdateWorkspaceViewModal } from "components/workspace";
|
||||
// constants
|
||||
import { DEFAULT_GLOBAL_VIEWS_LIST, EUserWorkspaceRoles } from "constants/workspace";
|
||||
import { GLOBAL_VIEW_OPENED } from "constants/event-tracker";
|
||||
|
||||
const ViewTab = observer((props: { viewId: string }) => {
|
||||
const { viewId } = props;
|
||||
|
|
@ -49,11 +50,19 @@ export const GlobalViewsHeader: React.FC = observer(() => {
|
|||
const {
|
||||
membership: { currentWorkspaceRole },
|
||||
} = useUser();
|
||||
const { captureEvent } = useEventTracker();
|
||||
|
||||
// bring the active view to the centre of the header
|
||||
useEffect(() => {
|
||||
if (!globalViewId) return;
|
||||
|
||||
captureEvent(GLOBAL_VIEW_OPENED, {
|
||||
view_id: globalViewId,
|
||||
view_type: ["all-issues", "assigned", "created", "subscribed"].includes(globalViewId.toString())
|
||||
? "Default"
|
||||
: "Custom",
|
||||
});
|
||||
|
||||
const activeTabElement = document.querySelector(`#global-view-${globalViewId.toString()}`);
|
||||
|
||||
if (activeTabElement) activeTabElement.scrollIntoView({ behavior: "smooth", inline: "center" });
|
||||
|
|
|
|||
|
|
@ -3,12 +3,14 @@ import { useRouter } from "next/router";
|
|||
import { observer } from "mobx-react-lite";
|
||||
import { Dialog, Transition } from "@headlessui/react";
|
||||
// store hooks
|
||||
import { useGlobalView } from "hooks/store";
|
||||
import { useEventTracker, useGlobalView } from "hooks/store";
|
||||
import useToast from "hooks/use-toast";
|
||||
// components
|
||||
import { WorkspaceViewForm } from "components/workspace";
|
||||
// types
|
||||
import { IWorkspaceView } from "@plane/types";
|
||||
// constants
|
||||
import { GLOBAL_VIEW_CREATED, GLOBAL_VIEW_UPDATED } from "constants/event-tracker";
|
||||
|
||||
type Props = {
|
||||
data?: IWorkspaceView;
|
||||
|
|
@ -24,6 +26,7 @@ export const CreateUpdateWorkspaceViewModal: React.FC<Props> = observer((props)
|
|||
const { workspaceSlug } = router.query;
|
||||
// store hooks
|
||||
const { createGlobalView, updateGlobalView } = useGlobalView();
|
||||
const { captureEvent } = useEventTracker();
|
||||
// toast alert
|
||||
const { setToastAlert } = useToast();
|
||||
|
||||
|
|
@ -43,6 +46,11 @@ export const CreateUpdateWorkspaceViewModal: React.FC<Props> = observer((props)
|
|||
|
||||
await createGlobalView(workspaceSlug.toString(), payloadData)
|
||||
.then((res) => {
|
||||
captureEvent(GLOBAL_VIEW_CREATED, {
|
||||
view_id: res.id,
|
||||
applied_filters: res.filters,
|
||||
state: "SUCCESS",
|
||||
});
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success!",
|
||||
|
|
@ -52,13 +60,17 @@ export const CreateUpdateWorkspaceViewModal: React.FC<Props> = observer((props)
|
|||
router.push(`/${workspaceSlug}/workspace-views/${res.id}`);
|
||||
handleClose();
|
||||
})
|
||||
.catch(() =>
|
||||
.catch(() => {
|
||||
captureEvent(GLOBAL_VIEW_CREATED, {
|
||||
applied_filters: payload?.filters,
|
||||
state: "FAILED",
|
||||
});
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
title: "Error!",
|
||||
message: "View could not be created. Please try again.",
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const handleUpdateView = async (payload: Partial<IWorkspaceView>) => {
|
||||
|
|
@ -72,7 +84,12 @@ export const CreateUpdateWorkspaceViewModal: React.FC<Props> = observer((props)
|
|||
};
|
||||
|
||||
await updateGlobalView(workspaceSlug.toString(), data.id, payloadData)
|
||||
.then(() => {
|
||||
.then((res) => {
|
||||
captureEvent(GLOBAL_VIEW_UPDATED, {
|
||||
view_id: res.id,
|
||||
applied_filters: res.filters,
|
||||
state: "SUCCESS",
|
||||
});
|
||||
setToastAlert({
|
||||
type: "success",
|
||||
title: "Success!",
|
||||
|
|
@ -80,13 +97,18 @@ export const CreateUpdateWorkspaceViewModal: React.FC<Props> = observer((props)
|
|||
});
|
||||
handleClose();
|
||||
})
|
||||
.catch(() =>
|
||||
.catch(() => {
|
||||
captureEvent(GLOBAL_VIEW_UPDATED, {
|
||||
view_id: data.id,
|
||||
applied_filters: data.filters,
|
||||
state: "FAILED",
|
||||
});
|
||||
setToastAlert({
|
||||
type: "error",
|
||||
title: "Error!",
|
||||
message: "View could not be updated. Please try again.",
|
||||
})
|
||||
);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const handleFormSubmit = async (formData: Partial<IWorkspaceView>) => {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import Link from "next/link";
|
|||
import { observer } from "mobx-react-lite";
|
||||
import { Pencil, Trash2 } from "lucide-react";
|
||||
// store hooks
|
||||
import { useGlobalView } from "hooks/store";
|
||||
import { useEventTracker, useGlobalView } from "hooks/store";
|
||||
// components
|
||||
import { CreateUpdateWorkspaceViewModal, DeleteGlobalViewModal } from "components/workspace";
|
||||
// ui
|
||||
|
|
@ -25,6 +25,7 @@ export const GlobalViewListItem: React.FC<Props> = observer((props) => {
|
|||
const { workspaceSlug } = router.query;
|
||||
// store hooks
|
||||
const { getViewDetailsById } = useGlobalView();
|
||||
const {setTrackElement} = useEventTracker();
|
||||
// derived data
|
||||
const view = getViewDetailsById(viewId);
|
||||
|
||||
|
|
@ -59,6 +60,7 @@ export const GlobalViewListItem: React.FC<Props> = observer((props) => {
|
|||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
setTrackElement("List view");
|
||||
setUpdateViewModal(true);
|
||||
}}
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue