Skip to content

Commit

Permalink
add subheadings to channel page dropdown and correct wallet text on c…
Browse files Browse the repository at this point in the history
…reator dashboard
  • Loading branch information
jlbyrne committed Nov 21, 2023
1 parent efa4ba2 commit 3340641
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 15 deletions.
10 changes: 7 additions & 3 deletions app/javascript/locale/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,13 @@ export default {
},
verify: "Continue to Verify",
addCryptoWidget: {
addWallet: "Add new wallet",
addWallet: "Add new crypto address",
solanaConnectError: "Connect a Solana wallet to add an address",
ethereumConnectError: "Connect an Ethereum wallet to add an address",
widgetTitle: "P2P WALLETS",
widgetTitle: "Crypto addresses",
ethereum: "Ethereum",
ethereumBAT: "Basic Attention Token",
solanaBAT: "Basic Attention Token (Portal)",
solanaBAT: "Basic Attention Token (Wormhole)",
solana: "Solana",
genericError: "An error occurred. Please try again later.",
addressConnectFailure: "Connecting new address failed",
Expand All @@ -343,6 +343,10 @@ export default {
ethereumNetwork: "Ethereum Network",
ethereumBATNetwork: "Basic Attention Token",
solanaNetwork: "Solana Network",
ethSubheading: 'ETH',
ethBatSubheading: "ERC-20 BAT",
solSubheading: 'SOL',
solBatSubheading: 'SPL-BAT (Wormhole)',
share: "Share your support",
goBack: "Go back",
thanks: "Thanks for supporting your favorite creators",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class CryptoWalletServices extends React.Component {
formatOptionData(response, chain) {
const options = response.data.filter( address => address.chain === chain)
.map( address => { return { value: address, label: address.address}})
options.push({label: 'Add new wallet', value: {newAddress: chain}});
options.push({label: this.intl.formatMessage({id: 'walletServices.addCryptoWidget.addWallet'}), value: {newAddress: chain}});
return options;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import * as React from "react";
import { injectIntl } from "react-intl";
import { CryptoOption } from "./PublicChannelPageStyle.js";
import { CryptoOption, CryptoOptionSubheading, CryptoOptionText } from "./PublicChannelPageStyle.js";

class CryptoPaymentOption extends React.Component {
constructor(props) {
super(props);

this.state = {
label: this.props.label,
value: this.props.value,
innerProps: this.props.innerProps,
icon: this.props.data.icon,
subheading: this.props.data.subheading,
};
}

Expand All @@ -18,7 +20,10 @@ class CryptoPaymentOption extends React.Component {
<CryptoOption {...this.state.innerProps} >
<span>
<img src={this.state.icon} />
<span>{this.state.label}</span>
<CryptoOptionText>
<span>{this.state.label}</span>
<CryptoOptionSubheading>{this.state.subheading}</CryptoOptionSubheading>
</ CryptoOptionText>
</span>
</CryptoOption>
)
Expand Down
43 changes: 36 additions & 7 deletions app/javascript/views/publicChannelPage/CryptoPaymentWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
createTransferInstruction,
} from "@solana/spl-token";
import axios from "axios";
import Select from 'react-select';
import Select, { components } from 'react-select';
import routes from "../routes";
import Modal, { ModalSize } from "../../components/modal/Modal";
import QRCodeModal from "./QRCodeModal";
Expand All @@ -46,6 +46,7 @@ import {
ErrorText,
ErrorMessage,
ErrorTitle,
CryptoOptionSubheading,
} from "./PublicChannelPageStyle.js";
import ethIcon from "../../../assets/images/eth_icon_larger.png";
import solIcon from "../../../assets/images/solana_icon_larger.png";
Expand Down Expand Up @@ -74,8 +75,18 @@ class CryptoPaymentWidget extends React.Component {
dropdownOptions.push({
label: this.intl.formatMessage({ id: 'publicChannelPage.ethereumNetwork' }),
options: [
{ label: this.intl.formatMessage({ id: 'walletServices.addCryptoWidget.ethereum' }), value: "ETH", icon: ethIcon },
{ label: this.intl.formatMessage({ id: 'walletServices.addCryptoWidget.ethereumBAT' }), value: "BAT", icon: batIcon }
{
label: this.intl.formatMessage({ id: 'walletServices.addCryptoWidget.ethereum' }),
subheading: this.intl.formatMessage({id: 'publicChannelPage.ethSubheading'}),
value: "ETH",
icon: ethIcon
},
{
label: this.intl.formatMessage({ id: 'walletServices.addCryptoWidget.ethereumBAT' }),
subheading: this.intl.formatMessage({id: 'publicChannelPage.ethBatSubheading'}),
value: "BAT",
icon: batIcon
}
]
})
}
Expand All @@ -84,8 +95,18 @@ class CryptoPaymentWidget extends React.Component {
dropdownOptions.push({
label: this.intl.formatMessage({ id: 'publicChannelPage.solanaNetwork' }),
options: [
{ label: this.intl.formatMessage({ id: 'walletServices.addCryptoWidget.solana' }), value: "SOL", icon: solIcon },
{ label: this.intl.formatMessage({ id: 'walletServices.addCryptoWidget.solanaBAT' }), value: "splBAT", icon: batIcon }
{
label: this.intl.formatMessage({ id: 'walletServices.addCryptoWidget.solana' }),
subheading: this.intl.formatMessage({id: 'publicChannelPage.solSubheading'}),
value: "SOL",
icon: solIcon
},
{
label: this.intl.formatMessage({ id: 'walletServices.addCryptoWidget.solanaBAT' }),
subheading: this.intl.formatMessage({id: 'publicChannelPage.solBatSubheading'}),
value: "splBAT",
icon: batIcon
}
]
})
}
Expand Down Expand Up @@ -415,6 +436,7 @@ class CryptoPaymentWidget extends React.Component {
const newState = {...this.state};
newState.currentChain = optionVal.value;
newState.selectValue = optionVal;
console.log(optionVal);
newState.displayChain = optionVal.value.includes("BAT") ? 'BAT' : optionVal.value;
this.setState({...newState });
}
Expand Down Expand Up @@ -466,16 +488,23 @@ class CryptoPaymentWidget extends React.Component {
options={this.state.dropdownOptions}
onChange={this.changeChain.bind(this)}
components={{
Option: CryptoPaymentOption,
SingleValue: ({ children, ...rest }) => (
<components.SingleValue {...rest}>
{children}
<CryptoOptionSubheading>{rest.data.subheading}</CryptoOptionSubheading>
</components.SingleValue>
),
Option: CryptoPaymentOption
}}
value={this.state.selectValue}
styles={{
control: (base) => ({ ...base, border: 'none', boxShadow: 'none' }),
groupHeading: (base) => ({...base, textAlign: 'left', marginLeft: '16px'}),
groupHeading: (base) => ({...base, textAlign: 'left', marginLeft: '16px', fontSize: '11px'}),
indicatorSeparator: (base) => ({...base, display: 'none'}),
input: (base) => ({...base, caretColor: 'transparent' }),
valueContainer: (base) => ({
...base,
display: 'flex',
textAlign: 'left',
padding: '16px',
fontWeight: '600',
Expand Down
17 changes: 15 additions & 2 deletions app/javascript/views/publicChannelPage/PublicChannelPageStyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,24 @@ export const CryptoOption = styled.div`
img {
margin-right: 16px;
height: 28px;
width: 28px;
height: 32px;
width: 32px;
display: inline-block;
vertical-align: middle;
}
`;

export const CryptoOptionText = styled.div`
display: inline-block;
font-size: 14px;
`;

export const CryptoOptionSubheading = styled.div`
font-weight: 400;
font-family: 'Inter', sans-serif;
font-size: 12px;
`;

export const AmountButton = styled.button`
background-color: #FFFFFF;
border: 1px solid #A1ABBA;
Expand Down

0 comments on commit 3340641

Please sign in to comment.