Commit b0905710 authored by David Björkheim's avatar David Björkheim
Browse files

DEICH-5554 Deichman.no: Remove redux for toggle of publication details

parent 6996ccfd
......@@ -109,7 +109,6 @@ class PublicationList extends Component {
const {
parent,
limited,
onShowDetails,
onFavourite,
favourites,
onReserve,
......@@ -130,7 +129,6 @@ class PublicationList extends Component {
parent={parent}
flags={item.flags}
isFavourited={favourites.includes(item.recordId)}
onShowDetails={() => onShowDetails(item)}
onFavourite={() => onFavourite(item.recordId)}
onReserve={() => onReserve(item.recordId)}
tjenesteKatalogUrl={tjenesteKatalogUrl}
......@@ -165,7 +163,6 @@ PublicationList.propTypes = {
parent: PropTypes.object,
limited: PropTypes.bool,
favourites: PropTypes.array,
onShowDetails: PropTypes.func.isRequired,
onFavourite: PropTypes.func.isRequired,
onReserve: PropTypes.func.isRequired,
userCategory: PropTypes.string,
......
import { Block } from "@digibib/deichman-ui";
import React from "react";
import { useDispatch, useSelector } from "react-redux";
import { toggleDetails, toggleFavourites } from "../../store/application";
import { toggleFavourites } from "../../store/application";
import PublicationList from "../PublicationList";
export default function ReservationSelector({
......@@ -13,7 +13,6 @@ export default function ReservationSelector({
const dispatch = useDispatch();
const favourites = useSelector(state => state.favourites.biblioNumbers);
const onFavourite = recordId => dispatch(toggleFavourites({ recordId }));
const onShowDetails = publication => dispatch(toggleDetails({ publication }));
const userCategory = useSelector(state => state.auth.userData.category);
const tjenesteKatalogUrl = useSelector(
state => state.application.urls.tjenestekatalog
......@@ -32,7 +31,6 @@ export default function ReservationSelector({
parent={currentPublication.work}
onReserve={onClick}
onFavourite={onFavourite}
onShowDetails={onShowDetails}
userCategory={userCategory}
tjenesteKatalogUrl={tjenesteKatalogUrl}
/>
......
......@@ -7,7 +7,7 @@ import polyfills from "../utilities/polyfills";
import { readVariable, removeVariable } from "../utilities/localstorage";
import { trackPageView } from "../utilities/analytics";
import { toggleDetails, triggerModalOnInit } from "../store/application";
import { triggerModalOnInit } from "../store/application";
import { hideSearchField } from "../store/search";
import { getCampaigns, randomizeCampaigns } from "../store/campaigns";
import { getStatus } from "../store/auth";
......@@ -76,12 +76,6 @@ class MyApp extends App {
this.props.reduxStore.dispatch(hideSearchField());
}
// Close any open publicationdetails modals
const { details } = this.props.reduxStore.getState().application;
if (details.visible) {
this.props.reduxStore.dispatch(toggleDetails());
}
// Preform scroll restoration if back button was pressed
if (activePopState) {
const { x, y } = activePopState;
......
......@@ -14,8 +14,6 @@ const SHOW_PERSONALIA_MODAL = "application/SHOW_PERSONALIA_MODAL";
const HIDE_PERSONALIA_MODAL = "application/HIDE_PERSONALIA_MODAL";
const SHOW_DOOR_ACCESS_MODAL = "application/SHOW_DOOR_ACCESS_MODAL";
const HIDE_DOOR_ACCESS_MODAL = "application/HIDE_DOOR_ACCESS_MODAL";
const SHOW_DETAILS = "application/SHOW_DETAILS";
const HIDE_DETAILS = "application/HIDE_DETAILS";
const FREEZE_BODY = "application/FREEZE_BODY";
const UNFREEZE_BODY = "application/UNFREEZE_BODY";
const SET_LIST_MODE = "application/SET_LIST_MODE";
......@@ -44,10 +42,6 @@ const initialState = {
visible: false,
data: {}
},
details: {
visible: false,
data: {}
},
notification: {
visible: false,
data: {}
......@@ -84,13 +78,6 @@ export default function reducer(state = initialState, action = {}) {
return { ...state, favourites: { visible: true, data: action.data } };
case HIDE_FAVOURITES:
return { ...state, favourites: { ...state.favourites, visible: false } };
case SHOW_DETAILS:
return { ...state, details: { visible: true, data: action.data } };
case HIDE_DETAILS:
return {
...state,
details: { ...state.details, visible: false }
};
case SHOW_NOTIFICATION:
return { ...state, notification: { visible: true, data: action.data } };
case HIDE_NOTIFICATION:
......@@ -147,14 +134,6 @@ export function hideFavourites() {
return { type: HIDE_FAVOURITES };
}
export function showDetails(data) {
return { type: SHOW_DETAILS, data };
}
export function hideDetails() {
return { type: HIDE_DETAILS };
}
export function showNotification(data) {
return { type: SHOW_NOTIFICATION, data };
}
......@@ -240,19 +219,6 @@ export function toggleFavourites(data = {}) {
};
}
export function toggleDetails(data = {}) {
return (dispatch, getState) => {
const { details } = getState().application;
if (details.visible) {
dispatch(unfreezeBody());
return dispatch(hideDetails());
}
dispatch(freezeBody());
return dispatch(showDetails(data));
};
}
export function togglePersonaliaModal(data = {}) {
return (dispatch, getState) => {
const { personaliaModal } = getState().application;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment