From 86931af2c495175acf2c28ffceae38a730f54a9b Mon Sep 17 00:00:00 2001 From: Tudor Stanciu Date: Tue, 20 Sep 2022 19:26:29 +0300 Subject: [PATCH] Removed MessageForAuthor feature --- public/locales/en/translations.json | 10 +-- public/locales/ro/translations.json | 10 +-- .../messageForAuthor/actionCreators.js | 18 ----- src/features/messageForAuthor/actionTypes.js | 2 - src/features/messageForAuthor/api.js | 9 --- .../components/MessageForAuthorContainer.js | 66 ------------------ .../components/MessageForAuthorDialog.js | 69 ------------------- .../server/components/ServerComponent.js | 15 ++-- .../server/components/ServerContainer.js | 38 +++------- 9 files changed, 21 insertions(+), 216 deletions(-) delete mode 100644 src/features/messageForAuthor/actionCreators.js delete mode 100644 src/features/messageForAuthor/actionTypes.js delete mode 100644 src/features/messageForAuthor/api.js delete mode 100644 src/features/messageForAuthor/components/MessageForAuthorContainer.js delete mode 100644 src/features/messageForAuthor/components/MessageForAuthorDialog.js diff --git a/public/locales/en/translations.json b/public/locales/en/translations.json index bd12db1..9f4fffd 100644 --- a/public/locales/en/translations.json +++ b/public/locales/en/translations.json @@ -8,6 +8,9 @@ "NUMBER": "{{number,intlNumber}}", "DECIMAL": "{{number,intlDecimal}}", "DECIMAL2": "{{number,intlDecimal2}}", + "Global": { + "InDevelopment": "In development..." + }, "Language": { "English": "English", "Romanian": "Romanian" @@ -99,10 +102,6 @@ "ActiveSession": "Active session", "ActiveSessionSubtitle": "Expand to see forwards", "DDNSProvider": "Dynamic DNS Provider", - "Actions": { - "SendMessageToAuthor": "Send message to author" - }, - "MessageForAuthor": "Message for author", "Details": "Details" }, "Charts": { @@ -116,9 +115,6 @@ } } }, - "Notifications": { - "MessageSaved": "Message saved" - }, "Chatbot": { "Wizard": { "Message1": "I'm the wizard.", diff --git a/public/locales/ro/translations.json b/public/locales/ro/translations.json index 9bd6392..c75b809 100644 --- a/public/locales/ro/translations.json +++ b/public/locales/ro/translations.json @@ -1,4 +1,7 @@ { + "Global": { + "InDevelopment": "In curs de dezvoltare..." + }, "Language": { "English": "Engleză", "Romanian": "Română" @@ -90,10 +93,6 @@ "ActiveSession": "Sesiune activă", "ActiveSessionSubtitle": "Extindeţi pentru a vedea redirectările", "DDNSProvider": "Furnizor DNS dinamic", - "Actions": { - "SendMessageToAuthor": "Trimite mesaj către autor" - }, - "MessageForAuthor": "Mesaj pentru autor", "Details": "Detalii" }, "Charts": { @@ -107,9 +106,6 @@ } } }, - "Notifications": { - "MessageSaved": "Mesaj salvat" - }, "Chatbot": { "Wizard": { "Message1": "Eu sunt vrăjitorul.", diff --git a/src/features/messageForAuthor/actionCreators.js b/src/features/messageForAuthor/actionCreators.js deleted file mode 100644 index 2a5a351..0000000 --- a/src/features/messageForAuthor/actionCreators.js +++ /dev/null @@ -1,18 +0,0 @@ -import * as types from "./actionTypes"; -import api from "./api"; -import { sendHttpRequest } from "../../redux/actions/httpActions"; - -export function saveMessageForAuthor(messageContent) { - return async function (dispatch, getState) { - try { - const sessionId = getState().frontendSession.sessionId; - const event = await dispatch( - sendHttpRequest(api.saveMessageForAuthor(sessionId, messageContent)) - ); - dispatch({ type: types.SAVE_MESSAGE_FOR_AUTHOR_SUCCESS, payload: event }); - return event; - } catch (error) { - throw error; - } - }; -} diff --git a/src/features/messageForAuthor/actionTypes.js b/src/features/messageForAuthor/actionTypes.js deleted file mode 100644 index 71d7550..0000000 --- a/src/features/messageForAuthor/actionTypes.js +++ /dev/null @@ -1,2 +0,0 @@ -export const SAVE_MESSAGE_FOR_AUTHOR_SUCCESS = - "SAVE_MESSAGE_FOR_AUTHOR_SUCCESS"; diff --git a/src/features/messageForAuthor/api.js b/src/features/messageForAuthor/api.js deleted file mode 100644 index 734599c..0000000 --- a/src/features/messageForAuthor/api.js +++ /dev/null @@ -1,9 +0,0 @@ -import { post } from "../../api/axiosApi"; -const baseUrl = process.env.REVERSE_PROXY_API_URL; - -const saveMessageForAuthor = (sessionId, messageContent) => - post(`${baseUrl}/system/message-for-author`, { sessionId, messageContent }); - -export default { - saveMessageForAuthor -}; diff --git a/src/features/messageForAuthor/components/MessageForAuthorContainer.js b/src/features/messageForAuthor/components/MessageForAuthorContainer.js deleted file mode 100644 index 977efd2..0000000 --- a/src/features/messageForAuthor/components/MessageForAuthorContainer.js +++ /dev/null @@ -1,66 +0,0 @@ -import React, { useState } from "react"; -import { connect } from "react-redux"; -import { bindActionCreators } from "redux"; -import PropTypes from "prop-types"; -import MessageForAuthorDialog from "./MessageForAuthorDialog"; -import { saveMessageForAuthor } from "../actionCreators"; -import { showInfo, showError } from "../../snackbar/actionCreators"; -import { useTranslation } from "react-i18next"; - -const MessageForAuthorContainer = ({ actions, open, handleClose }) => { - const [messageForAuthor, setMessageForAuthor] = useState(""); - const { t } = useTranslation(); - - const onMessageForAuthorChanged = (event) => { - const value = event.target.value; - setMessageForAuthor(value); - }; - - const saveMessage = () => { - actions - .saveMessageForAuthor(messageForAuthor) - .then((event) => { - if (event.success) actions.showInfo(t("Notifications.MessageSaved")); - else actions.showError(event.message); - }) - .catch((error) => { - actions.showError(error); - }); - setMessageForAuthor(""); - handleClose(); - }; - - return ( - - ); -}; - -MessageForAuthorContainer.propTypes = { - actions: PropTypes.object.isRequired, - open: PropTypes.bool.isRequired, - handleClose: PropTypes.func.isRequired -}; - -function mapStateToProps() { - return {}; -} - -function mapDispatchToProps(dispatch) { - return { - actions: bindActionCreators( - { saveMessageForAuthor, showInfo, showError }, - dispatch - ) - }; -} - -export default connect( - mapStateToProps, - mapDispatchToProps -)(MessageForAuthorContainer); diff --git a/src/features/messageForAuthor/components/MessageForAuthorDialog.js b/src/features/messageForAuthor/components/MessageForAuthorDialog.js deleted file mode 100644 index 4763e19..0000000 --- a/src/features/messageForAuthor/components/MessageForAuthorDialog.js +++ /dev/null @@ -1,69 +0,0 @@ -import React from "react"; -import PropTypes from "prop-types"; -import TextField from "@material-ui/core/TextField"; -import { - Dialog, - DialogContent, - IconButton, - Grid, - Tooltip -} from "@material-ui/core"; -import SendRoundedIcon from "@material-ui/icons/SendRounded"; -import { useTranslation } from "react-i18next"; - -const MessageForAuthorDialog = ({ - open, - handleClose, - messageForAuthor, - onMessageForAuthorChanged, - saveMessage -}) => { - const { t } = useTranslation(); - - return ( -
- - - - - - - - - - - - - - - - -
- ); -}; - -MessageForAuthorDialog.propTypes = { - open: PropTypes.bool.isRequired, - handleClose: PropTypes.func.isRequired, - messageForAuthor: PropTypes.string.isRequired, - onMessageForAuthorChanged: PropTypes.func.isRequired, - saveMessage: PropTypes.func.isRequired -}; - -export default MessageForAuthorDialog; diff --git a/src/features/server/components/ServerComponent.js b/src/features/server/components/ServerComponent.js index 31c1738..4c8663a 100644 --- a/src/features/server/components/ServerComponent.js +++ b/src/features/server/components/ServerComponent.js @@ -18,7 +18,7 @@ import ShareIcon from "@material-ui/icons/Share"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; import MoreVertIcon from "@material-ui/icons/MoreVert"; import DnsRoundedIcon from "@material-ui/icons/DnsRounded"; -import MessageRoundedIcon from "@material-ui/icons/MessageRounded"; +import DeveloperBoardIcon from "@material-ui/icons/DeveloperBoard"; import styles from "../../../components/common/styles/expandableCardStyles"; import ServerSummary from "./ServerSummary"; import { useTranslation } from "react-i18next"; @@ -31,7 +31,6 @@ const ServerComponent = ({ serverHost, openAbout, handleOpenInNewTab, - showMessageForAuthor, summonWizard }) => { const classes = useStyles(); @@ -44,7 +43,7 @@ const ServerComponent = ({ setExpanded(!expanded); }; - const handleClick = (event) => { + const handleClick = event => { setAnchorEl(event.currentTarget); }; @@ -98,12 +97,9 @@ const ServerComponent = ({ )} - - - + + {}}> + @@ -135,7 +131,6 @@ ServerComponent.propTypes = { serverHost: PropTypes.string, openAbout: PropTypes.func.isRequired, handleOpenInNewTab: PropTypes.func.isRequired, - showMessageForAuthor: PropTypes.func.isRequired, summonWizard: PropTypes.func.isRequired }; diff --git a/src/features/server/components/ServerContainer.js b/src/features/server/components/ServerContainer.js index 3eddfd2..73ce246 100644 --- a/src/features/server/components/ServerContainer.js +++ b/src/features/server/components/ServerContainer.js @@ -1,54 +1,36 @@ -import React, { useEffect, useState } from "react"; +import React, { useEffect } from "react"; import { connect } from "react-redux"; import { bindActionCreators } from "redux"; import PropTypes from "prop-types"; import { loadServerData, loadSystemVersion } from "../actionCreators"; import ServerComponent from "./ServerComponent"; import { withRouter } from "react-router-dom"; -import MessageForAuthorContainer from "../../messageForAuthor/components/MessageForAuthorContainer"; import { summonWizard } from "../../chatbot/actionCreators"; const ServerContainer = ({ actions, data, serverHost, history }) => { - const [openMessageForAuthor, setOpenMessageForAuthor] = useState(false); - - const closeMessageForAuthor = () => { - setOpenMessageForAuthor(false); - }; - - const showMessageForAuthor = () => { - setOpenMessageForAuthor(true); - }; - useEffect(() => { actions.loadServerData(); actions.loadSystemVersion(); }, []); - const openAbout = (event) => { + const openAbout = event => { history.push("/about"); event.preventDefault(); }; - const handleOpenInNewTab = (url) => (event) => { + const handleOpenInNewTab = url => event => { window.open(url, "_blank"); event.preventDefault(); }; return ( - <> - - - + ); };