fork/replay-manager-for-slippi
git clone https://git.julia.blue/fork/replay-manager-for-slippi
5f6c213
main
1import { 2Button , 3DialogActions , 4DialogContent , 5DialogContentText , 6DialogTitle , 7TextField , 8} from '@mui/material' ; 9import { FormEvent } from 'react' ; 10 11const placeholder = `Player 1 12Player 2 13Player 3 14Player 4 15...` ; 16 17export default function ManualNamesForm ({ 18 close, 19 manualNames, 20 setManualNames, 21} :{ 22close :() => void ; 23manualNames :string []; 24setManualNames :( manualNames :string []) => Promise < void >; 25}) { 26return ( 27<> 28< DialogTitle > Enter Player Names </ DialogTitle > 29< form 30onSubmit = { async ( event :FormEvent < HTMLFormElement >) => { 31const target = event . target as typeof event . target & { 32names :{ value :string }; 33}; 34const rawNames = target . names . value ; 35event . preventDefault (); 36event . stopPropagation (); 37if ( rawNames ) { 38await setManualNames ( rawNames . split ( '\n' )); 39close (); 40} 41}} 42> 43< DialogContent style = {{ paddingTop :0 }}> 44< DialogContentText > One per line </ DialogContentText > 45< TextField 46multiline 47minRows = { 8 } 48maxRows = { 16 } 49name = "names" 50placeholder = { placeholder } 51defaultValue = { 52manualNames . length > 0 ?manualNames . join ( '\n' ) :undefined 53} 54/> 55</ DialogContent > 56< DialogActions > 57< Button type = "submit" variant = "contained" > 58Set! 59</ Button > 60</ DialogActions > 61</ form > 62</> 63); 64}