diff --git a/src/actions/accounts.js b/src/actions/accounts.js index bb4b20fd..ed8da2ad 100644 --- a/src/actions/accounts.js +++ b/src/actions/accounts.js @@ -14,6 +14,12 @@ export const addAccount: AddAccount = payload => ({ payload, }) +export type EditAccount = Account => { type: string, payload: Account } +export const editAccount: AddAccount = payload => ({ + type: 'DB:EDIT_ACCOUNT', + payload, +}) + type FetchAccounts = () => { type: string } export const fetchAccounts: FetchAccounts = () => ({ type: 'FETCH_ACCOUNTS', diff --git a/src/components/AccountPage.js b/src/components/AccountPage.js index e3db5bff..649c9fbf 100644 --- a/src/components/AccountPage.js +++ b/src/components/AccountPage.js @@ -5,7 +5,7 @@ import { compose } from 'redux' import { connect } from 'react-redux' import { translate } from 'react-i18next' -import { MODAL_SEND, MODAL_RECEIVE } from 'constants' +import { MODAL_SEND, MODAL_RECEIVE, MODAL_SETTINGS_ACCOUNT } from 'constants' import type { MapStateToProps } from 'react-redux' import type { T, Account, AccountData } from 'types/common' @@ -46,7 +46,7 @@ class AccountPage extends PureComponent { - {`${account.name} account`} + {account.name} @@ -70,7 +70,11 @@ class AccountPage extends PureComponent { - + + + + + ) : ( + account.name + )} + + {!editName && + nameHovered && ( + + + + )} + + + + + + + + + + + ) + }} + /> + ) + } +} + +export default connect(null, mapDispatchToProps)(SettingsAccount) diff --git a/src/components/modals/index.js b/src/components/modals/index.js index aede545a..26754eb5 100644 --- a/src/components/modals/index.js +++ b/src/components/modals/index.js @@ -1,3 +1,4 @@ export AddAccount from './AddAccount' export Receive from './Receive' export Send from './Send' +export SettingsAccount from './SettingsAccount' diff --git a/src/constants.js b/src/constants.js index 73575ade..b776dcd7 100644 --- a/src/constants.js +++ b/src/constants.js @@ -4,3 +4,4 @@ export const SYNC_ACCOUNT_TIMEOUT = 3e3 export const MODAL_ADD_ACCOUNT = 'MODAL_ADD_ACCOUNT' export const MODAL_SEND = 'MODAL_SEND' export const MODAL_RECEIVE = 'MODAL_RECEIVE' +export const MODAL_SETTINGS_ACCOUNT = 'MODAL_SETTINGS_ACCOUNT' diff --git a/src/helpers/btc.js b/src/helpers/btc.js index ba760279..1c8ef560 100644 --- a/src/helpers/btc.js +++ b/src/helpers/btc.js @@ -46,7 +46,7 @@ export async function getAccount({ hdnode, segwit, network, - asyncDelay = 100, + asyncDelay = 500, }: { allAddresses?: Array, currentIndex?: number, diff --git a/src/main/app.js b/src/main/app.js index 0bbe8d3a..438eef12 100644 --- a/src/main/app.js +++ b/src/main/app.js @@ -14,7 +14,6 @@ function createMainWindow() { ? { frame: false, titleBarStyle: 'hiddenInset', - vibrancy: 'ultra-dark', // https://github.com/electron/electron/issues/10521 } : {}), center: true, diff --git a/src/reducers/accounts.js b/src/reducers/accounts.js index c6cfc5d7..2ab6d4d6 100644 --- a/src/reducers/accounts.js +++ b/src/reducers/accounts.js @@ -33,6 +33,13 @@ const handlers: Object = { ...state, [account.id]: getAccount(account), }), + EDIT_ACCOUNT: (state: AccountsState, { payload: account }: { payload: Account }) => ({ + ...state, + [account.id]: { + ...state[account.id], + ...getAccount(account), + }, + }), FETCH_ACCOUNTS: (state: AccountsState, { payload: accounts }: { payload: Accounts }) => accounts, SET_ACCOUNT_DATA: ( state: AccountsState, @@ -85,6 +92,19 @@ export function getAccounts(state: { accounts: AccountsState }) { }, {}) } +export function getVisibleAccounts(state: { accounts: AccountsState }) { + const accounts = getAccounts(state) + return Object.keys(accounts).reduce((result, key) => { + const account = accounts[key] + + if (account.archived !== true) { + result[key] = account + } + + return result + }, {}) +} + export function getAccountById(state: { accounts: AccountsState }, id: string) { return getAccounts(state)[id] } diff --git a/src/reducers/modals.js b/src/reducers/modals.js index 877b32de..5d871d77 100644 --- a/src/reducers/modals.js +++ b/src/reducers/modals.js @@ -41,12 +41,23 @@ const handlers = { }, } }, + MODAL_SET_DATA: (state, { payload }: { payload: OpenPayload }) => { + const { name, data } = payload + return { + ...state, + [name]: { + ...state[name], + data, + }, + } + }, } // Actions export const openModal = createAction('MODAL_OPEN', (name, data = {}) => ({ name, data })) export const closeModal = createAction('MODAL_CLOSE', name => ({ name })) +export const setDataModal = createAction('MODAL_SET_DATA', (name, data = {}) => ({ name, data })) // Selectors diff --git a/src/styles/global.js b/src/styles/global.js index 4cf30cd2..767e00e0 100644 --- a/src/styles/global.js +++ b/src/styles/global.js @@ -14,21 +14,17 @@ injectGlobal` font: inherit; color: inherit; user-select: none; - cursor: inherit; min-width: 0; // it will surely make problem in the future... to be inspected. flex-shrink: 0; } - html { - -ms-overflow-style: -ms-autohiding-scrollbar; - } - body { - line-height: 1.5; - font-size: 16px; + cursor: default; font-family: "Open Sans", Arial, Helvetica, sans-serif; + font-size: 16px; + line-height: 1.5; } #app { @@ -46,12 +42,13 @@ injectGlobal` } .scrollbar-thumb { - background: rgba(102, 102, 102, 0.5) !important; + background: rgb(102, 102, 102) !important; padding: 2px; background-clip: content-box !important; } .scrollbar-track { background: transparent !important; transition: opacity 0.2s ease-in-out !important; + z-index: 20 !important; } ` diff --git a/src/types/common.js b/src/types/common.js index 69183ecd..fe576260 100644 --- a/src/types/common.js +++ b/src/types/common.js @@ -27,6 +27,7 @@ export type AccountData = { export type Account = { id: string, + archived?: boolean, name: string, type: string, data?: AccountData,