@@ -64,12 +64,16 @@ interface AccountValidPeriodCellProps {
6464
6565interface AnonymizeUserCellProps {
6666 data : AccountStatus ;
67- onClickAnonymize : ( ) => void ;
67+ onClickAnonymizeOrSchedule : ( ) => void ;
68+ onClickCancelAnonymization : ( ) => void ;
69+ onClickAnonymizeImmediately : ( ) => void ;
6870}
6971
7072interface RemoveUserCellProps {
7173 data : AccountStatus ;
72- onClickDelete : ( ) => void ;
74+ onClickDeleteOrSchedule : ( ) => void ;
75+ onClickCancelDeletion : ( ) => void ;
76+ onClickDeleteImmediately : ( ) => void ;
7377}
7478
7579interface ButtonStates {
@@ -370,7 +374,12 @@ const AccountValidPeriodCell: React.VFC<AccountValidPeriodCellProps> =
370374const AnonymizeUserCell : React . VFC < AnonymizeUserCellProps > =
371375 function AnonymizeUserCell ( props ) {
372376 const { themes } = useSystemConfig ( ) ;
373- const { data, onClickAnonymize } = props ;
377+ const {
378+ data,
379+ onClickAnonymizeOrSchedule,
380+ onClickCancelAnonymization,
381+ onClickAnonymizeImmediately,
382+ } = props ;
374383 const buttonStates = getButtonStates ( data ) ;
375384 return (
376385 < ListCellLayout className = { styles . actionCell } >
@@ -390,28 +399,39 @@ const AnonymizeUserCell: React.VFC<AnonymizeUserCellProps> =
390399 >
391400 < FormattedMessage id = "UserDetailsAccountStatus.anonymize-user.body" />
392401 </ Text >
393- < OutlinedActionButton
394- disabled = { buttonStates . anonymize . buttonDisabled }
395- theme = {
396- buttonStates . anonymize . anonymizeAt != null
397- ? themes . actionButton
398- : themes . destructive
399- }
400- className = { styles . actionCellActionButton }
401- iconProps = {
402- buttonStates . anonymize . anonymizeAt != null
403- ? { iconName : "Undo" }
404- : { iconName : "Archive" }
405- }
406- text = {
407- buttonStates . anonymize . anonymizeAt != null ? (
408- < FormattedMessage id = "UserDetailsAccountStatus.anonymize-user.action.cancel" />
409- ) : (
402+ { buttonStates . anonymize . anonymizeAt != null ? (
403+ < div className = { styles . actionCellActionButtonContainer } >
404+ < OutlinedActionButton
405+ disabled = { buttonStates . anonymize . buttonDisabled }
406+ theme = { themes . actionButton }
407+ iconProps = { { iconName : "Undo" } }
408+ text = {
409+ < FormattedMessage id = "UserDetailsAccountStatus.anonymize-user.action.cancel" />
410+ }
411+ onClick = { onClickCancelAnonymization }
412+ />
413+ < OutlinedActionButton
414+ disabled = { buttonStates . anonymize . buttonDisabled }
415+ theme = { themes . destructive }
416+ iconProps = { { iconName : "Archive" } }
417+ text = {
418+ < FormattedMessage id = "UserDetailsAccountStatus.anonymize-user.action.anonymize-now" />
419+ }
420+ onClick = { onClickAnonymizeImmediately }
421+ />
422+ </ div >
423+ ) : (
424+ < OutlinedActionButton
425+ disabled = { buttonStates . anonymize . buttonDisabled }
426+ theme = { themes . destructive }
427+ className = { styles . actionCellActionButton }
428+ iconProps = { { iconName : "Archive" } }
429+ text = {
410430 < FormattedMessage id = "UserDetailsAccountStatus.anonymize-user.action.anonymize" />
411- )
412- }
413- onClick = { onClickAnonymize }
414- />
431+ }
432+ onClick = { onClickAnonymizeOrSchedule }
433+ />
434+ ) }
415435 </ ListCellLayout >
416436 ) ;
417437 } ;
@@ -420,7 +440,12 @@ const RemoveUserCell: React.VFC<RemoveUserCellProps> = function RemoveUserCell(
420440 props
421441) {
422442 const { themes } = useSystemConfig ( ) ;
423- const { data, onClickDelete } = props ;
443+ const {
444+ data,
445+ onClickCancelDeletion,
446+ onClickDeleteOrSchedule,
447+ onClickDeleteImmediately,
448+ } = props ;
424449 const buttonStates = getButtonStates ( data ) ;
425450 return (
426451 < ListCellLayout className = { styles . actionCell } >
@@ -449,7 +474,7 @@ const RemoveUserCell: React.VFC<RemoveUserCellProps> = function RemoveUserCell(
449474 text = {
450475 < FormattedMessage id = "UserDetailsAccountStatus.remove-user.action.cancel" />
451476 }
452- onClick = { onClickDelete }
477+ onClick = { onClickCancelDeletion }
453478 />
454479 < OutlinedActionButton
455480 disabled = { buttonStates . delete . buttonDisabled }
@@ -458,7 +483,7 @@ const RemoveUserCell: React.VFC<RemoveUserCellProps> = function RemoveUserCell(
458483 text = {
459484 < FormattedMessage id = "UserDetailsAccountStatus.remove-user.action.remove-now" />
460485 }
461- onClick = { onClickDelete }
486+ onClick = { onClickDeleteImmediately }
462487 />
463488 </ div >
464489 ) : (
@@ -470,7 +495,7 @@ const RemoveUserCell: React.VFC<RemoveUserCellProps> = function RemoveUserCell(
470495 text = {
471496 < FormattedMessage id = "UserDetailsAccountStatus.remove-user.action.remove" />
472497 }
473- onClick = { onClickDelete }
498+ onClick = { onClickDeleteOrSchedule }
474499 />
475500 ) }
476501 </ ListCellLayout >
@@ -493,12 +518,28 @@ const UserDetailsAccountStatus: React.VFC<UserDetailsAccountStatusProps> =
493518 setMode ( "disable" ) ;
494519 setDialogHidden ( false ) ;
495520 } , [ ] ) ;
496- const onClickAnonymize = useCallback ( ( ) => {
497- setMode ( "anonymize" ) ;
521+ const onClickAnonymizeOrSchedule = useCallback ( ( ) => {
522+ setMode ( "anonymize-or-schedule" ) ;
523+ setDialogHidden ( false ) ;
524+ } , [ ] ) ;
525+ const onClickCancelAnonymization = useCallback ( ( ) => {
526+ setMode ( "cancel-anonymization" ) ;
527+ setDialogHidden ( false ) ;
528+ } , [ ] ) ;
529+ const onClickAnonymizeImmediately = useCallback ( ( ) => {
530+ setMode ( "anonymize-immediately" ) ;
531+ setDialogHidden ( false ) ;
532+ } , [ ] ) ;
533+ const onClickDeleteOrSchedule = useCallback ( ( ) => {
534+ setMode ( "delete-or-schedule" ) ;
498535 setDialogHidden ( false ) ;
499536 } , [ ] ) ;
500- const onClickDelete = useCallback ( ( ) => {
501- setMode ( "delete" ) ;
537+ const onClickDeleteImmediately = useCallback ( ( ) => {
538+ setMode ( "delete-immediately" ) ;
539+ setDialogHidden ( false ) ;
540+ } , [ ] ) ;
541+ const onClickCancelDeletion = useCallback ( ( ) => {
542+ setMode ( "cancel-deletion" ) ;
502543 setDialogHidden ( false ) ;
503544 } , [ ] ) ;
504545
@@ -522,8 +563,18 @@ const UserDetailsAccountStatus: React.VFC<UserDetailsAccountStatusProps> =
522563 < div className = "-mt-3" >
523564 < DisableUserCell data = { data } onClickDisable = { onClickDisable } />
524565 < AccountValidPeriodCell data = { data } />
525- < AnonymizeUserCell data = { data } onClickAnonymize = { onClickAnonymize } />
526- < RemoveUserCell data = { data } onClickDelete = { onClickDelete } />
566+ < AnonymizeUserCell
567+ data = { data }
568+ onClickAnonymizeImmediately = { onClickAnonymizeImmediately }
569+ onClickAnonymizeOrSchedule = { onClickAnonymizeOrSchedule }
570+ onClickCancelAnonymization = { onClickCancelAnonymization }
571+ />
572+ < RemoveUserCell
573+ data = { data }
574+ onClickCancelDeletion = { onClickCancelDeletion }
575+ onClickDeleteImmediately = { onClickDeleteImmediately }
576+ onClickDeleteOrSchedule = { onClickDeleteOrSchedule }
577+ />
527578 </ div >
528579 < AccountStatusDialog
529580 accountStatus = { data }
@@ -538,7 +589,17 @@ const UserDetailsAccountStatus: React.VFC<UserDetailsAccountStatusProps> =
538589export interface AccountStatusDialogProps {
539590 isHidden : boolean ;
540591 onDismiss : ( info : { deletedUser : boolean } ) => void ;
541- mode : "disable" | "account-valid-period" | "anonymize" | "delete" | "auto" ;
592+ mode :
593+ | "disable"
594+ | "set-account-valid-period"
595+ | "edit-account-valid-period"
596+ | "anonymize-or-schedule"
597+ | "cancel-anonymization"
598+ | "anonymize-immediately"
599+ | "delete-or-schedule"
600+ | "cancel-deletion"
601+ | "delete-immediately"
602+ | "auto" ;
542603 accountStatus : AccountStatus ;
543604}
544605
@@ -792,71 +853,109 @@ export function AccountStatusDialog(
792853 prepareDisable ( ) ;
793854 }
794855 break ;
795- case "account-valid-period" :
856+ case "set- account-valid-period" :
796857 title = "TODO" ;
797858 subText = "TODO" ;
798859 break ;
799- case "anonymize" :
800- if ( buttonStates . anonymize . anonymizeAt != null ) {
801- prepareUnscheduleAnonymization ( ) ;
802- } else {
803- title = renderToString ( "AccountStatusDialog.anonymize-user.title" ) ;
804- subText = renderToString (
805- "AccountStatusDialog.anonymize-user.description" ,
806- args
807- ) ;
808- button1 = (
809- < PrimaryButton
810- theme = { themes . main }
811- disabled = { loading }
812- onClick = { onClickScheduleAnonymization }
813- text = {
814- < FormattedMessage id = "AccountStatusDialog.anonymize-user.action.schedule-anonymization" />
815- }
816- />
817- ) ;
818- button2 = (
819- < PrimaryButton
820- theme = { themes . destructive }
821- disabled = { loading }
822- onClick = { onClickAnonymize }
823- text = {
824- < FormattedMessage id = "AccountStatusDialog.anonymize-user.action.anonymize-immediately" />
825- }
826- />
827- ) ;
828- }
860+ case "edit-account-valid-period" :
861+ title = "TODO" ;
862+ subText = "TODO" ;
829863 break ;
830- case "delete" :
831- if ( buttonStates . delete . deleteAt != null ) {
832- prepareUnscheduleDeletion ( ) ;
833- } else {
834- title = renderToString ( "AccountStatusDialog.delete-user.title" ) ;
835- subText = renderToString (
836- "AccountStatusDialog.delete-user.description" ,
837- args
838- ) ;
839- button1 = (
840- < PrimaryButton
841- theme = { themes . main }
842- disabled = { loading }
843- onClick = { onClickScheduleDeletion }
844- text = {
845- < FormattedMessage id = "AccountStatusDialog.delete-user.action.schedule-deletion" />
846- }
847- />
848- ) ;
849- button2 = (
850- < PrimaryButton
851- theme = { themes . destructive }
852- disabled = { loading }
853- onClick = { onClickDelete }
854- text = {
855- < FormattedMessage id = "AccountStatusDialog.delete-user.action.delete-immediately" />
856- }
857- />
858- ) ;
859- }
864+ case "anonymize-or-schedule" :
865+ title = renderToString ( "AccountStatusDialog.anonymize-user.title" ) ;
866+ subText = renderToString (
867+ "AccountStatusDialog.anonymize-user.description" ,
868+ args
869+ ) ;
870+ button1 = (
871+ < PrimaryButton
872+ theme = { themes . main }
873+ disabled = { loading }
874+ onClick = { onClickScheduleAnonymization }
875+ text = {
876+ < FormattedMessage id = "AccountStatusDialog.anonymize-user.action.schedule-anonymization" />
877+ }
878+ />
879+ ) ;
880+ button2 = (
881+ < PrimaryButton
882+ theme = { themes . destructive }
883+ disabled = { loading }
884+ onClick = { onClickAnonymize }
885+ text = {
886+ < FormattedMessage id = "AccountStatusDialog.anonymize-user.action.anonymize-immediately" />
887+ }
888+ />
889+ ) ;
890+ break ;
891+ case "cancel-anonymization" :
892+ prepareUnscheduleAnonymization ( ) ;
893+ break ;
894+ case "anonymize-immediately" :
895+ title = renderToString ( "AccountStatusDialog.anonymize-user.title" ) ;
896+ subText = renderToString (
897+ "AccountStatusDialog.anonymize-user.description" ,
898+ args
899+ ) ;
900+ button1 = (
901+ < PrimaryButton
902+ theme = { themes . destructive }
903+ disabled = { loading }
904+ onClick = { onClickAnonymize }
905+ text = {
906+ < FormattedMessage id = "AccountStatusDialog.anonymize-user.action.anonymize-immediately" />
907+ }
908+ />
909+ ) ;
910+ break ;
911+
912+ case "delete-or-schedule" :
913+ title = renderToString ( "AccountStatusDialog.delete-user.title" ) ;
914+ subText = renderToString (
915+ "AccountStatusDialog.delete-user.description" ,
916+ args
917+ ) ;
918+ button1 = (
919+ < PrimaryButton
920+ theme = { themes . main }
921+ disabled = { loading }
922+ onClick = { onClickScheduleDeletion }
923+ text = {
924+ < FormattedMessage id = "AccountStatusDialog.delete-user.action.schedule-deletion" />
925+ }
926+ />
927+ ) ;
928+ button2 = (
929+ < PrimaryButton
930+ theme = { themes . destructive }
931+ disabled = { loading }
932+ onClick = { onClickDelete }
933+ text = {
934+ < FormattedMessage id = "AccountStatusDialog.delete-user.action.delete-immediately" />
935+ }
936+ />
937+ ) ;
938+ break ;
939+ case "cancel-deletion" :
940+ prepareUnscheduleDeletion ( ) ;
941+ break ;
942+
943+ case "delete-immediately" :
944+ title = renderToString ( "AccountStatusDialog.delete-user.title" ) ;
945+ subText = renderToString (
946+ "AccountStatusDialog.delete-user.description" ,
947+ args
948+ ) ;
949+ button1 = (
950+ < PrimaryButton
951+ theme = { themes . destructive }
952+ disabled = { loading }
953+ onClick = { onClickDelete }
954+ text = {
955+ < FormattedMessage id = "AccountStatusDialog.delete-user.action.delete-immediately" />
956+ }
957+ />
958+ ) ;
860959 break ;
861960 case "auto" : {
862961 const action = getMostAppropriateAction ( accountStatus ) ;
@@ -882,8 +981,6 @@ export function AccountStatusDialog(
882981 return { dialogContentProps : { title, subText } , button1, button2 } ;
883982 } , [
884983 accountStatus ,
885- buttonStates . anonymize . anonymizeAt ,
886- buttonStates . delete . deleteAt ,
887984 buttonStates . toggleDisable . isDisabledIndefinitelyOrTemporarily ,
888985 loading ,
889986 mode ,
0 commit comments