From ba95ed0e2d74bbfdfa41313e31cf42a25d4036ef Mon Sep 17 00:00:00 2001 From: Boaz Poolman Date: Sat, 20 Mar 2021 16:51:34 +0100 Subject: [PATCH] Finalize main frontend functionality --- admin/src/components/ActionButtons/index.js | 31 ++++++++++++++++--- admin/src/components/ConfigList/index.js | 33 +++++++++++--------- admin/src/components/ConfirmModal/index.js | 34 +++++++++++++++++++++ admin/src/components/Header/index.js | 22 ------------- admin/src/containers/ConfigPage/index.js | 13 ++++---- admin/src/helpers/getTrad.js | 5 +++ admin/src/state/actions/Config.js | 30 ++++++++++++++++++ admin/src/translations/en.json | 4 +++ 8 files changed, 125 insertions(+), 47 deletions(-) create mode 100644 admin/src/components/ConfirmModal/index.js delete mode 100644 admin/src/components/Header/index.js create mode 100644 admin/src/helpers/getTrad.js diff --git a/admin/src/components/ActionButtons/index.js b/admin/src/components/ActionButtons/index.js index 7384cd3..019218a 100644 --- a/admin/src/components/ActionButtons/index.js +++ b/admin/src/components/ActionButtons/index.js @@ -1,12 +1,35 @@ -import React from 'react'; +import React, { useState } from 'react'; import styled from 'styled-components'; +import { useDispatch } from 'react-redux'; import { Button } from '@buffetjs/core'; +import ConfirmModal from '../ConfirmModal'; +import { exportAllConfig, importAllConfig } from '../../state/actions/Config'; + +const ActionButtons = ({ diff }) => { + const dispatch = useDispatch(); + const [modalIsOpen, setModalIsOpen] = useState(false); + const [actionType, setActionType] = useState(''); + + const closeModal = () => { + setActionType(''); + setModalIsOpen(false); + }; + + const openModal = (type) => { + setActionType(type); + setModalIsOpen(true); + }; -const ActionButtons = () => { return ( -