diff --git a/react/components/AssetDisplay/index.js b/react/components/AssetDisplay/index.js index 2b5c9e26..9a4ab58f 100644 --- a/react/components/AssetDisplay/index.js +++ b/react/components/AssetDisplay/index.js @@ -1,15 +1,14 @@ import { connect } from 'react-redux'; import View from './view'; import { fileRequested } from 'actions/show'; +import selectAsset from 'selectors/asset'; const mapStateToProps = ({ show }) => { // select error and status const error = show.displayAsset.error; const status = show.displayAsset.status; // select asset - const request = show.requestList[show.request.id]; - const assetKey = request.key; - const asset = show.assetList[assetKey]; + const asset = selectAsset(show); // return props return { error, diff --git a/react/components/AssetInfo/index.js b/react/components/AssetInfo/index.js index 792a8040..93a17591 100644 --- a/react/components/AssetInfo/index.js +++ b/react/components/AssetInfo/index.js @@ -1,11 +1,10 @@ import { connect } from 'react-redux'; import View from './view'; +import selectAsset from 'selectors/asset'; const mapStateToProps = ({ show }) => { // select asset - const request = show.requestList[show.request.id]; - const assetKey = request.key; - const asset = show.assetList[assetKey]; + const asset = selectAsset(show); // return props return { asset, diff --git a/react/components/AssetTitle/index.js b/react/components/AssetTitle/index.js index c91886df..76872f6d 100644 --- a/react/components/AssetTitle/index.js +++ b/react/components/AssetTitle/index.js @@ -1,15 +1,10 @@ import { connect } from 'react-redux'; import View from './view'; +import selectAsset from 'selectors/asset'; const mapStateToProps = ({ show }) => { // select title - const request = show.requestList[show.request.id]; - const assetKey = request.key; - const asset = show.assetList[assetKey]; - let title; - if (asset) { - title = asset.claimData.title; - }; + const { claimData: { title } } = selectAsset(show); // return props return { title, diff --git a/react/components/AssetTitle/view.jsx b/react/components/AssetTitle/view.jsx index f943a940..38e59257 100644 --- a/react/components/AssetTitle/view.jsx +++ b/react/components/AssetTitle/view.jsx @@ -1,6 +1,6 @@ import React from 'react'; -const AssetTitle = ({title}) => { +const AssetTitle = ({ title }) => { return (