mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-03 20:35:17 +00:00
error handling, ux tweaks, apiLogPublish
This commit is contained in:
parent
f4310cd3aa
commit
1f32d454db
6 changed files with 32 additions and 10 deletions
|
@ -135,7 +135,7 @@
|
||||||
"imagesloaded": "^4.1.4",
|
"imagesloaded": "^4.1.4",
|
||||||
"json-loader": "^0.5.4",
|
"json-loader": "^0.5.4",
|
||||||
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
"lbry-format": "https://github.com/lbryio/lbry-format.git",
|
||||||
"lbry-redux": "lbryio/lbry-redux#c0bfa4d32005266d41df18a19c93914c426a8067",
|
"lbry-redux": "lbryio/lbry-redux#906199d866a187015668a27363f010828c15979a",
|
||||||
"lbryinc": "lbryio/lbryinc#72eee35f5181940eb4a468a27ddb2a2a4e362fb0",
|
"lbryinc": "lbryio/lbryinc#72eee35f5181940eb4a468a27ddb2a2a4e362fb0",
|
||||||
"lint-staged": "^7.0.2",
|
"lint-staged": "^7.0.2",
|
||||||
"localforage": "^1.7.1",
|
"localforage": "^1.7.1",
|
||||||
|
|
|
@ -1278,5 +1278,14 @@
|
||||||
"Increasing your deposit can help your channel be discovered more easily.": "Increasing your deposit can help your channel be discovered more easily.",
|
"Increasing your deposit can help your channel be discovered more easily.": "Increasing your deposit can help your channel be discovered more easily.",
|
||||||
"Editing @%channel%": "Editing @%channel%",
|
"Editing @%channel%": "Editing @%channel%",
|
||||||
"This field cannot be changed.": "This field cannot be changed.",
|
"This field cannot be changed.": "This field cannot be changed.",
|
||||||
"Delete Channel": "Delete Channel"
|
"Delete Channel": "Delete Channel",
|
||||||
}
|
"Edit Thumbnail Image": "Edit Thumbnail Image",
|
||||||
|
"(Y x Z)": "(Y x Z)",
|
||||||
|
"Choose Image": "Choose Image",
|
||||||
|
"File to upload": "File to upload",
|
||||||
|
"Use a URL instead": "Use a URL instead",
|
||||||
|
"Edit Cover Image": "Edit Cover Image",
|
||||||
|
"Cover Image": "Cover Image",
|
||||||
|
"You Followed Your First Channel!": "You Followed Your First Channel!",
|
||||||
|
"Awesome! You just followed your first first channel.": "Awesome! You just followed your first first channel."
|
||||||
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {
|
||||||
selectCreateChannelError,
|
selectCreateChannelError,
|
||||||
selectCreatingChannel,
|
selectCreatingChannel,
|
||||||
selectBalance,
|
selectBalance,
|
||||||
|
doClearChannelErrors,
|
||||||
} from 'lbry-redux';
|
} from 'lbry-redux';
|
||||||
import { doOpenModal } from 'redux/actions/app';
|
import { doOpenModal } from 'redux/actions/app';
|
||||||
|
|
||||||
|
@ -44,6 +45,7 @@ const perform = dispatch => ({
|
||||||
const { name, amount, ...optionalParams } = params;
|
const { name, amount, ...optionalParams } = params;
|
||||||
return dispatch(doCreateChannel('@' + name, amount, optionalParams));
|
return dispatch(doCreateChannel('@' + name, amount, optionalParams));
|
||||||
},
|
},
|
||||||
|
clearChannelErrors: () => dispatch(doClearChannelErrors()),
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(select, perform)(ChannelPage);
|
export default connect(select, perform)(ChannelPage);
|
||||||
|
|
|
@ -15,6 +15,7 @@ import { MINIMUM_PUBLISH_BID, INVALID_NAME_ERROR, ESTIMATED_FEE } from 'constant
|
||||||
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'component/common/tabs';
|
import { Tabs, TabList, Tab, TabPanels, TabPanel } from 'component/common/tabs';
|
||||||
import Card from 'component/common/card';
|
import Card from 'component/common/card';
|
||||||
import * as PAGES from 'constants/pages';
|
import * as PAGES from 'constants/pages';
|
||||||
|
import analytics from 'analytics';
|
||||||
const MAX_TAG_SELECT = 5;
|
const MAX_TAG_SELECT = 5;
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
@ -37,6 +38,7 @@ type Props = {
|
||||||
createChannel: any => Promise<any>,
|
createChannel: any => Promise<any>,
|
||||||
createError: string,
|
createError: string,
|
||||||
creatingChannel: boolean,
|
creatingChannel: boolean,
|
||||||
|
clearChannelErrors: () => void,
|
||||||
onDone: () => void,
|
onDone: () => void,
|
||||||
openModal: (
|
openModal: (
|
||||||
id: string,
|
id: string,
|
||||||
|
@ -65,6 +67,7 @@ function ChannelForm(props: Props) {
|
||||||
createChannel,
|
createChannel,
|
||||||
creatingChannel,
|
creatingChannel,
|
||||||
createError,
|
createError,
|
||||||
|
clearChannelErrors,
|
||||||
openModal,
|
openModal,
|
||||||
} = props;
|
} = props;
|
||||||
const [nameError, setNameError] = React.useState(undefined);
|
const [nameError, setNameError] = React.useState(undefined);
|
||||||
|
@ -121,10 +124,10 @@ function ChannelForm(props: Props) {
|
||||||
|
|
||||||
if (bid <= 0.0 || isNaN(bid)) {
|
if (bid <= 0.0 || isNaN(bid)) {
|
||||||
setBidError(__('Deposit cannot be 0'));
|
setBidError(__('Deposit cannot be 0'));
|
||||||
} else if (totalAvailableBidAmount - bid < ESTIMATED_FEE) {
|
|
||||||
setBidError(__('Please decrease your deposit to account for transaction fees'));
|
|
||||||
} else if (totalAvailableBidAmount < bid) {
|
} else if (totalAvailableBidAmount < bid) {
|
||||||
setBidError(__('Deposit cannot be higher than your balance'));
|
setBidError(__('Deposit cannot be higher than your balance'));
|
||||||
|
} else if (totalAvailableBidAmount - bid < ESTIMATED_FEE) {
|
||||||
|
setBidError(__('Please decrease your deposit to account for transaction fees'));
|
||||||
} else if (bid < MINIMUM_PUBLISH_BID) {
|
} else if (bid < MINIMUM_PUBLISH_BID) {
|
||||||
setBidError(__('Your deposit must be higher'));
|
setBidError(__('Your deposit must be higher'));
|
||||||
} else {
|
} else {
|
||||||
|
@ -150,6 +153,7 @@ function ChannelForm(props: Props) {
|
||||||
} else {
|
} else {
|
||||||
createChannel(params).then(success => {
|
createChannel(params).then(success => {
|
||||||
if (success) {
|
if (success) {
|
||||||
|
analytics.apiLogPublish(success);
|
||||||
onDone();
|
onDone();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -167,6 +171,10 @@ function ChannelForm(props: Props) {
|
||||||
setNameError(nameError);
|
setNameError(nameError);
|
||||||
}, [name]);
|
}, [name]);
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
clearChannelErrors();
|
||||||
|
}, [clearChannelErrors]);
|
||||||
|
|
||||||
// TODO clear and bail after submit
|
// TODO clear and bail after submit
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -357,7 +365,9 @@ function ChannelForm(props: Props) {
|
||||||
<div className="section__actions">
|
<div className="section__actions">
|
||||||
<Button
|
<Button
|
||||||
button="primary"
|
button="primary"
|
||||||
disabled={creatingChannel || updatingChannel}
|
disabled={
|
||||||
|
creatingChannel || updatingChannel || nameError || bidError || (isNewChannel && !params.name)
|
||||||
|
}
|
||||||
label={creatingChannel || updatingChannel ? __('Submitting') : __('Submit')}
|
label={creatingChannel || updatingChannel ? __('Submitting') : __('Submit')}
|
||||||
onClick={handleSubmit}
|
onClick={handleSubmit}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -3,9 +3,10 @@ import React from 'react';
|
||||||
import ChannelEdit from 'component/channelEdit';
|
import ChannelEdit from 'component/channelEdit';
|
||||||
import Page from 'component/page';
|
import Page from 'component/page';
|
||||||
import { withRouter } from 'react-router';
|
import { withRouter } from 'react-router';
|
||||||
|
import * as PAGES from 'constants/pages';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
history: { goBack: () => void },
|
history: { push: string => void, goBack: () => void },
|
||||||
};
|
};
|
||||||
|
|
||||||
function ChannelNew(props: Props) {
|
function ChannelNew(props: Props) {
|
||||||
|
@ -16,7 +17,7 @@ function ChannelNew(props: Props) {
|
||||||
backout={{ backFunction: () => history.goBack(), title: __('Create Channel') }}
|
backout={{ backFunction: () => history.goBack(), title: __('Create Channel') }}
|
||||||
className="main--auth-page"
|
className="main--auth-page"
|
||||||
>
|
>
|
||||||
<ChannelEdit onDone={history.goBack} />
|
<ChannelEdit onDone={() => history.push(`/$/${PAGES.CHANNELS}`)} />
|
||||||
</Page>
|
</Page>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6347,9 +6347,9 @@ lazy-val@^1.0.4:
|
||||||
yargs "^13.2.2"
|
yargs "^13.2.2"
|
||||||
zstd-codec "^0.1.1"
|
zstd-codec "^0.1.1"
|
||||||
|
|
||||||
lbry-redux@lbryio/lbry-redux#c0bfa4d32005266d41df18a19c93914c426a8067:
|
lbry-redux@lbryio/lbry-redux#906199d866a187015668a27363f010828c15979a:
|
||||||
version "0.0.1"
|
version "0.0.1"
|
||||||
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/c0bfa4d32005266d41df18a19c93914c426a8067"
|
resolved "https://codeload.github.com/lbryio/lbry-redux/tar.gz/906199d866a187015668a27363f010828c15979a"
|
||||||
dependencies:
|
dependencies:
|
||||||
proxy-polyfill "0.1.6"
|
proxy-polyfill "0.1.6"
|
||||||
reselect "^3.0.0"
|
reselect "^3.0.0"
|
||||||
|
|
Loading…
Add table
Reference in a new issue