import {useState} from "react";
import {Grid, Form} from "antd";
import {useDispatch} from "react-redux";
import {openModal} from "../../../Redux/Slices/adminSlice.js";
import {setIsCurrentUser, setSelectedUser} from "../../../Redux/Slices/usersSlice.js";

const {useBreakpoint} = Grid;

const useAdminPageUI = () => {
    const dispatch = useDispatch();

    const screens = useBreakpoint();

    const containerStyle = {padding: screens.xs ? 16 : 24};

    const openEditModal = (user) => {
        dispatch(setSelectedUser(user));
        dispatch(setIsCurrentUser(true));
    };

    const openCreateModal = () => {
        dispatch(openModal());
    };


    return {
        containerStyle,
        openEditModal,
        openCreateModal,
    };
};

export default useAdminPageUI;