-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve master wallet management (#705)
* master wallet management * bump * fix format money Co-authored-by: Michiel <michiel@deroos.ca>
- Loading branch information
1 parent
07703a4
commit 212ce6b
Showing
10 changed files
with
144 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import React from "react"; | ||
import { useSelector, useDispatch } from "react-redux"; | ||
import { Modal, Tooltip, List } from "antd"; | ||
|
||
import { DollarCircleOutlined } from "@ant-design/icons"; | ||
import { grey } from "@ant-design/colors"; | ||
import { Organisation } from "../../reducers/organisation/types"; | ||
import { ReduxState } from "../../reducers/rootReducer"; | ||
import { LoginAction } from "../../reducers/auth/actions"; | ||
import { formatMoney, getActiveToken } from "../../utils"; | ||
|
||
interface OuterProps { | ||
isModalVisible: boolean; | ||
handleOk: any; | ||
handleCancel: any; | ||
} | ||
|
||
export const WalletListModal = (props: OuterProps) => { | ||
const dispatch: any = useDispatch(); | ||
const organisations: Organisation[] = useSelector((state: ReduxState) => | ||
Object.keys(state.organisations.byId).map( | ||
id => state.organisations.byId[Number(id)] | ||
) | ||
); | ||
const activeToken = useSelector((state: ReduxState) => getActiveToken(state)); | ||
const symbol = activeToken && activeToken.symbol; | ||
|
||
let selectOrg = (organisationIds: number[]) => { | ||
dispatch( | ||
LoginAction.updateActiveOrgRequest({ | ||
organisationIds, | ||
isManageWallet: true | ||
}) | ||
); | ||
}; | ||
|
||
return ( | ||
<span> | ||
<Tooltip title={"Manage Project Master Wallet's"} placement="rightTop"> | ||
<a | ||
onClick={props.handleOk} | ||
style={{ padding: "0 0 0 5px", color: grey[4] }} | ||
> | ||
<DollarCircleOutlined translate={""} /> | ||
</a> | ||
</Tooltip> | ||
<Modal | ||
zIndex={1051} | ||
title="Project Wallet's" | ||
visible={props.isModalVisible} | ||
onOk={props.handleOk} | ||
onCancel={props.handleCancel} | ||
> | ||
<List | ||
dataSource={organisations} | ||
renderItem={org => ( | ||
<List.Item | ||
actions={[ | ||
<a key="list-loadmore-edit" onClick={() => selectOrg([org.id])}> | ||
Manage | ||
</a> | ||
]} | ||
> | ||
<List.Item.Meta | ||
title={org.name} | ||
description={`Balance: ${formatMoney( | ||
org.master_wallet_balance / 100, | ||
0, | ||
undefined, | ||
undefined, | ||
symbol | ||
)}`} | ||
/> | ||
</List.Item> | ||
)} | ||
/> | ||
</Modal> | ||
</span> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters