mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-09-01 17:55:11 +00:00
Displays snackBar for any successful trasaction.
Also, minor changes to tip form css, to increase gap between select box and tip button.
This commit is contained in:
parent
ba6d093d1c
commit
7ce5d596b8
8 changed files with 24 additions and 41 deletions
|
@ -5,7 +5,7 @@ import {
|
||||||
selectDraftTransactionAmount,
|
selectDraftTransactionAmount,
|
||||||
selectBalance,
|
selectBalance,
|
||||||
} from "selectors/wallet";
|
} from "selectors/wallet";
|
||||||
import { doOpenModal } from "actions/app";
|
import { doOpenModal, doShowSnackBar } from "actions/app";
|
||||||
import * as modals from "constants/modal_types";
|
import * as modals from "constants/modal_types";
|
||||||
|
|
||||||
export function doUpdateBalance(balance) {
|
export function doUpdateBalance(balance) {
|
||||||
|
@ -86,7 +86,13 @@ export function doSendDraftTransaction() {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: types.SEND_TRANSACTION_COMPLETED,
|
type: types.SEND_TRANSACTION_COMPLETED,
|
||||||
});
|
});
|
||||||
dispatch(doOpenModal(modals.TRANSACTION_SUCCESSFUL));
|
dispatch(
|
||||||
|
doShowSnackBar({
|
||||||
|
message: __(`You sent ${amount} LBC`),
|
||||||
|
linkText: __("History"),
|
||||||
|
linkTarget: __("/wallet"),
|
||||||
|
})
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
dispatch({
|
dispatch({
|
||||||
type: types.SEND_TRANSACTION_FAILED,
|
type: types.SEND_TRANSACTION_FAILED,
|
||||||
|
|
|
@ -8,7 +8,6 @@ import ModalInsufficientCredits from "component/modalInsufficientCredits";
|
||||||
import ModalUpgrade from "component/modalUpgrade";
|
import ModalUpgrade from "component/modalUpgrade";
|
||||||
import ModalWelcome from "component/modalWelcome";
|
import ModalWelcome from "component/modalWelcome";
|
||||||
import ModalFirstReward from "component/modalFirstReward";
|
import ModalFirstReward from "component/modalFirstReward";
|
||||||
import ModalTransactionSuccessful from "component/modalTransactionSuccessful";
|
|
||||||
import ModalTransactionFailed from "component/modalTransactionFailed";
|
import ModalTransactionFailed from "component/modalTransactionFailed";
|
||||||
import ModalInsufficientBalance from "component/modalInsufficientBalance";
|
import ModalInsufficientBalance from "component/modalInsufficientBalance";
|
||||||
import lbry from "lbry";
|
import lbry from "lbry";
|
||||||
|
@ -81,8 +80,6 @@ class App extends React.PureComponent {
|
||||||
{modal == modals.WELCOME && <ModalWelcome />}
|
{modal == modals.WELCOME && <ModalWelcome />}
|
||||||
{modal == modals.FIRST_REWARD && <ModalFirstReward />}
|
{modal == modals.FIRST_REWARD && <ModalFirstReward />}
|
||||||
{modal == modals.AUTHENTICATION_FAILURE && <ModalAuthFailure />}
|
{modal == modals.AUTHENTICATION_FAILURE && <ModalAuthFailure />}
|
||||||
{modal == modals.TRANSACTION_SUCCESSFUL &&
|
|
||||||
<ModalTransactionSuccessful />}
|
|
||||||
{modal == modals.TRANSACTION_FAILED && <ModalTransactionFailed />}
|
{modal == modals.TRANSACTION_FAILED && <ModalTransactionFailed />}
|
||||||
{modal == modals.INSUFFICIENT_BALANCE && <ModalInsufficientBalance />}
|
{modal == modals.INSUFFICIENT_BALANCE && <ModalInsufficientBalance />}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
import React from "react";
|
|
||||||
import { connect } from "react-redux";
|
|
||||||
import { doCloseModal } from "actions/app";
|
|
||||||
import ModalTransactionSuccessful from "./view";
|
|
||||||
|
|
||||||
const select = state => ({});
|
|
||||||
|
|
||||||
const perform = dispatch => ({
|
|
||||||
closeModal: () => dispatch(doCloseModal()),
|
|
||||||
});
|
|
||||||
|
|
||||||
export default connect(select, perform)(ModalTransactionSuccessful);
|
|
|
@ -1,20 +0,0 @@
|
||||||
import React from "react";
|
|
||||||
import { Modal } from "component/modal";
|
|
||||||
|
|
||||||
class ModalTransactionSuccessful extends React.PureComponent {
|
|
||||||
render() {
|
|
||||||
const { closeModal } = this.props;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Modal
|
|
||||||
isOpen={true}
|
|
||||||
contentLabel={__("Transaction successful")}
|
|
||||||
onConfirmed={closeModal}
|
|
||||||
>
|
|
||||||
{__("Your transaction was successfully placed in the queue.")}
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ModalTransactionSuccessful;
|
|
|
@ -10,10 +10,11 @@ const PriceForm = props => {
|
||||||
placeholder,
|
placeholder,
|
||||||
min,
|
min,
|
||||||
step,
|
step,
|
||||||
|
isTip,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span>
|
<span className={"form-field " + (isTip ? "form-field--tip " : " ")}>
|
||||||
<FormField
|
<FormField
|
||||||
type="number"
|
type="number"
|
||||||
min={min}
|
min={min}
|
||||||
|
|
|
@ -14,6 +14,7 @@ class TipLink extends React.PureComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
handleTipPublisherButtonClicked() {
|
handleTipPublisherButtonClicked() {
|
||||||
|
this.resetDefaults();
|
||||||
this.props.onTipShow();
|
this.props.onTipShow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +45,13 @@ class TipLink extends React.PureComponent {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetDefaults() {
|
||||||
|
this.setState({
|
||||||
|
feeAmount: "1.00",
|
||||||
|
currency: "LBC",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { showTipBox } = this.props;
|
const { showTipBox } = this.props;
|
||||||
|
|
||||||
|
@ -59,15 +67,15 @@ class TipLink extends React.PureComponent {
|
||||||
let tipBox = (
|
let tipBox = (
|
||||||
<span>
|
<span>
|
||||||
<PriceForm
|
<PriceForm
|
||||||
|
isTip={true}
|
||||||
min="0.01"
|
min="0.01"
|
||||||
placeholder="1.00"
|
placeholder="1.00"
|
||||||
step="0.1"
|
step="0.1"
|
||||||
onFeeChange={event => this.handleFeeAmountChange(event)}
|
onFeeChange={event => this.handleFeeAmountChange(event)}
|
||||||
defaultFeeValue="1.00"
|
defaultFeeValue={this.state.feeAmount}
|
||||||
onCurrencyChange={event => this.handleCurrencyChange(event)}
|
onCurrencyChange={event => this.handleCurrencyChange(event)}
|
||||||
defaultCurrencyValue="LBC"
|
defaultCurrencyValue="LBC"
|
||||||
/>
|
/>
|
||||||
{__(" ")}
|
|
||||||
<Link
|
<Link
|
||||||
label={__("Tip")}
|
label={__("Tip")}
|
||||||
button="primary"
|
button="primary"
|
||||||
|
|
|
@ -7,6 +7,5 @@ export const UPGRADE = "upgrade";
|
||||||
export const WELCOME = "welcome";
|
export const WELCOME = "welcome";
|
||||||
export const FIRST_REWARD = "first_reward";
|
export const FIRST_REWARD = "first_reward";
|
||||||
export const AUTHENTICATION_FAILURE = "auth_failure";
|
export const AUTHENTICATION_FAILURE = "auth_failure";
|
||||||
export const TRANSACTION_SUCCESSFUL = "transaction_successful";
|
|
||||||
export const TRANSACTION_FAILED = "transaction_failed";
|
export const TRANSACTION_FAILED = "transaction_failed";
|
||||||
export const INSUFFICIENT_BALANCE = "insufficient_balance";
|
export const INSUFFICIENT_BALANCE = "insufficient_balance";
|
||||||
|
|
|
@ -166,3 +166,7 @@ input[type="text"].input-copyable {
|
||||||
.form-field__input.form-field__input-SimpleMDE .CodeMirror-scroll {
|
.form-field__input.form-field__input-SimpleMDE .CodeMirror-scroll {
|
||||||
height: auto;
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.form-field--tip {
|
||||||
|
padding-right: 15px;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue