diff --git a/src/components/settings/SettingEdit.js b/src/components/settings/SettingEdit.js index b116b73..469fb4f 100644 --- a/src/components/settings/SettingEdit.js +++ b/src/components/settings/SettingEdit.js @@ -1,17 +1,31 @@ import React from "react"; -import { Edit, SimpleForm, TextInput } from "react-admin"; +import { + Edit, + SimpleForm, + TextInput, + EditController, + EditView, + BooleanInput, +} from "react-admin"; const SettingEdit = (props) => ( - - - - - - + + + {(controllerProps) => ( + + + {controllerProps.record && + Object.keys(controllerProps.record).map((key) => + /true|false/.test(controllerProps.record[key]) ? ( + + ) : ( + + ) + )} + + + )} + ); diff --git a/src/components/settings/SettingShow.js b/src/components/settings/SettingShow.js index b218ad8..dee8fdb 100644 --- a/src/components/settings/SettingShow.js +++ b/src/components/settings/SettingShow.js @@ -1,14 +1,34 @@ import React from "react"; -import { Show, SimpleShowLayout, TextField } from "react-admin"; +import { + Show, + SimpleShowLayout, + TextField, + ShowController, + ShowView, + BooleanField, +} from "react-admin"; -const SettingShow = (props) => ( - - - - - - - -); +const SettingShow = (props) => { + return ( + + + {(controllerProps) => ( + + + {controllerProps.record && + Object.keys(controllerProps.record).map((key) => + /true|false/.test(controllerProps.record[key]) ? ( + + ) : ( + + ) + )} + + + )} + + + ); +}; export default SettingShow; diff --git a/src/components/settings/index.js b/src/components/settings/index.js index fb5cbd4..5b1f4a5 100644 --- a/src/components/settings/index.js +++ b/src/components/settings/index.js @@ -1,8 +1,10 @@ import SettingShow from "./SettingShow"; +import SettingEdit from "./SettingEdit"; import SettingIcon from "@material-ui/icons/Settings"; export default { list: SettingShow, + edit: SettingEdit, show: SettingShow, icon: SettingIcon, };