Skip to content

Commit

Permalink
Merge pull request #331 from Lumerin-protocol/stg
Browse files Browse the repository at this point in the history
Main 1.2.47
  • Loading branch information
LumerinIO authored Dec 7, 2023
2 parents c6421d9 + b838e6c commit ba22f3a
Show file tree
Hide file tree
Showing 7 changed files with 314 additions and 215 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lumerin-wallet-desktop",
"version": "1.2.46",
"version": "1.2.47",
"engines": {
"node": ">=14"
},
Expand Down Expand Up @@ -43,7 +43,7 @@
},
"dependencies": {
"@electron/remote": "2.0.9",
"@lumerin/wallet-core": "git+ssh://[email protected]:Lumerin-protocol/WalletCore.git#1.0.83",
"@lumerin/wallet-core": "git+ssh://[email protected]:Lumerin-protocol/WalletCore.git#1.0.84",
"@reach/menu-button": "0.17.0",
"@tabler/icons": "1.119.0",
"axios": "0.27.2",
Expand Down
1 change: 0 additions & 1 deletion src/components/toasts/Toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ export default class Toast extends React.Component {
key: msg,
data: msg,
style: {
maxHeight: spring(50, { stiffness: 150, damping: 20 }),
opacity: spring(1, { stiffness: 60, damping: 5 })
}
}))}
Expand Down
2 changes: 1 addition & 1 deletion src/components/tools/ExportPrivateKeyModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
ConfirmBtn,
Row
} from './ConfirmModal.styles';
import { Input } from './Tools';
import { useState } from 'react';
import { Input } from './common';

const PrivateKey = styled.div`
word-break: break-word;
Expand Down
229 changes: 229 additions & 0 deletions src/components/tools/ProxyConfigPanel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
//ts-check

import React, { useState } from 'react';
import { Sp } from '../common';
import Spinner from '../common/Spinner';
import ConfirmProxyConfigModal from './ConfirmProxyConfigModal';
import { generatePoolUrl } from '../../utils';
import { validatePoolAddress } from '../../store/validators';

import 'react-tabs/style/react-tabs.css';
import './styles.css';

import {
ErrorLabel,
StyledBtn,
Subtitle,
StyledParagraph,
Input
} from './common';

function RemoteProxyConfig() {
return (
<StyledParagraph>
You are running Wallet wihout Proxy-Router. Reset wallet to setup
validator node.
</StyledParagraph>
);
}

function TitanLightningProxyPanel(props) {
const { titanLightningDashboard, sellerPoolParts } = props;
return (
<>
<StyledParagraph>
<div>
<span>Titan Lightning Address:</span> {sellerPoolParts?.account}{' '}
</div>
<p
style={{
textDecoration: 'underline',
cursor: 'pointer'
}}
data-tooltip={titanLightningDashboard}
onClick={() => {
window.open(titanLightningDashboard, '_blank');
}}
>
Dashboard for Lightning users
</p>
</StyledParagraph>
</>
);
}

function ProxyConfigView(props) {
const { isTitanLightning, sellerPoolParts, proxyRouterEditClick } = props;
return (
<>
{isTitanLightning ? (
<TitanLightningProxyPanel {...props} />
) : (
<StyledParagraph>
<div>
<span>Proxy Default Pool:</span> {sellerPoolParts?.pool}{' '}
</div>
<div>
<span>Proxy Default Account:</span> {sellerPoolParts?.account}{' '}
</div>
</StyledParagraph>
)}
<StyledBtn onClick={proxyRouterEditClick}>Edit</StyledBtn>
</>
);
}

function ProxyConfigEdit(props) {
const {
isTitanLightning,
sellerPoolParts,
setSellerPoolParts,
errors,
setErrors
} = props;

const onChangePoolAddess = address => {
const result = validatePoolAddress(address, {});

setErrors({
...errors,
proxyDefaultPool: result.proxyDefaultPool || null
});

setSellerPoolParts({
...sellerPoolParts,
pool: address,
isTitanLightning
});
};

return (
<>
{isTitanLightning ? (
<StyledParagraph>
Titan Lightning Address:
<Input
placeholder={'[email protected]'}
onChange={e =>
setSellerPoolParts({
...sellerPoolParts,
account: e.value
})
}
value={sellerPoolParts?.account}
/>
</StyledParagraph>
) : (
<>
<StyledParagraph>
Proxy Default Pool Host & Port:{' '}
<Input
placeholder="example: btc.global.luxor.tech:8888"
onChange={e => onChangePoolAddess(e.value)}
value={sellerPoolParts?.pool}
/>
{errors?.proxyDefaultPool && (
<ErrorLabel>{errors?.proxyDefaultPool}</ErrorLabel>
)}
</StyledParagraph>
<StyledParagraph>
Proxy Default Account:
<Input
placeholder="[email protected]"
onChange={e =>
setSellerPoolParts({
...sellerPoolParts,
account: e.value
})
}
value={sellerPoolParts?.account}
/>
</StyledParagraph>
</>
)}
</>
);
}

export function ProxyConfigPanel(props) {
const [errors, setErrors] = useState({});

return !props.isLocalProxyRouter ? (
<RemoteProxyConfig />
) : (
<>
<Sp mt={5}>
<Subtitle>Proxy-Router Configuration</Subtitle>
{props.proxyRouterSettings.isFetching ? (
<Spinner />
) : props.proxyRouterSettings.proxyRouterEditMode ? (
<>
<div style={{ display: 'flex' }}>
<span>Use Titan Pool for Lightning Payouts</span>
<input
style={{ marginLeft: '10px' }}
data-testid="use-titan-lightning"
onChange={() => {
props.toggleIsLightning();
}}
checked={props.isTitanLightning}
type="checkbox"
id="isTitanLightning"
/>
</div>
<ProxyConfigEdit {...props} errors={errors} setErrors={setErrors} />
<hr></hr>
<StyledBtn
disabled={!!errors?.proxyDefaultPool}
onClick={() => {
props.setProxyRouterSettings({
...props.proxyRouterSettings,
isTitanLightning: props.isTitanLightning,
sellerDefaultPool: generatePoolUrl(
props.sellerPoolParts.account,
!props.isTitanLightning
? props.sellerPoolParts.pool
: props.titanLightningPool
)
});
props.onActiveModalClick('confirm-proxy-restart');
}}
>
Save
</StyledBtn>
</>
) : (
<ProxyConfigView {...props} />
)}

<ConfirmProxyConfigModal
onRequestClose={props.onCloseModal}
onConfirm={props.confirmProxyRouterRestart}
onLater={props.saveProxyRouterConfig}
isOpen={props.state.activeModal === 'confirm-proxy-restart'}
/>
</Sp>
<Sp mt={5}>
<Subtitle>Restart Proxy Router</Subtitle>
<StyledParagraph>Restart the connected Proxy Router.</StyledParagraph>
{props.isRestarting ? (
<Spinner size="20px" />
) : (
<StyledBtn
onClick={() =>
props.onActiveModalClick('confirm-proxy-direct-restart')
}
>
Restart
</StyledBtn>
)}
<ConfirmProxyConfigModal
onRequestClose={props.onCloseModal}
onConfirm={props.onRestartClick}
onLater={props.onCloseModal}
isOpen={props.state.activeModal === 'confirm-proxy-direct-restart'}
/>
</Sp>
</>
);
}
7 changes: 3 additions & 4 deletions src/components/tools/RevealSecretPhraseModal.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import PropTypes from 'prop-types';
import styled from 'styled-components';
import React, { useEffect } from 'react';
import React, { useState } from 'react';

import { Modal, BaseBtn } from '../common';
import { Modal } from '../common';
import {
Container,
Message,
Row,
DismissBtn,
ConfirmBtn
} from './ConfirmModal.styles';
import { Input } from './Tools';
import { useState } from 'react';
import { Input } from './common';

const Mnemonic = styled.div`
padding: 10px 0;
Expand Down
Loading

0 comments on commit ba22f3a

Please sign in to comment.