import { Button, Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, FormControlLabel, ListItem, ListItemIcon, ListItemText, Radio, RadioGroup, } from "@mui/material"; import React from "react"; import { Account } from "../api/AccountApi"; import { useAccounts } from "../hooks/AccountsListProvider"; import { AccountIconWidget } from "../widgets/AccountIconWidget"; import { AmountWidget } from "../widgets/AmountWidget"; export function SelectAccountDialog(p: { open: boolean; onClose: () => void; onSelected: (c: Account) => void; title: string; description: string | React.ReactElement; confirmButton?: string; excludedAccounts?: Account[]; }): React.ReactElement { const accounts = useAccounts(); const [choice, setChoice] = React.useState( accounts.list.default ); const submit = () => { if (choice) p.onSelected(choice); }; return ( { p.onClose(); }} > {p.title} {p.description} {accounts.list.list.map((option) => ( a.id === option.id) !== undefined } checked={option.id === choice?.id} onChange={() => { setChoice(option); }} /> } label={ } /> } /> ))} ); }