@@ -31,6 +31,7 @@ import Input from "../ui/input/Input";
3131import { Notice } from "../ui/Notice/Notice" ;
3232import Text from "../ui/Text" ;
3333import Avatar from "../ui/Avatar" ;
34+ import { FlexColumn } from "../ui/Flexbox" ;
3435import { Modal } from "../ui/modal" ;
3536import { User } from "@/chat-api/store/useUsers" ;
3637import { Server } from "@/chat-api/store/useServers" ;
@@ -215,6 +216,7 @@ export default function MemberContextMenu(props: Props) {
215216 ) ;
216217}
217218
219+
218220function Header ( props : { userId : string } ) {
219221 const setVoiceVolume = ( volume : number ) => {
220222 setCachedVolumes ( props . userId , volume ) ;
@@ -490,17 +492,19 @@ function BanModal(props: {
490492 const [ requestSent , setRequestSent ] = createSignal ( false ) ;
491493 const [ shouldDeleteRecentMessages , setShouldDeleteRecentMessages ] =
492494 createSignal < boolean > ( false ) ;
495+ const [ reason , setReason ] = createSignal ( "" ) ;
493496
494497 const onBanClick = async ( ) => {
495498 if ( requestSent ( ) ) return ;
496499 setRequestSent ( true ) ;
500+
497501 await BanServerMember (
498502 props . serverId ,
499503 props . user . id ,
500- shouldDeleteRecentMessages ( )
501- ) . finally ( ( ) => {
502- setRequestSent ( false ) ;
503- } ) ;
504+ shouldDeleteRecentMessages ( ) ,
505+ reason ( ) || undefined
506+ ) . finally ( ( ) => setRequestSent ( false ) ) ;
507+
504508 props . close ( ) ;
505509 } ;
506510
@@ -522,15 +526,31 @@ function BanModal(props: {
522526 title = { t ( "banModal.title" , { username : props . user . username } ) }
523527 actionButtons = { ActionButtons }
524528 >
525- < div class = { styles . kickModal } >
526- < div style = { { "margin-bottom" : "15px " } } >
529+ < div class = { styles . kickModal } style = { { "min-width" : "330px" } } >
530+ < div style = { { "margin-bottom" : "18px " } } >
527531 < Trans
528532 key = "banModal.message"
529533 options = { { username : props . user . username } }
530534 >
531535 Are you sure you want to ban < b > { "username" } </ b > ?
532536 </ Trans >
533537 </ div >
538+
539+ < FlexColumn style = { { "margin-bottom" : "20px" , width : "100%" } } >
540+ < Text size = { 13 } opacity = { 0.8 } style = { { "margin-bottom" : "6px" } } >
541+ { t ( "banModal.reasonLabel" ) || "Reason (optional)" }
542+ </ Text >
543+ < Input
544+ placeholder = { t ( "banModal.reasonPlaceholder" ) }
545+ value = { reason ( ) }
546+ onInput = { ( e ) => setReason ( e . currentTarget . value ) }
547+ style = { {
548+ width : "100%" ,
549+ padding : "8px 10px" ,
550+ } }
551+ />
552+ </ FlexColumn >
553+
534554 < Checkbox
535555 checked = { shouldDeleteRecentMessages ( ) }
536556 onChange = { setShouldDeleteRecentMessages }
@@ -541,6 +561,7 @@ function BanModal(props: {
541561 ) ;
542562}
543563
564+
544565export function ServerMemberRoleModal ( props : Props & { close : ( ) => void } ) {
545566 const { serverRoles, serverMembers, servers, account } = useStore ( ) ;
546567 const server = ( ) => servers . get ( props . serverId ! ) ;
0 commit comments