Skip to content

Commit

Permalink
Merge branch 'admin-ui-picard' into to-redux-toolkit-userDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnei committed Feb 23, 2024
2 parents 2fd8183 + adbb246 commit 6a75c62
Show file tree
Hide file tree
Showing 54 changed files with 1,162 additions and 1,558 deletions.
24 changes: 0 additions & 24 deletions app/src/actions/groupDetailsActions.ts

This file was deleted.

99 changes: 0 additions & 99 deletions app/src/actions/seriesActions.ts

This file was deleted.

35 changes: 0 additions & 35 deletions app/src/actions/themeActions.ts

This file was deleted.

24 changes: 0 additions & 24 deletions app/src/actions/workflowActions.ts

This file was deleted.

23 changes: 13 additions & 10 deletions app/src/components/configuration/Themes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ import TableFilters from "../shared/TableFilters";
import Table from "../shared/Table";
import { fetchFilters } from "../../thunks/tableFilterThunks";
import { connect } from "react-redux";
import { themesTemplateMap } from "../../configs/tableConfigs/themesTableConfig";
import { themesTemplateMap } from "../../configs/tableConfigs/themesTableMap";
import { getTotalThemes } from "../../selectors/themeSelectors";
import { fetchThemes } from "../../thunks/themeThunks";
import { loadThemesIntoTable } from "../../thunks/tableThunks";
import Notifications from "../shared/Notifications";
import NewResourceModal from "../shared/NewResourceModal";
Expand All @@ -20,17 +19,15 @@ import Footer from "../Footer";
import { getUserInformation } from "../../selectors/userInfoSelectors";
import { hasAccess } from "../../utils/utils";
import { getCurrentFilterResource } from "../../selectors/tableFilterSelectors";
import { useAppDispatch, useAppSelector } from "../../store";
import { fetchThemes } from "../../slices/themeSlice";

/**
* This component renders the table view of events
*/
const Themes = ({
// @ts-expect-error TS(7031): Binding element 'loadingThemes' implicitly has an ... Remove this comment to see the full error message
loadingThemes,
// @ts-expect-error TS(7031): Binding element 'loadingThemesIntoTable' implicitl... Remove this comment to see the full error message
loadingThemesIntoTable,
// @ts-expect-error TS(7031): Binding element 'themes' implicitly has an 'any' t... Remove this comment to see the full error message
themes,
// @ts-expect-error TS(7031): Binding element 'loadingFilters' implicitly has an... Remove this comment to see the full error message
loadingFilters,
// @ts-expect-error TS(7031): Binding element 'resetTextFilter' implicitly has a... Remove this comment to see the full error message
Expand All @@ -41,12 +38,20 @@ const Themes = ({
currentFilterType,
}) => {
const { t } = useTranslation();
const dispatch = useAppDispatch();
const [displayNavigation, setNavigation] = useState(false);
const [displayNewThemesModal, setNewThemesModal] = useState(false);

const themes = useAppSelector(state => getTotalThemes(state));

// TODO: Get rid of the wrappers when modernizing redux is done
const fetchThemesWrapper = () => {
dispatch(fetchThemes())
}

const loadThemes = async () => {
// Fetching themes from server
await loadingThemes();
await dispatch(fetchThemes());

// Load users into table
loadingThemesIntoTable();
Expand Down Expand Up @@ -128,7 +133,7 @@ const Themes = ({
<div className="controls-container">
{/* Include filters component */}
<TableFilters
loadResource={loadingThemes}
loadResource={fetchThemesWrapper}
loadResourceIntoTable={loadingThemesIntoTable}
resource={"themes"}
/>
Expand All @@ -146,7 +151,6 @@ const Themes = ({
// Getting state data out of redux store
// @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.
const mapStateToProps = (state) => ({
themes: getTotalThemes(state),
user: getUserInformation(state),
currentFilterType: getCurrentFilterResource(state),
});
Expand All @@ -156,7 +160,6 @@ const mapStateToProps = (state) => ({
const mapDispatchToProps = (dispatch) => ({
// @ts-expect-error TS(7006): Parameter 'resource' implicitly has an 'any' type.
loadingFilters: (resource) => dispatch(fetchFilters(resource)),
loadingThemes: () => dispatch(fetchThemes()),
loadingThemesIntoTable: () => dispatch(loadThemesIntoTable()),
resetTextFilter: () => dispatch(editTextFilter("")),
});
Expand Down
10 changes: 4 additions & 6 deletions app/src/components/configuration/partials/ThemesActionsCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,21 @@ import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import ConfirmModal from "../../shared/ConfirmModal";
import ThemeDetailsModal from "./wizard/ThemeDetailsModal";
import { deleteTheme } from "../../../thunks/themeThunks";
import {
fetchThemeDetails,
fetchUsage,
} from "../../../thunks/themeDetailsThunks";
import { getUserInformation } from "../../../selectors/userInfoSelectors";
import { hasAccess } from "../../../utils/utils";
import { useAppDispatch } from "../../../store";
import { deleteTheme } from "../../../slices/themeSlice";

/**
* This component renders the action cells of themes in the table view
*/
const ThemesActionsCell = ({
// @ts-expect-error TS(7031): Binding element 'row' implicitly has an 'any' type... Remove this comment to see the full error message
row,
// @ts-expect-error TS(7031): Binding element 'deleteTheme' implicitly has an 'a... Remove this comment to see the full error message
deleteTheme,
// @ts-expect-error TS(7031): Binding element 'fetchThemeDetails' implicitly has... Remove this comment to see the full error message
fetchThemeDetails,
// @ts-expect-error TS(7031): Binding element 'fetchUsage' implicitly has an 'an... Remove this comment to see the full error message
Expand All @@ -27,6 +26,7 @@ const ThemesActionsCell = ({
user,
}) => {
const { t } = useTranslation();
const dispatch = useAppDispatch();

const [displayDeleteConfirmation, setDeleteConfirmation] = useState(false);
const [displayThemeDetails, setThemeDetails] = useState(false);
Expand All @@ -48,7 +48,7 @@ const ThemesActionsCell = ({

// @ts-expect-error TS(7006): Parameter 'id' implicitly has an 'any' type.
const deletingTheme = (id) => {
deleteTheme(id);
dispatch(deleteTheme(id));
};

return (
Expand Down Expand Up @@ -103,8 +103,6 @@ const mapStateToProps = (state) => ({
// Mapping actions to dispatch
// @ts-expect-error TS(7006): Parameter 'dispatch' implicitly has an 'any' type.
const mapDispatchToProps = (dispatch) => ({
// @ts-expect-error TS(7006): Parameter 'id' implicitly has an 'any' type.
deleteTheme: (id) => dispatch(deleteTheme(id)),
// @ts-expect-error TS(7006): Parameter 'id' implicitly has an 'any' type.
fetchThemeDetails: (id) => dispatch(fetchThemeDetails(id)),
// @ts-expect-error TS(7006): Parameter 'id' implicitly has an 'any' type.
Expand Down
25 changes: 10 additions & 15 deletions app/src/components/configuration/partials/wizard/NewThemeWizard.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
import React, { useEffect } from "react";
import { Formik } from "formik";
import { connect } from "react-redux";
import GeneralPage from "./GeneralPage";
import BumperPage from "./BumperPage";
import TitleSlidePage from "./TitleSlidePage";
import WatermarkPage from "./WatermarkPage";
import ThemeSummaryPage from "./ThemeSummaryPage";
import WizardStepper from "../../../shared/wizard/WizardStepper";
import { postNewTheme } from "../../../../thunks/themeThunks";
import { initialFormValuesNewThemes } from "../../../../configs/modalConfig";
import { usePageFunctions } from "../../../../hooks/wizardHooks";
import { NewThemeSchema } from "../../../../utils/validate";
import { useAppDispatch } from "../../../../store";
import { postNewTheme } from "../../../../slices/themeSlice";

/**
* This component manages the pages of the new theme wizard and the submission of values
*/
const NewThemeWizard = ({
close,
postNewTheme
}: any) => {
const NewThemeWizard: React.FC<{
close: () => void
}> = ({
close,
}) => {
const dispatch = useAppDispatch();
const initialValues = initialFormValuesNewThemes;

const [
Expand Down Expand Up @@ -64,7 +66,7 @@ const NewThemeWizard = ({

// @ts-expect-error TS(7006): Parameter 'values' implicitly has an 'any' type.
const handleSubmit = (values) => {
postNewTheme(values);
dispatch(postNewTheme(values));
close();
};

Expand Down Expand Up @@ -143,11 +145,4 @@ const NewThemeWizard = ({
);
};

// Mapping actions to dispatch
// @ts-expect-error TS(7006): Parameter 'dispatch' implicitly has an 'any' type.
const mapDispatchToProps = (dispatch) => ({
// @ts-expect-error TS(7006): Parameter 'values' implicitly has an 'any' type.
postNewTheme: (values) => dispatch(postNewTheme(values)),
});

export default connect(null, mapDispatchToProps)(NewThemeWizard);
export default NewThemeWizard;
Loading

0 comments on commit 6a75c62

Please sign in to comment.