From e65003e790d135e73f24ef6e546f19f86d6950fa Mon Sep 17 00:00:00 2001 From: Pablo Roncero Fernandez <pablo.roncero.fernandez@cern.ch> Date: Tue, 1 Sep 2020 14:41:56 +0200 Subject: [PATCH] Solve compile errors --- .../ChannelGlobalPreferences.js | 8 ++- .../NotificationsPage/NotificationsPage.js | 54 +------------------ .../PreferenceListComponent.js | 2 +- src/preferences/reducers/PreferencesList.js | 4 +- 4 files changed, 8 insertions(+), 60 deletions(-) diff --git a/src/channels/pages/ChannelGlobalPreferences/ChannelGlobalPreferences.js b/src/channels/pages/ChannelGlobalPreferences/ChannelGlobalPreferences.js index bfe309c1..7efc1dba 100644 --- a/src/channels/pages/ChannelGlobalPreferences/ChannelGlobalPreferences.js +++ b/src/channels/pages/ChannelGlobalPreferences/ChannelGlobalPreferences.js @@ -1,5 +1,5 @@ -import React, { useState } from "react"; -import { Form, Radio, Segment } from "semantic-ui-react"; +import React from "react"; +import { Segment } from "semantic-ui-react"; import { connect } from "react-redux"; import { bindActionCreators } from "redux"; import * as showSnackBarActionCreators from "../../../common/actions/Snackbar"; @@ -7,9 +7,7 @@ import * as updatePreferencesActionCreators from "../../actions/UpdatePreference import AddPreferenceComponent from "../../../preferences/components/AddPreferenceComponent/AddPreferenceComponent"; import PreferenceListComponent from "../../../preferences/components/PreferenceListComponent/PreferenceListComponent"; -const ChannelGlobalPreferences = ({ updatePreferences, showSnackbar }) => { - const [activeItem, setActiveItem] = useState("LIVE"); - +const ChannelGlobalPreferences = () => { return ( <Segment style={{ diff --git a/src/notifications/pages/NotificationsPage/NotificationsPage.js b/src/notifications/pages/NotificationsPage/NotificationsPage.js index 086ce72b..a895f905 100644 --- a/src/notifications/pages/NotificationsPage/NotificationsPage.js +++ b/src/notifications/pages/NotificationsPage/NotificationsPage.js @@ -1,12 +1,9 @@ import React, { useState } from "react"; -import { Segment, Menu, Form, Radio } from "semantic-ui-react"; -import { useParams } from "react-router-dom"; -import { bindActionCreators } from "redux"; +import { Segment, Menu } from "semantic-ui-react"; import { connect } from "react-redux"; import NotificationsList from "../../components/NotificationsList/NotificationList"; import "./NotificationsPage.css"; import SearchNotificationComponent from "../../components/SearchNotificationComponent/SearchNotificationComponent"; -import * as updatePreferencesActionCreators from "../../../channels/actions/UpdatePreferences"; import AddPreferenceComponent from "../../../preferences/components/AddPreferenceComponent/AddPreferenceComponent"; import PreferenceListComponent from "../../../preferences/components/PreferenceListComponent/PreferenceListComponent"; @@ -54,55 +51,6 @@ const NotificationsPage = ({ isAuthenticated }) => { ); }; -const ChannelPreferences = ({ updatePreferences }) => { - const [activeItem, setActiveItem] = useState("LIVE"); - const { channelId } = useParams(); - - return ( - <Form> - <Form.Field> - Select your default preferences for channel {channelId}: - </Form.Field> - <Form.Field> - <Radio - label="Live" - name="radioGroup" - value="LIVE" - checked={activeItem === "LIVE"} - onChange={(e, d) => setActiveItem(d.value)} - /> - </Form.Field> - <Form.Field> - <Radio - label="Daily" - name="radioGroup" - value="DAILY" - checked={activeItem === "DAILY"} - onChange={(e, d) => setActiveItem(d.value)} - /> - </Form.Field> - <Form.Button - onClick={() => - updatePreferences({ target: channelId, type: activeItem }) - } - > - Submit - </Form.Button> - </Form> - ); -}; - -const mapDispatchToProps = (dispatch) => { - return { - ...bindActionCreators(updatePreferencesActionCreators, dispatch), - }; -}; - -const ChannelPreferencesContainer = connect( - undefined, - mapDispatchToProps -)(ChannelPreferences); - const mapStateToProps = (state) => { return { isAuthenticated: state.auth.loggedIn, diff --git a/src/preferences/components/PreferenceListComponent/PreferenceListComponent.js b/src/preferences/components/PreferenceListComponent/PreferenceListComponent.js index 8039df8b..9373439f 100644 --- a/src/preferences/components/PreferenceListComponent/PreferenceListComponent.js +++ b/src/preferences/components/PreferenceListComponent/PreferenceListComponent.js @@ -1,5 +1,5 @@ import React, { useEffect } from "react"; -import { Table, Icon, Dropdown } from "semantic-ui-react"; +import { Table, Dropdown } from "semantic-ui-react"; import { useParams } from "react-router-dom"; import { bindActionCreators } from "redux"; import { connect } from "react-redux"; diff --git a/src/preferences/reducers/PreferencesList.js b/src/preferences/reducers/PreferencesList.js index 90b66dc2..7f68e6be 100644 --- a/src/preferences/reducers/PreferencesList.js +++ b/src/preferences/reducers/PreferencesList.js @@ -44,7 +44,9 @@ function processCreatePreferenceSuccess(state, preference) { function processDeleteUserPreferenceSuccess(state, preferenceId) { return { ...state, - preferences: state.preferences.filter((p) => p.id != preferenceId), + preferences: state.preferences.filter( + (p) => Number(p.id) !== Number(preferenceId) + ), }; } -- GitLab