Add copy to generate address
This commit is contained in:
@@ -29,6 +29,7 @@ import {
|
||||
type HistoryDisplayRow,
|
||||
type HistoryColorName,
|
||||
} from '../../utils/history-utils.js';
|
||||
import { copyToClipboard } from '../utils/clipboard.js';
|
||||
|
||||
/**
|
||||
* Map history color name to theme color.
|
||||
@@ -75,7 +76,10 @@ type HistoryListItem = ListItemData<HistoryDisplayRow>;
|
||||
function QRDialogOverlay({ address, onClose }: { address: string; onClose: () => void }): React.ReactElement {
|
||||
useInputLayer('qr-dialog');
|
||||
|
||||
useLayeredInput('qr-dialog', (_input, key) => {
|
||||
useLayeredInput('qr-dialog', (input, key) => {
|
||||
if (input === 'c' || input === 'C') {
|
||||
copyToClipboard(address);
|
||||
}
|
||||
if (key.escape || key.return) {
|
||||
onClose();
|
||||
}
|
||||
@@ -93,10 +97,13 @@ function QRDialogOverlay({ address, onClose }: { address: string; onClose: () =>
|
||||
dialog
|
||||
dialogTitle="Receive Address"
|
||||
showValue
|
||||
subtitle={
|
||||
<Box flexDirection="column" justifyContent="center" marginTop={1}>
|
||||
<Text color={colors.textMuted}>Press C to copy to clipboard</Text>
|
||||
<Text color={colors.textMuted}>Press Enter or Esc to close</Text>
|
||||
</Box>
|
||||
}
|
||||
/>
|
||||
<Box justifyContent="center" marginTop={1}>
|
||||
<Text color={colors.textMuted}>Press Enter or Esc to close</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user