mirror of
https://github.com/trezor/trezor-wallet
synced 2025-01-07 14:50:52 +00:00
hide "copied!" message
This commit is contained in:
parent
f47fddf1f8
commit
6e7200dcf4
@ -12,6 +12,8 @@ export type LogAction = {
|
|||||||
type: typeof LOG.OPEN,
|
type: typeof LOG.OPEN,
|
||||||
} | {
|
} | {
|
||||||
type: typeof LOG.CLOSE,
|
type: typeof LOG.CLOSE,
|
||||||
|
} | {
|
||||||
|
type: typeof LOG.COPY_RESET,
|
||||||
} | {
|
} | {
|
||||||
type: typeof LOG.COPY_SUCCESS,
|
type: typeof LOG.COPY_SUCCESS,
|
||||||
} | {
|
} | {
|
||||||
@ -55,3 +57,7 @@ export const copyToClipboard = (): ThunkAction => (dispatch: Dispatch, getState:
|
|||||||
console.error(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const resetCopyState = (): Action => ({
|
||||||
|
type: LOG.COPY_RESET,
|
||||||
|
});
|
||||||
|
@ -4,4 +4,5 @@
|
|||||||
export const OPEN: 'log__open' = 'log__open';
|
export const OPEN: 'log__open' = 'log__open';
|
||||||
export const CLOSE: 'log__close' = 'log__close';
|
export const CLOSE: 'log__close' = 'log__close';
|
||||||
export const ADD: 'log__add' = 'log__add';
|
export const ADD: 'log__add' = 'log__add';
|
||||||
export const COPY_SUCCESS: 'log__copy_success' = 'log__copy_success';
|
export const COPY_SUCCESS: 'log__copy_success' = 'log__copy_success';
|
||||||
|
export const COPY_RESET: 'log__copy_reset' = 'log__copy_reset';
|
@ -21,7 +21,8 @@ import l10nMessages from './index.messages';
|
|||||||
type Props = {
|
type Props = {
|
||||||
log: $ElementType<State, 'log'>,
|
log: $ElementType<State, 'log'>,
|
||||||
toggle: typeof LogActions.toggle,
|
toggle: typeof LogActions.toggle,
|
||||||
copyToClipboard: typeof LogActions.copyToClipboard
|
copyToClipboard: typeof LogActions.copyToClipboard,
|
||||||
|
resetCopyState: typeof LogActions.resetCopyState,
|
||||||
}
|
}
|
||||||
|
|
||||||
const Wrapper = styled.div`
|
const Wrapper = styled.div`
|
||||||
@ -98,6 +99,7 @@ const Log = (props: Props): ?React$Element<string> => {
|
|||||||
maxWidth={285}
|
maxWidth={285}
|
||||||
placement="top"
|
placement="top"
|
||||||
content={<FormattedMessage {...l10nMessages.TR_COPIED} />}
|
content={<FormattedMessage {...l10nMessages.TR_COPIED} />}
|
||||||
|
afterVisibleChange={props.resetCopyState}
|
||||||
>
|
>
|
||||||
|
|
||||||
{copyBtn}
|
{copyBtn}
|
||||||
@ -117,5 +119,6 @@ export default connect(
|
|||||||
(dispatch: Dispatch) => ({
|
(dispatch: Dispatch) => ({
|
||||||
toggle: bindActionCreators(LogActions.toggle, dispatch),
|
toggle: bindActionCreators(LogActions.toggle, dispatch),
|
||||||
copyToClipboard: bindActionCreators(LogActions.copyToClipboard, dispatch),
|
copyToClipboard: bindActionCreators(LogActions.copyToClipboard, dispatch),
|
||||||
|
resetCopyState: bindActionCreators(LogActions.resetCopyState, dispatch),
|
||||||
}),
|
}),
|
||||||
)(Log);
|
)(Log);
|
@ -35,6 +35,7 @@ const Tooltip = ({
|
|||||||
children,
|
children,
|
||||||
enterDelayMs,
|
enterDelayMs,
|
||||||
defaultVisible = false,
|
defaultVisible = false,
|
||||||
|
...rest
|
||||||
}) => (
|
}) => (
|
||||||
<Wrapper className={className}>
|
<Wrapper className={className}>
|
||||||
<RcTooltip
|
<RcTooltip
|
||||||
@ -53,6 +54,7 @@ const Tooltip = ({
|
|||||||
}
|
}
|
||||||
</ContentWrapper>
|
</ContentWrapper>
|
||||||
)}
|
)}
|
||||||
|
{...rest}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
</RcTooltip>
|
</RcTooltip>
|
||||||
|
@ -49,6 +49,12 @@ export default (state: State = initialState, action: Action): State => {
|
|||||||
copied: true,
|
copied: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
case LOG.COPY_RESET:
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
copied: false,
|
||||||
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user