Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/components/Configure/Configure.js
/* eslint-disable react-hooks/exhaustive-deps */ | /* eslint-disable react-hooks/exhaustive-deps */ | ||||
import React, { useState, useEffect } from 'react'; | import React, { useState, useEffect } from 'react'; | ||||
import styled from 'styled-components'; | import styled from 'styled-components'; | ||||
import { Collapse, Form, Input, Modal, Spin, Alert } from 'antd'; | import { Collapse, Form, Input, Modal, Spin, Alert } from 'antd'; | ||||
import { | import { | ||||
PlusSquareOutlined, | PlusSquareOutlined, | ||||
WalletFilled, | WalletFilled, | ||||
ImportOutlined, | ImportOutlined, | ||||
LockOutlined, | LockOutlined, | ||||
} from '@ant-design/icons'; | } from '@ant-design/icons'; | ||||
import { WalletContext } from '@utils/context'; | import { WalletContext } from '@utils/context'; | ||||
import { StyledCollapse } from '@components/Common/StyledCollapse'; | import { StyledCollapse } from '@components/Common/StyledCollapse'; | ||||
import { AntdFormWrapper } from '@components/Common/EnhancedInputs'; | import { | ||||
AntdFormWrapper, | |||||
CurrencySelectDropdown, | |||||
} from '@components/Common/EnhancedInputs'; | |||||
import PrimaryButton, { | import PrimaryButton, { | ||||
SecondaryButton, | SecondaryButton, | ||||
SmartButton, | SmartButton, | ||||
} from '@components/Common/PrimaryButton'; | } from '@components/Common/PrimaryButton'; | ||||
import { | import { | ||||
CashLoader, | CashLoader, | ||||
CashLoadingIcon, | CashLoadingIcon, | ||||
ThemedCopyOutlined, | ThemedCopyOutlined, | ||||
ThemedWalletOutlined, | ThemedWalletOutlined, | ||||
ThemedDollarOutlined, | |||||
} from '@components/Common/CustomIcons'; | } from '@components/Common/CustomIcons'; | ||||
import { ReactComponent as Trashcan } from '@assets/trashcan.svg'; | import { ReactComponent as Trashcan } from '@assets/trashcan.svg'; | ||||
import { ReactComponent as Edit } from '@assets/edit.svg'; | import { ReactComponent as Edit } from '@assets/edit.svg'; | ||||
import { Event } from '@utils/GoogleAnalytics'; | import { Event } from '@utils/GoogleAnalytics'; | ||||
const { Panel } = Collapse; | const { Panel } = Collapse; | ||||
const SettingsLink = styled.a` | const SettingsLink = styled.a` | ||||
▲ Show 20 Lines • Show All 136 Lines • ▼ Show 20 Lines | const Configure = () => { | ||||
const { | const { | ||||
addNewSavedWallet, | addNewSavedWallet, | ||||
activateWallet, | activateWallet, | ||||
renameWallet, | renameWallet, | ||||
deleteWallet, | deleteWallet, | ||||
validateMnemonic, | validateMnemonic, | ||||
getSavedWallets, | getSavedWallets, | ||||
cashtabSettings, | |||||
changeCashtabSettings, | |||||
} = ContextValue; | } = ContextValue; | ||||
const [savedWallets, setSavedWallets] = useState([]); | const [savedWallets, setSavedWallets] = useState([]); | ||||
const [formData, setFormData] = useState({ | const [formData, setFormData] = useState({ | ||||
dirty: true, | dirty: true, | ||||
mnemonic: '', | mnemonic: '', | ||||
}); | }); | ||||
const [showRenameWalletModal, setShowRenameWalletModal] = useState(false); | const [showRenameWalletModal, setShowRenameWalletModal] = useState(false); | ||||
const [showDeleteWalletModal, setShowDeleteWalletModal] = useState(false); | const [showDeleteWalletModal, setShowDeleteWalletModal] = useState(false); | ||||
▲ Show 20 Lines • Show All 394 Lines • ▼ Show 20 Lines | return ( | ||||
</SWButtonCtn> | </SWButtonCtn> | ||||
</SWRow> | </SWRow> | ||||
))} | ))} | ||||
</div> | </div> | ||||
</Panel> | </Panel> | ||||
</StyledCollapse> | </StyledCollapse> | ||||
</> | </> | ||||
)} | )} | ||||
<StyledSpacer /> | |||||
<h2> | |||||
<ThemedDollarOutlined /> Fiat Currency | |||||
</h2> | |||||
<AntdFormWrapper> | |||||
<CurrencySelectDropdown | |||||
defaultValue={ | |||||
cashtabSettings && cashtabSettings.fiatCurrency | |||||
? cashtabSettings.fiatCurrency | |||||
: 'usd' | |||||
} | |||||
onChange={fiatCode => | |||||
changeCashtabSettings('fiatCurrency', fiatCode) | |||||
} | |||||
/> | |||||
</AntdFormWrapper> | |||||
<StyledSpacer />[ | <StyledSpacer />[ | ||||
<SettingsLink | <SettingsLink | ||||
type="link" | type="link" | ||||
href="https://docs.cashtabapp.com/docs/" | href="https://docs.cashtabapp.com/docs/" | ||||
target="_blank" | target="_blank" | ||||
rel="noreferrer" | rel="noreferrer" | ||||
> | > | ||||
Documentation | Documentation | ||||
</SettingsLink> | </SettingsLink> | ||||
] | ] | ||||
</StyledConfigure> | </StyledConfigure> | ||||
</Spin> | </Spin> | ||||
); | ); | ||||
}; | }; | ||||
export default Configure; | export default Configure; |