Admin: render list of users differently.

beta
Philippe Pittoli 2024-02-17 23:47:01 +01:00
parent 7895c3f52c
commit 0f0d016ad7
1 changed files with 9 additions and 5 deletions

View File

@ -69,6 +69,7 @@ data Action
| SearchUserAttempt
| PreventSubmit Event
| ShowUser Int
| RemoveUser Int
-- | Change the displayed page.
@ -127,10 +128,10 @@ render { addUserForm, searchUserForm, matching_users, page, wsUp }
[ Bulma.column (C.is_size 5) [Bulma.article (Bulma.p "Add a new user") render_adduser_form] ]
]
where
show_found_users = HH.div_ $ map user_card matching_users
user_card user = Bulma.box [ Bulma.p user.login
, Bulma.alert_btn "remove" (RemoveUser user.uid)
]
show_found_users = Bulma.box [ HH.ul_ $ map user_card matching_users ]
user_card user = HH.li_ [ Bulma.btn user.login (ShowUser user.uid)
, Bulma.alert_btn "remove" (RemoveUser user.uid)
]
up x = HandleAddUserInput <<< x
active = (if wsUp then (HP.enabled true) else (HP.disabled true))
@ -191,8 +192,11 @@ handleAction = case _ of
PreventSubmit ev -> H.liftEffect $ Event.preventDefault ev
ShowUser uid -> do
H.raise $ Log $ SimpleLog $ "[😇] Trying to show a user details (uid: " <> show uid <> ")"
RemoveUser uid -> do
H.raise $ Log $ UnableToSend $ "Try to remove user " <> show uid
H.raise $ Log $ SimpleLog $ "[😇] Trying to remove user " <> show uid
ab <- H.liftEffect $ AuthD.serialize $ AuthD.MkDeleteUser { user: Just uid }
H.raise $ MessageToSend ab