diff --git a/ROADMAP.md b/ROADMAP.md
index 7672048a..4d8fc760 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -1,6 +1,6 @@
# Firetable Roadmap
-## POC
+## POC ✅
### Initial fields:
@@ -10,7 +10,7 @@
- phone(string) ✅
- url(string) ✅
- Number(number) ✅
-- long text(string)
+- long text(string) ✅
### Functionality:
diff --git a/src/components/Fields/File.tsx b/src/components/Fields/File.tsx
index f86073ba..5b3df5e8 100644
--- a/src/components/Fields/File.tsx
+++ b/src/components/Fields/File.tsx
@@ -4,12 +4,7 @@ import useUploader from "../../hooks/useFiretable/useUploader";
import { FieldType } from ".";
import Chip from "@material-ui/core/Chip";
-import {
- createStyles,
- makeStyles,
- useTheme,
- Theme,
-} from "@material-ui/core/styles";
+import { createStyles, makeStyles, Theme } from "@material-ui/core/styles";
// TODO: indicate state completion / error
// TODO: Create an interface for props
diff --git a/src/components/Fields/LongText.tsx b/src/components/Fields/LongText.tsx
index 765252f6..cf2333e1 100644
--- a/src/components/Fields/LongText.tsx
+++ b/src/components/Fields/LongText.tsx
@@ -1,20 +1,89 @@
-import React from "react";
+import React, { useState } from "react";
import ExpandIcon from "@material-ui/icons/AspectRatio";
import IconButton from "@material-ui/core/IconButton";
+import Typography from "@material-ui/core/Typography";
+import Button from "@material-ui/core/Button";
+import { createStyles, makeStyles, Theme } from "@material-ui/core/styles";
+import Popper from "@material-ui/core/Popper";
+import Fade from "@material-ui/core/Fade";
+import Paper from "@material-ui/core/Paper";
+import TextareaAutosize from "@material-ui/core/TextareaAutosize";
+import ClickAwayListener from "@material-ui/core/ClickAwayListener";
+import { onSubmit } from "components/Table/grid-fns";
+const useStyles = makeStyles((theme: Theme) =>
+ createStyles({
+ root: {
+ position: "relative",
+
+ display: "flex",
+ flexWrap: "wrap",
+ },
+ typography: {
+ padding: theme.spacing(2),
+ },
+ textArea: {
+ fontSize: 14,
+ minWidth: 230,
+ },
+ })
+);
interface Props {
- value: string | null;
+ value: any;
+ row: { ref: firebase.firestore.DocumentReference; id: string };
+ onSubmit: Function;
}
-const UrlLink = (props: Props) => {
- const { value } = props;
- return value ? (
- <>
-
-
-
-
{value}
- >
- ) : null;
+const LongText = (props: Props) => {
+ const { value, row, onSubmit } = props;
+ const [text, setText] = useState(value ? value : "");
+
+ const [anchorEl, setAnchorEl] = useState(null);
+ const classes = useStyles();
+
+ const handleClick = (
+ event: React.MouseEvent
+ ) => {
+ setAnchorEl(event.currentTarget);
+ };
+
+ const open = Boolean(anchorEl);
+ const id = open ? "no-transition-popper" : undefined;
+ const onClickAway = (event: any) => {
+ if (event.target.id !== id) {
+ onSubmit(row.ref, text);
+ setAnchorEl(null);
+ }
+ };
+ return (
+
+
+
+
+
+
+ {text}
+
+
+
+ {
+ setText(e.target.value);
+ }}
+ />
+
+
+
+
+
+
+ );
};
-export default UrlLink;
+export default LongText;
diff --git a/src/components/Fields/MultiSelect.tsx b/src/components/Fields/MultiSelect.tsx
index 0609da8d..997436cc 100644
--- a/src/components/Fields/MultiSelect.tsx
+++ b/src/components/Fields/MultiSelect.tsx
@@ -61,10 +61,9 @@ const MenuProps = {
const MultiSelect = (props: Props) => {
const classes = useStyles();
- console.log(props);
+
const { value, row, options, onSubmit } = props;
const handleChange = (e: any, v: any) => {
- console.log(v.props.value);
if (!value) {
// creates new array
onSubmit(row.ref, [v.props.value]);
diff --git a/src/components/Table/ColumnEditor/index.tsx b/src/components/Table/ColumnEditor/index.tsx
index de3b964f..c07a5f10 100644
--- a/src/components/Table/ColumnEditor/index.tsx
+++ b/src/components/Table/ColumnEditor/index.tsx
@@ -108,10 +108,14 @@ const ColumnEditor = (props: any) => {
}
}
}, [column]);
+ const clearValues = () => {
+ setValues({ type: null, name: "", options: [] });
+ };
const onClickAway = (event: any) => {
const dropDownClicked = isFieldType(event.target.dataset.value);
if (!dropDownClicked) {
handleClose();
+ clearValues();
}
};
const handleToggle = (
@@ -125,14 +129,14 @@ const ColumnEditor = (props: any) => {
const { name, type } = values;
actions.add(name, type);
handleClose();
+ clearValues();
};
const deleteColumn = () => {
actions.remove(props.column.idx);
handleClose();
+ clearValues();
};
const updateColumn = () => {
- console.log(values, props);
-
let updatables: { field: string; value: any }[] = [
{ field: "name", value: values.name },
{ field: "type", value: values.type },
@@ -146,6 +150,7 @@ const ColumnEditor = (props: any) => {
}
actions.update(props.column.idx, updatables);
handleClose();
+ clearValues();
};
if (column) {
@@ -227,7 +232,13 @@ const ColumnEditor = (props: any) => {
Delete
)}
-