diff --git a/src/components/Navigation/NavTableSection.tsx b/src/components/Navigation/NavTableSection.tsx
index 50e5c988..5a9dd873 100644
--- a/src/components/Navigation/NavTableSection.tsx
+++ b/src/components/Navigation/NavTableSection.tsx
@@ -49,9 +49,10 @@ export default function NavDrawerItem({
{tables
.filter((x) => x)
.map((table) => {
- const route = table.isCollectionGroup
- ? `${routes.tableGroup}/${table.id}`
- : `${routes.table}/${table.id.replace(/\//g, "~2F")}`;
+ const route =
+ table.tableType === "collectionGroup"
+ ? `${routes.tableGroup}/${table.id}`
+ : `${routes.table}/${table.id.replace(/\//g, "~2F")}`;
return (
diff --git a/src/components/Table/Settings/Webhooks.tsx b/src/components/Table/Settings/Webhooks.tsx
index f8fd8bc1..a7bc76bb 100644
--- a/src/components/Table/Settings/Webhooks.tsx
+++ b/src/components/Table/Settings/Webhooks.tsx
@@ -122,12 +122,9 @@ export default function WebhooksDialog({ open, handleClose }) {
label={"Enable webhooks for this table"}
labelPlacement="end"
checked={state.enabled}
- onChange={
- () => {
- handleChange("enabled")(!state.enabled);
- }
- // handleChange("isCollectionGroup", !formState.isCollectionGroup)
- }
+ onChange={() => {
+ handleChange("enabled")(!state.enabled);
+ }}
// classes={{ root: classes.formControlLabel, label: classes.label }}
/>
Webhook Type
diff --git a/src/components/TableSettings/index.tsx b/src/components/TableSettings/index.tsx
index e07995a7..14ec015f 100644
--- a/src/components/TableSettings/index.tsx
+++ b/src/components/TableSettings/index.tsx
@@ -32,7 +32,6 @@ const FORM_EMPTY_STATE = {
collection: "",
section: "",
description: "",
- isCollectionGroup: false,
roles: ["ADMIN"],
};
@@ -92,7 +91,6 @@ export default function TableSettingsDialog({
const handleSubmit = async (values) => {
const data: any = {
...values,
- isCollectionGroup: values.tableType === "collectionGroup",
};
if (values.schemaSource)
@@ -132,13 +130,15 @@ export default function TableSettingsDialog({
const tablesDocRef = db.doc(SETTINGS);
const tableData = (await tablesDocRef.get()).data();
const updatedTables = tableData?.tables.filter(
- (table) =>
- table.id !== data?.id ||
- table.isCollectionGroup !== data?.isCollectionGroup
+ (table) => table.id !== data?.id || table.tableType !== data?.tableType
);
await tablesDocRef.update({ tables: updatedTables });
await db
- .collection(data?.isCollectionGroup ? TABLE_SCHEMAS : TABLE_GROUP_SCHEMAS)
+ .collection(
+ data?.tableType === "primaryCollection"
+ ? TABLE_SCHEMAS
+ : TABLE_GROUP_SCHEMAS
+ )
.doc(data?.id)
.delete();
window.location.reload();
@@ -160,9 +160,6 @@ export default function TableSettingsDialog({
tables?.map((table) => ({ label: table.name, value: table.id }))
)}
values={{
- tableType: data?.isCollectionGroup
- ? "collectionGroup"
- : "primaryCollection",
...data,
}}
onSubmit={handleSubmit}
diff --git a/src/contexts/ProjectContext.tsx b/src/contexts/ProjectContext.tsx
index 69561493..6200a029 100644
--- a/src/contexts/ProjectContext.tsx
+++ b/src/contexts/ProjectContext.tsx
@@ -20,8 +20,7 @@ export type Table = {
roles: string[];
description: string;
section: string;
- isCollectionGroup: boolean;
- tableType: string;
+ tableType: "primaryCollection" | "collectionGroup";
};
interface IProjectContext {
diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx
index ed7f2d7d..9a8d0b65 100644
--- a/src/pages/Home.tsx
+++ b/src/pages/Home.tsx
@@ -151,7 +151,7 @@ export default function HomePage() {
const getLink = (table: Table) =>
`${
- table.isCollectionGroup ? routes.tableGroup : routes.table
+ table.tableType === "primaryCollection" ? routes.table : routes.tableGroup
}/${table.id.replace(/\//g, "~2F")}`;
const handleFavorite = (id: string) => (e: ChangeEvent) => {