mirror of
https://github.com/urosran/cally.git
synced 2025-07-17 02:25:10 +00:00
- Added User update dialog, useUpdateSubUser.ts hook and implemented update of a selected user from the family group
This commit is contained in:
@ -5,10 +5,12 @@ import { Dialog, Text, View, Button } from "react-native-ui-lib";
|
||||
import MenuDotsIcon from "@/assets/svgs/MenuDotsIcon";
|
||||
import { UserProfile } from "@/hooks/firebase/types/profileTypes";
|
||||
import { useRemoveSubUser } from "@/hooks/firebase/useRemoveSubUser";
|
||||
import UpdateUserDialog from "@/components/pages/settings/user_settings_views/UpdateUserDialog";
|
||||
|
||||
const UserOptions = ({ user }: { user: UserProfile }) => {
|
||||
const [visible, setVisible] = useState<boolean>(false);
|
||||
const { mutateAsync: removeSubUser } = useRemoveSubUser();
|
||||
const [updateUserDialogOpen, setUpdateUserDialogOpen] = useState(false);
|
||||
|
||||
const handleDeleteUser = async () => {
|
||||
try {
|
||||
@ -20,6 +22,14 @@ const UserOptions = ({ user }: { user: UserProfile }) => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleOpenUpdateDialog = () => {
|
||||
setUpdateUserDialogOpen(true);
|
||||
}
|
||||
|
||||
const handleCloseUpdateDialog = () => {
|
||||
setUpdateUserDialogOpen(false);
|
||||
}
|
||||
|
||||
const menuOptions = [
|
||||
{
|
||||
id: "edit",
|
||||
@ -53,7 +63,7 @@ const UserOptions = ({ user }: { user: UserProfile }) => {
|
||||
onPressAction={({ nativeEvent }) => {
|
||||
switch (nativeEvent.event) {
|
||||
case "edit":
|
||||
console.log("Edit User here");
|
||||
handleOpenUpdateDialog();
|
||||
break;
|
||||
case "delete":
|
||||
setTimeout(() => setVisible(true), 300);
|
||||
@ -104,6 +114,7 @@ const UserOptions = ({ user }: { user: UserProfile }) => {
|
||||
/>
|
||||
</View>
|
||||
</Dialog>
|
||||
{updateUserDialogOpen && <UpdateUserDialog open={updateUserDialogOpen} handleClose={handleCloseUpdateDialog} profileData={user} />}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
Reference in New Issue
Block a user