Skip to content

Commit

Permalink
Removing unused profile properties, and destructuring profile state.
Browse files Browse the repository at this point in the history
  • Loading branch information
erinesullivan committed Nov 14, 2024
1 parent 98c7b39 commit 52216fc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/modules/datastores/components/FlintAlerts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Alert, Anchor } from '../../../reusable';
import React, { useState } from 'react';
import PropTypes from 'prop-types';

const FlintAlerts = ({ datastore, profile }) => {
const FlintAlerts = ({ datastore, institutions = [] }) => {
const [dismiss, setDismiss] = useState([]);
const handleDismissClick = () => {
setDismiss((previousDismiss) => {
Expand All @@ -16,7 +16,7 @@ const FlintAlerts = ({ datastore, profile }) => {
website: (<>We noticed you are affiliated with U-M Flint. For the best results use the <Anchor href='https://libguides.umflint.edu/library'>Thompson Library website</Anchor>.</>)
};

if (!Object.keys(messages).includes(datastore) || !profile.institutions?.includes('Flint') || dismiss.includes(datastore)) {
if (!Object.keys(messages).includes(datastore) || !institutions.includes('Flint') || dismiss.includes(datastore)) {
return null;
}

Expand All @@ -37,7 +37,7 @@ const FlintAlerts = ({ datastore, profile }) => {

FlintAlerts.propTypes = {
datastore: PropTypes.string,
profile: PropTypes.object
institutions: PropTypes.array
};

export default FlintAlerts;
8 changes: 4 additions & 4 deletions src/modules/pages/components/DatastorePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const DatastorePage = () => {
const institution = useSelector((state) => {
return state.institution;
});
const profile = useSelector((state) => {
return state.profile;
const { institutions } = useSelector((state) => {
return state.profile || {};
});
const search = useSelector((state) => {
return state.search;
Expand Down Expand Up @@ -94,7 +94,7 @@ const DatastorePage = () => {
<>
<SearchBox />
<DatastoreNavigation {...{ activeFilters, datastores, institution, search }} />
<FlintAlerts datastore={activeDatastore.uid} profile={profile} />
<FlintAlerts datastore={activeDatastore.uid} institutions={institutions} />
<Routes>
<Route
path='record/:recordUid/get-this/:barcode'
Expand All @@ -106,7 +106,7 @@ const DatastorePage = () => {
/>
<Route
path='list'
element={<List {...{ activeDatastore, institution, list, profile }} />}
element={<List {...{ activeDatastore, institution, list }} />}
/>
<Route
index
Expand Down

0 comments on commit 52216fc

Please sign in to comment.