import React, { useEffect, useState } from 'react'; import { FormattedMessage } from 'react-intl'; import Account from 'soapbox/components/account'; import { ListItem } from 'soapbox/components/list'; import { Button, HStack, Input, Slider } from 'soapbox/components/ui'; import SearchZapSplit from 'soapbox/features/compose/components/search-zap-split'; import { type Account as AccountEntity } from 'soapbox/schemas'; const closeIcon = require('@tabler/icons/outline/x.svg'); interface INewAccount { acc: string; message: string; weight: number; } interface AddNewAccountProps { newAccount: INewAccount; newWeight: number; setNewAccount: React.Dispatch>; handleChange: (newWeight: number) => void; formattedWeight: (weight: number) => number; closeNewAccount: () => void; } const AddNewAccount: React.FC = ({ newAccount, newWeight, setNewAccount, handleChange, formattedWeight, closeNewAccount, }) => { const [accountSelected, setAccountSelected] = useState(null); useEffect(() => { if (accountSelected) { setNewAccount((previousValue) => ({ ...previousValue, acc: accountSelected?.id || '', })); } }, [accountSelected, setNewAccount]); return ( }>
{accountSelected ?
:
}
setNewAccount((previousValue) => ({ ...previousValue, message: e.target.value, })) } />
{/* eslint-disable-next-line formatjs/no-literal-string-in-jsx */} {formattedWeight(newWeight)}% handleChange(e)} />
); }; export default AddNewAccount;