diff --git a/src/components/Fields/Date.tsx b/src/components/Fields/Date.tsx
new file mode 100644
index 00000000..159015ef
--- /dev/null
+++ b/src/components/Fields/Date.tsx
@@ -0,0 +1,44 @@
+import React from "react";
+import "date-fns";
+import DateFnsUtils from "@date-io/date-fns";
+import {
+ MuiPickersUtilsProvider,
+ // KeyboardTimePicker,
+ // KeyboardDatePicker,
+ DatePicker
+} from "@material-ui/pickers";
+import Button from "@material-ui/core/Button";
+
+const Date = (props: any) => {
+ const {
+ isFocusedCell,
+ columnData,
+ cellData,
+ cellActions,
+ rowData,
+ rowIndex
+ } = props;
+ function handleDateChange(date: Date | null) {
+ if (date) {
+ const cell = {
+ rowIndex,
+ value: date,
+ docId: rowData.id,
+ fieldName: columnData.fieldName
+ };
+ cellActions.updateFirestore(cell);
+ }
+ }
+ if (!cellData && !isFocusedCell) return ;
+ else
+ return (
+
+
+
+ );
+};
+export default Date;
diff --git a/src/components/Fields/DateTime.tsx b/src/components/Fields/DateTime.tsx
new file mode 100644
index 00000000..82946d6d
--- /dev/null
+++ b/src/components/Fields/DateTime.tsx
@@ -0,0 +1,44 @@
+import React from "react";
+import "date-fns";
+import DateFnsUtils from "@date-io/date-fns";
+import {
+ MuiPickersUtilsProvider,
+ // KeyboardTimePicker,
+ // KeyboardDatePicker,
+ DateTimePicker
+} from "@material-ui/pickers";
+import Button from "@material-ui/core/Button";
+
+const DateTime = (props: any) => {
+ const {
+ isFocusedCell,
+ columnData,
+ cellData,
+ cellActions,
+ rowData,
+ rowIndex
+ } = props;
+ function handleDateChange(date: Date | null) {
+ if (date) {
+ const cell = {
+ rowIndex,
+ value: date,
+ docId: rowData.id,
+ fieldName: columnData.fieldName
+ };
+ cellActions.updateFirestore(cell);
+ }
+ }
+ if (!cellData && !isFocusedCell) return ;
+ else
+ return (
+
+
+
+ );
+};
+export default DateTime;
diff --git a/src/components/Fields/Rating.tsx b/src/components/Fields/Rating.tsx
index 72d30159..8541e099 100644
--- a/src/components/Fields/Rating.tsx
+++ b/src/components/Fields/Rating.tsx
@@ -3,8 +3,6 @@ import MuiRating from "@material-ui/lab/Rating";
const Rating = (props: any) => {
const { columnData, cellData, cellActions, rowData, rowIndex } = props;
- // console.log(columnData, cellData, cellActions, rowData, rowIndex);
-
return (
, name: "Check Box", type: FieldType.checkBox },
{ icon: , name: "Number", type: FieldType.number },
{ icon: , name: "Date", type: FieldType.date },
- { icon: , name: "Time", type: FieldType.time },
+ { icon: , name: "Time", type: FieldType.dateTime },
{ icon: , name: "URL", type: FieldType.url },
{ icon: , name: "Rating", type: FieldType.rating }
];
diff --git a/src/components/TableCell.tsx b/src/components/TableCell.tsx
index fdb57649..fb510c2e 100644
--- a/src/components/TableCell.tsx
+++ b/src/components/TableCell.tsx
@@ -5,14 +5,14 @@ import { FieldType } from "./Fields";
import IconButton from "@material-ui/core/IconButton";
import DeleteIcon from "@material-ui/icons/Delete";
-import AddIcon from "@material-ui/icons/AddCircle";
-import DateFnsUtils from "@date-io/date-fns";
import SimpleText from "./Fields/SimpleText";
import CheckBox from "./Fields/CheckBox";
import Number from "./Fields/Number";
import Rating from "./Fields/Rating";
+import Date from "./Fields/Date";
+import DateTime from "./Fields/DateTime";
const TableCell = (props: any) => {
const {
@@ -96,6 +96,28 @@ const TableCell = (props: any) => {
columnData={columnData}
/>
);
+ case FieldType.date:
+ return (
+
+ );
+ case FieldType.dateTime:
+ return (
+
+ );
case FieldType.number:
return (