Skip to content

Commit

Permalink
subcollectionid added in subtable config
Browse files Browse the repository at this point in the history
  • Loading branch information
hrutik7 committed Aug 16, 2023
1 parent ad6ebaa commit d703f9e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
32 changes: 23 additions & 9 deletions src/components/fields/SubTable/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { useAtom } from "jotai";
import { ISettingsProps } from "@src/components/fields/types";

import { useState } from "react";
import MultiSelect from "@rowy/multiselect";
import { FieldType } from "@src/constants/fields";

import { TextField } from "@mui/material";
import { tableScope, tableColumnsOrderedAtom } from "@src/atoms/tableScope";

const Settings = ({ config, onChange }: ISettingsProps) => {
const [tableOrderedColumns] = useAtom(tableColumnsOrderedAtom, tableScope);

const [inputValue, setInputValue] = useState("");
const columnOptions = tableOrderedColumns
.filter((column) =>
[
Expand All @@ -21,12 +21,26 @@ const Settings = ({ config, onChange }: ISettingsProps) => {
.map((c) => ({ label: c.name, value: c.key }));

return (
<MultiSelect
label="Parent label"
options={columnOptions}
value={config.parentLabel ?? []}
onChange={onChange("parentLabel")}
/>
<>
<MultiSelect
label="Parent label"
options={columnOptions}
value={config.parentLabel ?? []}
onChange={onChange("parentLabel")}
/>

<TextField
id="subcollectionid"
value={inputValue}
onChange={(e) =>
{ onChange("subcollectionid")(e.target.value)
setInputValue(e.target.value)}
}
label="Subcollection ID"
className="labelVertical"
inputProps={{ style: { width: "23ch" } }}
/>
</>
);
};
export default Settings;
2 changes: 1 addition & 1 deletion src/components/fields/SubTable/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const useSubTableData = (
rootTablePath,
ROUTES.subTable,
encodeURIComponent(_rowy_ref.path),
column.config?.parentLabel![0],
column.key
].join("/");

subTablePath += "?parentLabel=" + encodeURIComponent(label ?? "");
Expand Down

0 comments on commit d703f9e

Please sign in to comment.