Skip to content
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ jobs:
- uses: actions/checkout@v3
if: github.event.pull_request.draft == false

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: lts/Iron

- run: npm install --no-audit
- run: |
npm run download-binaries-linux
chmod +x bin/linux/xlite-daemon*
- run: npm run build-native-linux

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: artifacts-linux
path: |
Expand All @@ -60,9 +60,9 @@ jobs:
- uses: actions/checkout@v3
if: github.event.pull_request.draft == false

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: lts/Iron

- name: Set up Python
uses: actions/setup-python@v4
Expand All @@ -75,7 +75,7 @@ jobs:
chmod +x bin/mac/xlite-daemon*
- run: npm run build-native-mac

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: artifacts-mac
path: |
Expand All @@ -102,15 +102,15 @@ jobs:
- uses: actions/checkout@v3
if: github.event.pull_request.draft == false

- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
node-version: lts/Iron

- run: npm install --no-audit
- run: npm run download-binaries-win
- run: npm run build-native-win

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: artifacts-win
path: |
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,6 @@ package-lock.json
/temp
.DS_Store
/bin
.history/
.history/
.aider*
.vscode*
96 changes: 51 additions & 45 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,65 +50,71 @@
"url": "https://github.com/blocknetdx/xlite/issues"
},
"homepage": "https://github.com/blocknetdx/xlite#readme",

"devDependencies": {
"@babel/eslint-parser": "^7.22.5",
"@babel/eslint-parser": "^7.26.10",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-transform-modules-amd": "^7.22.5",
"@babel/plugin-transform-modules-commonjs": "^7.22.5",
"@babel/preset-env": "^7.22.5",
"@babel/preset-react": "^7.22.5",
"@babel/register": "^7.22.5",
"babel-loader": "^9.1.2",
"@babel/plugin-transform-modules-amd": "^7.25.9",
"@babel/plugin-transform-modules-commonjs": "^7.26.3",
"@babel/preset-env": "^7.26.9",
"@babel/preset-react": "^7.26.3",
"@babel/register": "^7.25.9",
"babel-loader": "^10.0.0",
"colors": "^1.4.0",
"cross-env": "^7.0.2",
"electron": "^25.2.0",
"electron-builder": "24.4.0",
"electron-mocha": "^12.0.0",
"eslint": "^8.43.0",
"eslint-plugin-react": "^7.20.3",
"eslint-plugin-react-hooks": "^4.0.5",
"cross-env": "^7.0.3",
"css-loader": "^7.1.2",
"electron": "^35.0.1",
"electron-builder": "25.1.8",
"electron-mocha": "^13.1.0",
"eslint": "^9.22.0",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-react-hooks": "^5.2.0",
"extract-zip": "^2.0.1",
"jsdoc": "^4.0.2",
"mocha": "^10.2.0",
"nodemon": "^2.0.4",
"jsdoc": "^4.0.4",
"mocha": "^11.1.0",
"nodemon": "^3.1.9",
"rmrf-promise": "^1.1.0",
"should": "^13.2.3",
"webpack": "^5.88.0",
"webpack-cli": "^5.1.4",
"style-loader": "^4.0.0",
"webpack": "^5.98.0",
"webpack-cli": "^6.0.1",
"xvfb-maybe": "^0.2.1"
},
"dependencies": {
"@babel/cli": "^7.10.4",
"@babel/core": "^7.10.4",
"@babel/cli": "^7.26.4",
"@babel/core": "^7.26.10",
"@popperjs/core": "^2.11.8",
"bootstrap": "^4.5.0",
"bootstrap": "^5.3.3",
"buffer": "^6.0.3",
"crypto-browserify": "^3.12.0",
"dexie": "^3.0.2",
"electron-context-menu": "^3.6.1",
"electron-is-dev": "^2.0.0",
"electron-updater": "^6.1.1",
"follow-redirects": "^1.15.2",
"fs-extra": "^11.1.1",
"immutable": "^4.0.0-rc.12",
"jquery": "^3.7.0",
"lodash": "^4.17.20",
"mathjs": "^11.8.2",
"moment": "^2.27.0",
"node-sass": "^8.0.0",
"prop-types": "^15.7.2",
"qrcode": "^1.4.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"crypto-browserify": "^3.12.1",
"dexie": "^4.0.11",
"electron-context-menu": "^4.0.5",
"electron-is-dev": "^3.0.1",
"electron-updater": "^6.3.9",
"follow-redirects": "^1.15.9",
"fs-extra": "^11.3.0",
"immutable": "^5.0.3",
"jquery": "^3.7.1",
"lodash": "^4.17.21",
"mathjs": "^14.3.1",
"moment": "^2.30.1",
"node-sass": "^9.0.0",
"process": "^0.11.10",
"prop-types": "^15.8.1",
"qrcode": "^1.5.4",
"react": "^19.0.0",
"react-bootstrap": "^2.10.9",
"react-dom": "^19.0.0",
"react-perfect-scrollbar": "^1.5.8",
"react-redux": "^7.2.0",
"redux": "^4.2.1",
"react-redux": "^9.2.0",
"redux": "^5.0.1",
"stream-browserify": "^3.0.0",
"superagent": "^8.0.9",
"sweetalert2": "^11.4.8",
"uuid": "^9.0.0",
"superagent": "^10.2.0",
"sweetalert2": "^11.17.2",
"uuid": "^11.1.0",
"v8": "^0.1.0",
"winston": "^3.9.0"
"vm-browserify": "^1.1.2",
"winston": "^3.17.0"
},
"build": {
"asarUnpack": [
Expand Down
54 changes: 26 additions & 28 deletions src/app/components/shared/dropdown.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Copyright (c) 2020 The Blocknet developers
// Distributed under the MIT software license, see the accompanying
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.

import PropTypes from 'prop-types';
import React from 'react';
import $ from 'jquery';
import { Dropdown as BootstrapDropdown } from 'react-bootstrap';

export class DropdownItem {

/**
* @type {string}
*/
Expand All @@ -21,42 +21,40 @@ export class DropdownItem {
this.text = text;
this.value = value;
}

}

export const Dropdown = ({ items = [], placeholder = '', value = '', style = {}, onSelect }) => {

const selectedItem = items.find(i => i.value === value);
const selectedItem = items.find(i => i.value === value) || null;

return (
<div className={'dropdown'} style={style}>
<a href={'#'} ref={node => node ? $(node).dropdown() : null} className={'lw-coin-select'} data-toggle={'dropdown'}>
<div>{selectedItem ? selectedItem.text : placeholder}</div>
<i className={'fas fa-caret-down'} />
</a>
<div className={'dropdown-menu'}>
{items
.filter(i => i.value !== value)
.map(i => {
const onClick = e => {
e.preventDefault();
onSelect(i.value);
};
return (
<button key={i.value} className="dropdown-item lw-coin-select-item" type="button" onClick={onClick}>
<div>{i.text}</div>
</button>
);
})
}
</div>
</div>
<BootstrapDropdown style={style}>
<BootstrapDropdown.Toggle variant="light" className="lw-coin-select">
{selectedItem ? selectedItem.text : placeholder}
</BootstrapDropdown.Toggle>

<BootstrapDropdown.Menu>
{items.filter(i => i.value !== value).length > 0 ? (
items
.filter(i => i.value !== value)
.map(i => (
<BootstrapDropdown.Item key={i.value} onClick={() => onSelect(i.value)}>
{i.text}
</BootstrapDropdown.Item>
))
) : (
<BootstrapDropdown.Item disabled>----</BootstrapDropdown.Item>
)}
</BootstrapDropdown.Menu>
</BootstrapDropdown>
);
};

Dropdown.propTypes = {
items: PropTypes.arrayOf(PropTypes.instanceOf(DropdownItem)),
placeholder: PropTypes.string,
value: PropTypes.string,
style: PropTypes.object,
onSelect: PropTypes.func
onSelect: PropTypes.func.isRequired,
};

export default Dropdown;
79 changes: 39 additions & 40 deletions src/app/components/shared/select-wallet-dropdown.js
Original file line number Diff line number Diff line change
@@ -1,61 +1,60 @@
// Copyright (c) 2020 The Blocknet developers
// Distributed under the MIT software license, see the accompanying
// file LICENSE or http://www.opensource.org/licenses/mit-license.php.

import PropTypes from 'prop-types';
import React from 'react';
import $ from 'jquery';
import { Dropdown } from 'react-bootstrap';
import Localize from './localize';
import Wallet from '../../types/wallet-r';
import { getSrcFromSrcSet } from '../../util';

const SelectWalletDropdown = ({ selected = '', style = {}, wallets, onSelect }) => {

const wallet = wallets && wallets.find(w => w.ticker === selected) || null;

const filteredWallets = !wallets ? [] : wallets
.filter(w => w.ticker !== selected);
const wallet = wallets?.find(w => w.ticker === selected) || null;
const filteredWallets = wallets?.filter(w => w.ticker !== selected) || [];

return (
<div className={'dropdown'} style={style}>
<a href={'#'} ref={node => node ? $(node).dropdown() : null} className={'lw-coin-select'} data-toggle={'dropdown'}>
{wallet && <img alt={Localize.text('Coin icon', 'receive-modal')} src={getSrcFromSrcSet(wallet.imagePath)} srcSet={wallet.imagePath} />}
<div>{wallet && `${wallet.name} (${wallet.ticker})`}</div>
<i className={'fas fa-caret-down'} />
</a>
<div className={'dropdown-menu'}>
{wallets && filteredWallets.length > 0 ?
filteredWallets
.map(w => {
const onClick = e => {
e.preventDefault();
onSelect(w.ticker);
};
return (
<button key={w.ticker} className="dropdown-item lw-coin-select-item" type="button" onClick={onClick}>
<img alt={Localize.text('Coin icon', 'receive-modal')} src={getSrcFromSrcSet(w.imagePath)} srcSet={w.imagePath} />
<div>{`${w.name} (${w.ticker})`}</div>
</button>
);
})
:
wallets && filteredWallets.length === 0 ?
[
<button key={'empty-list-item'} className="dropdown-item lw-coin-select-item disabled" type="button">
<div>----</div>
</button>
]
:
null
}
</div>
</div>
<Dropdown style={style}>
<Dropdown.Toggle variant="light" className="lw-coin-select">
{wallet && (
<img
alt={Localize.text('Coin icon', 'receive-modal')}
src={getSrcFromSrcSet(wallet.imagePath)}
srcSet={wallet.imagePath}
style={{ marginRight: '8px', width: '24px', height: '24px' }}
/>
)}
{wallet ? `${wallet.name} (${wallet.ticker})` : Localize.text('Select Wallet', 'receive-modal')}
</Dropdown.Toggle>

<Dropdown.Menu>
{filteredWallets.length > 0 ? (
filteredWallets.map(w => (
<Dropdown.Item key={w.ticker} onClick={() => onSelect(w.ticker)}>
<img
alt={Localize.text('Coin icon', 'receive-modal')}
src={getSrcFromSrcSet(w.imagePath)}
srcSet={w.imagePath}
style={{ marginRight: '8px', width: '24px', height: '24px' }}
/>
{`${w.name} (${w.ticker})`}
</Dropdown.Item>
))
) : (
<Dropdown.Item disabled>
----
</Dropdown.Item>
)}
</Dropdown.Menu>
</Dropdown>
);
};

SelectWalletDropdown.propTypes = {
selected: PropTypes.string,
wallets: PropTypes.arrayOf(PropTypes.instanceOf(Wallet)),
style: PropTypes.object,
onSelect: PropTypes.func
onSelect: PropTypes.func.isRequired,
};

export default SelectWalletDropdown;
Loading