11import { IStyle , Label , Text } from "@fluentui/react" ;
22import { FormattedMessage , Context } from "@oursky/react-messageformat" ;
33import React , { useContext } from "react" ;
4- import cn from "classnames" ;
54import styles from "./UserDetailsAccountStatus.module.css" ;
65import ListCellLayout from "../../ListCellLayout" ;
76import { useSystemConfig } from "../../context/SystemConfigContext" ;
@@ -120,9 +119,7 @@ const DisableUserCell: React.VFC<DisableUserCellProps> =
120119 const { data } = props ;
121120 const buttonStates = useButtonStates ( data ) ;
122121 return (
123- < ListCellLayout
124- className = { cn ( styles . actionCell , styles [ "cell--not-first" ] ) }
125- >
122+ < ListCellLayout className = { styles . actionCell } >
126123 < div className = { styles . actionCellLabel } >
127124 < Text
128125 styles = { {
@@ -140,66 +137,75 @@ const DisableUserCell: React.VFC<DisableUserCellProps> =
140137 >
141138 < FormattedMessage id = "UserDetailsAccountStatus.disable-user.body" />
142139 </ Text >
140+ </ div >
141+ { buttonStates . toggleDisable . isDisabledIndefinitelyOrTemporarily &&
142+ ( buttonStates . toggleDisable . disableReason != null ||
143+ buttonStates . toggleDisable . temporarilyDisabledUntil != null ) ? (
144+ < div className = { styles . actionCellDescription } >
145+ { buttonStates . toggleDisable . disableReason != null ? (
146+ < >
147+ < Text
148+ styles = { {
149+ root : labelTextStyle ,
150+ } }
151+ >
152+ { buttonStates . toggleDisable . disableReason }
153+ </ Text >
154+ </ >
155+ ) : null }
143156
144- { buttonStates . toggleDisable . isDisabledIndefinitelyOrTemporarily &&
145- buttonStates . toggleDisable . disableReason != null ? (
146- < >
147- < br />
148- < Text
149- styles = { {
150- root : labelTextStyle ,
151- } }
152- >
153- { buttonStates . toggleDisable . disableReason }
154- </ Text >
155- </ >
156- ) : null }
157-
158- { buttonStates . toggleDisable . isDisabledIndefinitelyOrTemporarily &&
159- buttonStates . toggleDisable . temporarilyDisabledUntil != null ? (
160- < >
161- < br />
162- < Text
163- styles = { {
164- root : labelTextStyle ,
165- } }
166- >
167- < FormattedMessage
168- id = "UserDetailsAccountStatus.disable-user.until"
169- values = { {
170- until :
171- formatDatetime (
172- locale ,
173- buttonStates . toggleDisable . temporarilyDisabledUntil
174- ) ?? "" ,
157+ { buttonStates . toggleDisable . temporarilyDisabledUntil != null ? (
158+ < >
159+ < Text
160+ styles = { {
161+ root : labelTextStyle ,
175162 } }
176- />
177- </ Text >
178- </ >
179- ) : null }
180- </ div >
181- < OutlinedActionButton
182- disabled = { buttonStates . toggleDisable . buttonDisabled }
183- theme = {
184- buttonStates . toggleDisable . isDisabledIndefinitelyOrTemporarily
185- ? themes . actionButton
186- : themes . destructive
187- }
188- className = { cn ( styles . actionCellActionButton ) }
189- iconProps = {
190- buttonStates . toggleDisable . isDisabledIndefinitelyOrTemporarily
191- ? { iconName : "Play" }
192- : { iconName : "Blocked" }
193- }
194- text = {
195- buttonStates . toggleDisable . isDisabledIndefinitelyOrTemporarily ? (
196- < FormattedMessage id = "UserDetailsAccountStatus.disable-user.action.enable" />
197- ) : (
163+ >
164+ < FormattedMessage
165+ id = "UserDetailsAccountStatus.disable-user.until"
166+ values = { {
167+ until :
168+ formatDatetime (
169+ locale ,
170+ buttonStates . toggleDisable . temporarilyDisabledUntil
171+ ) ?? "" ,
172+ } }
173+ />
174+ </ Text >
175+ </ >
176+ ) : null }
177+ </ div >
178+ ) : null }
179+ { buttonStates . toggleDisable . isDisabledIndefinitelyOrTemporarily ? (
180+ < div className = { styles . actionCellActionButtonContainer } >
181+ < OutlinedActionButton
182+ disabled = { buttonStates . toggleDisable . buttonDisabled }
183+ theme = { themes . actionButton }
184+ iconProps = { { iconName : "Play" } }
185+ text = {
186+ < FormattedMessage id = "UserDetailsAccountStatus.disable-user.action.enable" />
187+ }
188+ />
189+ < OutlinedActionButton
190+ disabled = { buttonStates . toggleDisable . buttonDisabled }
191+ theme = { themes . destructive }
192+ iconProps = { { iconName : "Calendar" } }
193+ text = {
194+ < FormattedMessage id = "UserDetailsAccountStatus.disable-user.action.edit-schedule" />
195+ }
196+ />
197+ </ div >
198+ ) : (
199+ < OutlinedActionButton
200+ disabled = { buttonStates . toggleDisable . buttonDisabled }
201+ theme = { themes . destructive }
202+ className = { styles . actionCellActionButton }
203+ iconProps = { { iconName : "Blocked" } }
204+ text = {
198205 < FormattedMessage id = "UserDetailsAccountStatus.disable-user.action.disable" />
199- )
200- }
201- />
202- < div className = { cn ( styles . actionCellSpacer ) } />
206+ }
207+ />
208+ ) }
203209 </ ListCellLayout >
204210 ) ;
205211 } ;
@@ -210,19 +216,17 @@ const AnonymizeUserCell: React.VFC<AnonymizeUserCellProps> =
210216 const { data } = props ;
211217 const buttonStates = useButtonStates ( data ) ;
212218 return (
213- < ListCellLayout
214- className = { cn ( styles . actionCell , styles [ "cell--not-first" ] ) }
215- >
219+ < ListCellLayout className = { styles . actionCell } >
216220 < Text
217- className = { cn ( styles . actionCellLabel ) }
221+ className = { styles . actionCellLabel }
218222 styles = { {
219223 root : labelTextStyle ,
220224 } }
221225 >
222226 < FormattedMessage id = "UserDetailsAccountStatus.anonymize-user.title" />
223227 </ Text >
224228 < Text
225- className = { cn ( styles . actionCellBody ) }
229+ className = { styles . actionCellBody }
226230 styles = { {
227231 root : bodyTextStyle ,
228232 } }
@@ -236,7 +240,7 @@ const AnonymizeUserCell: React.VFC<AnonymizeUserCellProps> =
236240 ? themes . actionButton
237241 : themes . destructive
238242 }
239- className = { cn ( styles . actionCellActionButton ) }
243+ className = { styles . actionCellActionButton }
240244 iconProps = {
241245 buttonStates . anonymize . anonymizeAt != null
242246 ? { iconName : "Undo" }
@@ -250,7 +254,6 @@ const AnonymizeUserCell: React.VFC<AnonymizeUserCellProps> =
250254 )
251255 }
252256 />
253- < div className = { cn ( styles . actionCellSpacer ) } />
254257 </ ListCellLayout >
255258 ) ;
256259 } ;
@@ -262,35 +265,29 @@ const RemoveUserCell: React.VFC<RemoveUserCellProps> = function RemoveUserCell(
262265 const { data } = props ;
263266 const buttonStates = useButtonStates ( data ) ;
264267 return (
265- < ListCellLayout
266- className = { cn (
267- styles . actionCell ,
268- styles [ "cell--not-first" ] ,
269- styles [ "cell--last" ]
270- ) }
271- >
268+ < ListCellLayout className = { styles . actionCell } >
272269 < Text
273- className = { cn ( styles . actionCellLabel ) }
270+ className = { styles . actionCellLabel }
274271 styles = { {
275272 root : labelTextStyle ,
276273 } }
277274 >
278275 < FormattedMessage id = "UserDetailsAccountStatus.remove-user.title" />
279276 </ Text >
280277 < Text
281- className = { cn ( styles . actionCellBody ) }
278+ className = { styles . actionCellBody }
282279 styles = { {
283280 root : bodyTextStyle ,
284281 } }
285282 >
286283 < FormattedMessage id = "UserDetailsAccountStatus.remove-user.body" />
287284 </ Text >
288285 { buttonStates . delete . deleteAt != null ? (
289- < div className = { cn ( styles . actionCellActionButtonContainer ) } >
286+ < div className = { styles . actionCellActionButtonContainer } >
290287 < OutlinedActionButton
291288 disabled = { buttonStates . delete . buttonDisabled }
292289 theme = { themes . actionButton }
293- className = { cn ( styles . actionCellActionButton ) }
290+ className = { styles . actionCellActionButton }
294291 iconProps = { { iconName : "Undo" } }
295292 text = {
296293 < FormattedMessage id = "UserDetailsAccountStatus.remove-user.action.cancel" />
@@ -299,7 +296,7 @@ const RemoveUserCell: React.VFC<RemoveUserCellProps> = function RemoveUserCell(
299296 < OutlinedActionButton
300297 disabled = { buttonStates . delete . buttonDisabled }
301298 theme = { themes . destructive }
302- className = { cn ( styles . actionCellActionButton ) }
299+ className = { styles . actionCellActionButton }
303300 iconProps = { { iconName : "Delete" } }
304301 text = {
305302 < FormattedMessage id = "UserDetailsAccountStatus.remove-user.action.remove-now" />
@@ -310,14 +307,13 @@ const RemoveUserCell: React.VFC<RemoveUserCellProps> = function RemoveUserCell(
310307 < OutlinedActionButton
311308 disabled = { buttonStates . delete . buttonDisabled }
312309 theme = { themes . destructive }
313- className = { cn ( styles . actionCellActionButton ) }
310+ className = { styles . actionCellActionButton }
314311 iconProps = { { iconName : "Delete" } }
315312 text = {
316313 < FormattedMessage id = "UserDetailsAccountStatus.remove-user.action.remove" />
317314 }
318315 />
319316 ) }
320- < div className = { cn ( styles . actionCellSpacer ) } />
321317 </ ListCellLayout >
322318 ) ;
323319} ;
0 commit comments