fix(create-page): only show signers in counterpart select

This commit is contained in:
enes 2024-08-16 16:14:35 +02:00
parent aa04472277
commit cb617ed386

View File

@ -19,7 +19,7 @@ import styles from './style.module.scss'
import { useEffect, useState } from 'react' import { useEffect, useState } from 'react'
import * as PDFJS from 'pdfjs-dist' import * as PDFJS from 'pdfjs-dist'
import { ProfileMetadata, User } from '../../types' import { ProfileMetadata, User, UserRole } from '../../types'
import { import {
PdfFile, PdfFile,
DrawTool, DrawTool,
@ -474,36 +474,38 @@ export const DrawPDFFields = (props: Props) => {
labelId="counterparts" labelId="counterparts"
label="Counterparts" label="Counterparts"
> >
{props.users.map((user, index) => { {props.users
let displayValue = truncate( .filter((u) => u.role === UserRole.signer)
hexToNpub(user.pubkey), .map((user, index) => {
{ let displayValue = truncate(
length: 16 hexToNpub(user.pubkey),
}
)
const metadata = props.metadata[user.pubkey]
if (metadata) {
displayValue = truncate(
metadata.name ||
metadata.display_name ||
metadata.username,
{ {
length: 16 length: 16
} }
) )
}
return ( const metadata = props.metadata[user.pubkey]
<MenuItem
key={index} if (metadata) {
value={hexToNpub(user.pubkey)} displayValue = truncate(
> metadata.name ||
{displayValue} metadata.display_name ||
</MenuItem> metadata.username,
) {
})} length: 16
}
)
}
return (
<MenuItem
key={index}
value={hexToNpub(user.pubkey)}
>
{displayValue}
</MenuItem>
)
})}
</Select> </Select>
</FormControl> </FormControl>
</div> </div>