update to master
This commit is contained in:
commit
c67fe5aae6
9 changed files with 56 additions and 6 deletions
|
@ -12,6 +12,7 @@ Web UI version numbers should always match the corresponding version of LBRY App
|
|||
* Added transition to card hovers to smooth animation
|
||||
* Support markdown makeup in claim description
|
||||
* Replaced free speech flag (used when image is missing) with labeled color tiles
|
||||
* Added a loading message to file actions
|
||||
|
||||
### Changed
|
||||
* Publishes now uses claims rather than files
|
||||
|
|
|
@ -12,6 +12,7 @@ import { doSearch } from "actions/search";
|
|||
import { doFetchDaemonSettings } from "actions/settings";
|
||||
import { doAuthenticate } from "actions/user";
|
||||
import { doFileList } from "actions/file_info";
|
||||
import { toQueryString } from "util/query_params";
|
||||
|
||||
const { remote, ipcRenderer, shell } = require("electron");
|
||||
const path = require("path");
|
||||
|
@ -19,14 +20,10 @@ const { download } = remote.require("electron-dl");
|
|||
const fs = remote.require("fs");
|
||||
const { lbrySettings: config } = require("../../../app/package.json");
|
||||
|
||||
const queryStringFromParams = params => {
|
||||
return Object.keys(params).map(key => `${key}=${params[key]}`).join("&");
|
||||
};
|
||||
|
||||
export function doNavigate(path, params = {}) {
|
||||
return function(dispatch, getState) {
|
||||
let url = path;
|
||||
if (params) url = `${url}?${queryStringFromParams(params)}`;
|
||||
if (params) url = `${url}?${toQueryString(params)}`;
|
||||
|
||||
dispatch(doChangePath(url));
|
||||
|
||||
|
|
|
@ -178,3 +178,14 @@ export function doUserIdentityVerify(stripeToken) {
|
|||
});
|
||||
};
|
||||
}
|
||||
|
||||
export function doFetchAccessToken() {
|
||||
return function(dispatch, getState) {
|
||||
const success = token =>
|
||||
dispatch({
|
||||
type: types.FETCH_ACCESS_TOKEN_SUCCESS,
|
||||
data: { token },
|
||||
});
|
||||
lbryio.getAuthToken().then(success);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -142,6 +142,8 @@ class FileActions extends React.PureComponent {
|
|||
onClick={() => openInShell(fileInfo)}
|
||||
/>
|
||||
);
|
||||
} else if (!fileInfo) {
|
||||
content = <BusyMessage message={__("Fetching file info")} />;
|
||||
} else {
|
||||
console.log("handle this case of file action props?");
|
||||
}
|
||||
|
|
|
@ -103,6 +103,7 @@ export const USER_IDENTITY_VERIFY_FAILURE = "USER_IDENTITY_VERIFY_FAILURE";
|
|||
export const USER_FETCH_STARTED = "USER_FETCH_STARTED";
|
||||
export const USER_FETCH_SUCCESS = "USER_FETCH_SUCCESS";
|
||||
export const USER_FETCH_FAILURE = "USER_FETCH_FAILURE";
|
||||
export const FETCH_ACCESS_TOKEN_SUCCESS = "FETCH_ACCESS_TOKEN_SUCCESS";
|
||||
|
||||
// Rewards
|
||||
export const FETCH_REWARDS_STARTED = "FETCH_REWARDS_STARTED";
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
import React from "react";
|
||||
import { doNavigate } from "actions/app";
|
||||
import { connect } from "react-redux";
|
||||
import { doFetchAccessToken } from "actions/user";
|
||||
import { selectAccessToken, selectUser } from "selectors/user";
|
||||
import HelpPage from "./view";
|
||||
import { selectUser } from "selectors/user";
|
||||
|
||||
const select = state => ({
|
||||
user: selectUser(state),
|
||||
accessToken: selectAccessToken(state),
|
||||
});
|
||||
|
||||
const perform = dispatch => ({
|
||||
navigate: (path, params) => dispatch(doNavigate(path, params)),
|
||||
fetchAccessToken: () => dispatch(doFetchAccessToken()),
|
||||
});
|
||||
|
||||
export default connect(select, perform)(HelpPage);
|
||||
|
|
|
@ -14,6 +14,7 @@ class HelpPage extends React.PureComponent {
|
|||
lbryId: null,
|
||||
uiVersion: null,
|
||||
upgradeAvailable: null,
|
||||
accessTokenHidden: true,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -36,6 +37,14 @@ class HelpPage extends React.PureComponent {
|
|||
lbryId: info.lbry_id,
|
||||
});
|
||||
});
|
||||
|
||||
if (!this.props.accessToken) this.props.fetchAccessToken();
|
||||
}
|
||||
|
||||
showAccessToken() {
|
||||
this.setState({
|
||||
accessTokenHidden: false,
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -121,6 +130,7 @@ class HelpPage extends React.PureComponent {
|
|||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section className="card">
|
||||
<div className="card__title-primary"><h3>{__("About")}</h3></div>
|
||||
<div className="card__content">
|
||||
|
@ -163,6 +173,18 @@ class HelpPage extends React.PureComponent {
|
|||
<th>{__("Installation ID")}</th>
|
||||
<td>{this.state.lbryId}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{__("Access Token")}</th>
|
||||
<td>
|
||||
{this.state.accessTokenHidden &&
|
||||
<Link
|
||||
label={__("show")}
|
||||
onClick={this.showAccessToken.bind(this)}
|
||||
/>}
|
||||
{!this.state.accessTokenHidden &&
|
||||
this.props.accessToken}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
: <BusyMessage message={__("Looking up version info")} />}
|
||||
|
|
|
@ -142,6 +142,14 @@ reducers[types.USER_IDENTITY_VERIFY_FAILURE] = function(state, action) {
|
|||
});
|
||||
};
|
||||
|
||||
reducers[types.FETCH_ACCESS_TOKEN_SUCCESS] = function(state, action) {
|
||||
const { token } = action.data;
|
||||
|
||||
return Object.assign({}, state, {
|
||||
accessToken: token,
|
||||
});
|
||||
};
|
||||
|
||||
export default function reducer(state = defaultState, action) {
|
||||
const handler = reducers[action.type];
|
||||
if (handler) return handler(state, action);
|
||||
|
|
|
@ -68,3 +68,8 @@ export const selectUserIsVerificationCandidate = createSelector(
|
|||
selectUser,
|
||||
user => user && (!user.has_verified_email || !user.is_identity_verified)
|
||||
);
|
||||
|
||||
export const selectAccessToken = createSelector(
|
||||
_selectState,
|
||||
state => state.accessToken
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue