fix: last signer as default next
All checks were successful
Open PR on Staging / audit_and_check (pull_request) Successful in 34s

This commit is contained in:
enes 2024-09-19 11:46:34 +02:00
parent dfdcb8419d
commit 39934f59c3

View File

@ -39,6 +39,7 @@ export const DrawPDFFields = (props: Props) => {
const { selectedFiles, selectedTool, onDrawFieldsChange, users } = props const { selectedFiles, selectedTool, onDrawFieldsChange, users } = props
const signers = users.filter((u) => u.role === UserRole.signer) const signers = users.filter((u) => u.role === UserRole.signer)
const defaultSignerNpub = signers.length ? hexToNpub(signers[0].pubkey) : '' const defaultSignerNpub = signers.length ? hexToNpub(signers[0].pubkey) : ''
const [lastSigner, setLastSigner] = useState(defaultSignerNpub)
const { to, from } = useScale() const { to, from } = useScale()
const [sigitFiles, setSigitFiles] = useState<SigitFile[]>([]) const [sigitFiles, setSigitFiles] = useState<SigitFile[]>([])
@ -117,7 +118,7 @@ export const DrawPDFFields = (props: Props) => {
top: to(page.width, y), top: to(page.width, y),
width: event.pointerType === 'mouse' ? 0 : DEFAULT_START_SIZE.width, width: event.pointerType === 'mouse' ? 0 : DEFAULT_START_SIZE.width,
height: event.pointerType === 'mouse' ? 0 : DEFAULT_START_SIZE.height, height: event.pointerType === 'mouse' ? 0 : DEFAULT_START_SIZE.height,
counterpart: defaultSignerNpub, counterpart: lastSigner,
type: selectedTool.identifier type: selectedTool.identifier
} }
@ -456,10 +457,14 @@ export const DrawPDFFields = (props: Props) => {
<InputLabel id="counterparts">Counterpart</InputLabel> <InputLabel id="counterparts">Counterpart</InputLabel>
<Select <Select
value={ value={
drawnField.counterpart || defaultSignerNpub || '' drawnField.counterpart ||
lastSigner ||
defaultSignerNpub ||
''
} }
onChange={(event) => { onChange={(event) => {
drawnField.counterpart = event.target.value drawnField.counterpart = event.target.value
setLastSigner(event.target.value)
refreshPdfFiles() refreshPdfFiles()
}} }}
labelId="counterparts" labelId="counterparts"