diff --git a/ui/js/actions/content.js b/ui/js/actions/content.js
index cc64d8d9a..5c0e288fd 100644
--- a/ui/js/actions/content.js
+++ b/ui/js/actions/content.js
@@ -47,8 +47,6 @@ export function doResolveUri(uri) {
certificate,
}
})
-
- dispatch(doFetchCostInfoForUri(uri))
})
}
}
diff --git a/ui/js/actions/cost_info.js b/ui/js/actions/cost_info.js
index 5d28fb42c..5a6a66604 100644
--- a/ui/js/actions/cost_info.js
+++ b/ui/js/actions/cost_info.js
@@ -26,7 +26,7 @@ export function doFetchCostInfoForUri(uri) {
type: types.FETCH_COST_INFO_COMPLETED,
data: {
uri,
- costInfo: {}
+ costInfo: null
}
})
})
diff --git a/ui/js/component/filePrice/index.js b/ui/js/component/filePrice/index.js
index c5a9497d0..b2271e493 100644
--- a/ui/js/component/filePrice/index.js
+++ b/ui/js/component/filePrice/index.js
@@ -2,6 +2,9 @@ import React from 'react'
import {
connect,
} from 'react-redux'
+import {
+ doFetchCostInfoForUri,
+} from 'actions/cost_info'
import {
makeSelectCostInfoForUri,
} from 'selectors/cost_info'
@@ -17,6 +20,7 @@ const makeSelect = () => {
}
const perform = (dispatch) => ({
+ fetchCostInfo: (uri) => dispatch(doFetchCostInfoForUri(uri))
})
export default connect(makeSelect, perform)(FilePrice)
diff --git a/ui/js/component/filePrice/view.jsx b/ui/js/component/filePrice/view.jsx
index 17b830bf2..4edc3a3e7 100644
--- a/ui/js/component/filePrice/view.jsx
+++ b/ui/js/component/filePrice/view.jsx
@@ -3,19 +3,41 @@ import {
CreditAmount,
} from 'component/common'
-const FilePrice = (props) => {
- const {
- costInfo,
- look = 'indicator',
- } = props
-
- const isEstimate = costInfo ? !costInfo.includesData : null
-
- if (!costInfo) {
- return ???;
+class FilePrice extends React.Component{
+ componentWillMount() {
+ this.fetchCost(this.props)
}
- return
+ componentWillReceiveProps(nextProps) {
+ this.fetchCost(nextProps)
+ }
+
+ fetchCost(props) {
+ const {
+ costInfo,
+ fetchCostInfo,
+ uri
+ } = props
+
+ if (costInfo === undefined) {
+ fetchCostInfo(uri)
+ }
+ }
+
+ render() {
+ const {
+ costInfo,
+ look = 'indicator',
+ } = this.props
+
+ const isEstimate = costInfo ? !costInfo.includesData : null
+
+ if (!costInfo) {
+ return ???;
+ }
+
+ return
+ }
}
export default FilePrice
diff --git a/ui/js/component/video/view.jsx b/ui/js/component/video/view.jsx
index 5485f1a48..e19e6b2a4 100644
--- a/ui/js/component/video/view.jsx
+++ b/ui/js/component/video/view.jsx
@@ -32,9 +32,12 @@ class WatchLink extends React.Component {
fileInfo,
} = this.props
+ console.log('watch link render')
+ console.log(fileInfo)
+
return (
EXCHANGE_RATE_TIMEOUT) {
+
+ }
return new Promise((resolve, reject) => {
- const cached = getSession('exchangeRateCache');
if (!cached || Date.now() - cached.time > EXCHANGE_RATE_TIMEOUT) {
lbryio.call('lbc', 'exchange_rate', {}, 'get', true).then(({lbc_usd, lbc_btc, btc_usd}) => {
const rates = {lbc_usd, lbc_btc, btc_usd};
diff --git a/ui/js/page/filePage/index.js b/ui/js/page/filePage/index.js
index a083bdf9c..3d0ba7665 100644
--- a/ui/js/page/filePage/index.js
+++ b/ui/js/page/filePage/index.js
@@ -2,6 +2,9 @@ import React from 'react'
import {
connect
} from 'react-redux'
+import {
+ doFetchCurrentUriFileInfo
+} from 'actions/file_info'
import {
selectCurrentUri,
} from 'selectors/app'
@@ -26,6 +29,7 @@ const select = (state) => ({
})
const perform = (dispatch) => ({
+ fetchFileInfo: () => dispatch(doFetchCurrentUriFileInfo())
})
export default connect(select, perform)(FilePage)
diff --git a/ui/js/page/filePage/view.jsx b/ui/js/page/filePage/view.jsx
index 30938d635..d5a29d7a9 100644
--- a/ui/js/page/filePage/view.jsx
+++ b/ui/js/page/filePage/view.jsx
@@ -45,87 +45,105 @@ const FormatItem = (props) => {
)
}
-const FilePage = (props) => {
- const {
- claim,
- navigate,
- claim: {
- txid,
- nout,
- has_signature: hasSignature,
- signature_is_valid: signatureIsValid,
- value,
- value: {
- stream,
- stream: {
- metadata,
- source,
- metadata: {
- title,
- } = {},
- source: {
- contentType,
+class FilePage extends React.Component{
+
+ componentWillMount() {
+ this.fetchFileInfo(this.props)
+ }
+
+ componentWillReceiveProps(nextProps) {
+ this.fetchFileInfo(nextProps)
+ }
+
+ fetchFileInfo(props) {
+ if (!props.fileInfo) {
+ console.log('fetch file info')
+ props.fetchFileInfo()
+ }
+ }
+
+ render() {
+ const {
+ claim,
+ navigate,
+ claim: {
+ txid,
+ nout,
+ has_signature: hasSignature,
+ signature_is_valid: signatureIsValid,
+ value,
+ value: {
+ stream,
+ stream: {
+ metadata,
+ source,
+ metadata: {
+ title,
+ } = {},
+ source: {
+ contentType,
+ } = {},
} = {},
} = {},
+ },
+ uri,
+ isDownloaded,
+ fileInfo,
+ costInfo,
+ costInfo: {
+ cost,
+ includesData: costIncludesData,
} = {},
- },
- uri,
- isDownloaded,
- fileInfo,
- costInfo,
- costInfo: {
- cost,
- includesData: costIncludesData,
- } = {},
- } = props
+ } = this.props
- const outpoint = txid + ':' + nout;
- const uriLookupComplete = !!claim && Object.keys(claim).length
+ const outpoint = txid + ':' + nout;
+ const uriLookupComplete = !!claim && Object.keys(claim).length
- const channelUriObj = lbryuri.parse(uri)
- delete channelUriObj.path;
- delete channelUriObj.contentName;
- const channelUri = signatureIsValid && hasSignature && channelUriObj.isChannel ? lbryuri.build(channelUriObj, false) : null;
- const uriIndicator =
+ const channelUriObj = lbryuri.parse(uri)
+ delete channelUriObj.path;
+ delete channelUriObj.contentName;
+ const channelUri = signatureIsValid && hasSignature && channelUriObj.isChannel ? lbryuri.build(channelUriObj, false) : null;
+ const uriIndicator =
- //
This location is not yet in use. { ' ' } navigate('/publish')} label="Put something here" />.
+ //
This location is not yet in use. { ' ' } navigate('/publish')} label="Put something here" />.
- return (
-
-
- { contentType && contentType.startsWith('video/') ?
- :
- (Object.keys(metadata).length > 0 ? : ) }
-
-
-
-
- {isDownloaded === false
- ?
- : null}
-
{title}
-
- { channelUri ?
- {uriIndicator} :
- uriIndicator}
-
-
-
+ return (
+
+
+ { contentType && contentType.startsWith('video/') ?
+ :
+ (Object.keys(metadata).length > 0 ? : ) }
+
+
+
+
+ {isDownloaded === false
+ ?
+ : null}
{title}
+
+ { channelUri ?
+ {uriIndicator} :
+ uriIndicator}
+
+
+
+
+
+ {metadata.description}
+
-
- {metadata.description}
-
-
- { metadata ?
+ { metadata ?
+
+
+
: '' }
-
-
: '' }
-
-
-
-
-
- )
+
+
+
+
+ )
+ }
}
export default FilePage;
\ No newline at end of file
diff --git a/ui/js/page/showPage/view.jsx b/ui/js/page/showPage/view.jsx
index 7e84d3d30..bdc4f7a81 100644
--- a/ui/js/page/showPage/view.jsx
+++ b/ui/js/page/showPage/view.jsx
@@ -41,7 +41,7 @@ class ShowPage extends React.Component{
{uri}