add delete_column, delete_table analytics events

This commit is contained in:
Sidney Alcantara
2022-03-14 16:12:04 +11:00
parent 7a140a86f0
commit ae59d35a79
2 changed files with 10 additions and 5 deletions

View File

@@ -37,6 +37,7 @@ import { getFieldProp } from "@src/components/fields";
import { Column } from "react-data-grid";
import { PopoverProps } from "@mui/material";
import { useConfirmation } from "@src/components/ConfirmationDialog";
import { analytics } from "@src/analytics";
const INITIAL_MODAL = { type: "", data: {} };
@@ -290,6 +291,7 @@ export default function ColumnMenu() {
confirmColor: "error",
handleConfirm: () => {
actions.remove(column.key);
await analytics.logEvent("delete_column", { type: column.type });
handleClose();
},
}),

View File

@@ -9,6 +9,7 @@ import Confirmation from "@src/components/Confirmation";
import { Table } from "@src/contexts/ProjectContext";
import { routes } from "@src/constants/routes";
import { db } from "@src/firebase";
import { analytics } from "@src/analytics";
import {
SETTINGS,
TABLE_SCHEMAS,
@@ -40,13 +41,15 @@ export default function DeleteMenu({ clearDialog, data }: IDeleteMenuProps) {
(table) => table.id !== data?.id || table.tableType !== data?.tableType
);
tablesDocRef.update({ tables: updatedTables });
db.collection(
data?.tableType === "primaryCollection"
? TABLE_SCHEMAS
: TABLE_GROUP_SCHEMAS
)
await db
.collection(
data?.tableType === "primaryCollection"
? TABLE_SCHEMAS
: TABLE_GROUP_SCHEMAS
)
.doc(data?.id)
.delete();
await analytics.logEvent("delete_table");
clearDialog();
history.push(routes.home);
};