diff --git a/package.json b/package.json index f28f40c0c..89d1511ae 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lbry", - "version": "0.52.5-alpha.2", + "version": "0.52.4", "description": "A browser for the LBRY network, a digital marketplace controlled by its users.", "keywords": [ "lbry" diff --git a/ui/component/lastReleaseChanges/index.js b/ui/component/lastReleaseChanges/index.js index a23d1e419..2784fe4d6 100644 --- a/ui/component/lastReleaseChanges/index.js +++ b/ui/component/lastReleaseChanges/index.js @@ -1,12 +1,3 @@ -import { connect } from 'react-redux'; -import { selectRemoteVersion, selectReleaseNotes } from 'redux/selectors/app'; import LastReleaseChanges from './view'; -const select = (state) => ({ - releaseVersion: selectRemoteVersion(state), - releaseNotes: selectReleaseNotes(state), -}); - -const perform = () => ({}); - -export default connect(select, perform)(LastReleaseChanges); +export default LastReleaseChanges; diff --git a/ui/component/lastReleaseChanges/view.jsx b/ui/component/lastReleaseChanges/view.jsx index 62d129538..a41d2c778 100644 --- a/ui/component/lastReleaseChanges/view.jsx +++ b/ui/component/lastReleaseChanges/view.jsx @@ -1,21 +1,23 @@ // @flow -import React from 'react'; +import React, { useState, useEffect } from 'react'; +import MarkdownPreview from 'component/common/markdown-preview'; import Button from 'component/button'; import I18nMessage from 'component/i18nMessage'; type Props = { hideReleaseVersion?: boolean, - releaseVersion: string, - releaseNotes: string, }; const LastReleaseChanges = (props: Props) => { - const { hideReleaseVersion, releaseVersion, releaseNotes } = props; + const { hideReleaseVersion } = props; + const [releaseTag, setReleaseTag] = useState(''); + const [releaseChanges, setReleaseChanges] = useState(''); + const [fetchingReleaseChanges, setFetchingReleaseChanges] = useState(false); + const [fetchReleaseFailed, setFetchReleaseFailed] = useState(false); const releaseVersionTitle = (
- {!hideReleaseVersion && - __('A new version %release_tag% of LBRY is ready for you.', { release_tag: releaseVersion })} + {!hideReleaseVersion && __('A new version %release_tag% of LBRY is ready for you.', { release_tag: releaseTag })}
); const seeReleaseNotes = ( @@ -32,10 +34,47 @@ const LastReleaseChanges = (props: Props) => { ); + useEffect(() => { + const lastReleaseUrl = 'https://api.github.com/repos/lbryio/lbry-desktop/releases/latest'; + const options = { + method: 'GET', + headers: { Accept: 'application/vnd.github.v3+json' }, + }; + + setFetchingReleaseChanges(true); + fetch(lastReleaseUrl, options) + .then((response) => response.json()) + .then((response) => { + setReleaseTag(response.tag_name); + setReleaseChanges(response.body); + setFetchingReleaseChanges(false); + setFetchReleaseFailed(false); + }) + .catch(() => { + setFetchingReleaseChanges(false); + setFetchReleaseFailed(true); + }); + }, []); + + if (fetchingReleaseChanges) { + return{__('Loading...')}
; + } + + if (fetchReleaseFailed) { + return ( +
+