Merge branch 'hotfix/CFE-8_scroll_actions_call_widget'

This commit is contained in:
AmirHossein Mahmoodi
2023-10-31 12:02:35 +03:30
3 changed files with 23 additions and 16 deletions

View File

@@ -2,15 +2,16 @@ import CallActionsCategories from "./CallActionCategories";
import CallActionsSubcategories from "./CallActionSubcategories"; import CallActionsSubcategories from "./CallActionSubcategories";
import ActionHeader from "./ActionHeader"; import ActionHeader from "./ActionHeader";
import CallActionDescription from "./CallActionDescription"; import CallActionDescription from "./CallActionDescription";
import { CALL_ACTION } from "@/core/data/apiRoutes"; import {CALL_ACTION} from "@/core/data/apiRoutes";
import useRequest from "@/lib/app/hooks/useRequest"; import useRequest from "@/lib/app/hooks/useRequest";
import useAnswers from "@/lib/callWidget/hooks/useAnswers"; import useAnswers from "@/lib/callWidget/hooks/useAnswers";
import { useState } from "react"; import {useState} from "react";
import {Stack} from "@mui/material";
function CallActions({ tab }) { function CallActions({tab}) {
const [description, setDescription] = useState('') const [description, setDescription] = useState('')
const requestServer = useRequest({ auth: true }); const requestServer = useRequest({auth: true});
const { closeAnswerTab } = useAnswers(); const {closeAnswerTab} = useAnswers();
const handleSubcategoryButton = (category_id, subcategory_id) => { const handleSubcategoryButton = (category_id, subcategory_id) => {
requestServer(`${CALL_ACTION}/${tab.id}`, "post", { requestServer(`${CALL_ACTION}/${tab.id}`, "post", {
@@ -20,23 +21,29 @@ function CallActions({ tab }) {
description description
}, },
success: { success: {
notification: { show: false }, notification: {show: false},
}, },
}) })
.then(() => { .then(() => {
closeAnswerTab(tab.id); closeAnswerTab(tab.id);
}) })
.catch(() => {}); .catch(() => {
});
}; };
return ( return (
<> <Stack sx={{
<ActionHeader tab={tab} /> height: "100%",
<CallActionDescription setDescription={setDescription} /> overflow: "hidden"
<CallActionsCategories tab={tab} /> }}>
<CallActionsSubcategories handleSubcategoryButton={handleSubcategoryButton} tab={tab} /> <ActionHeader tab={tab}/>
</> <Stack sx={{height: "100%", overflow: "scroll"}}>
<CallActionDescription setDescription={setDescription}/>
<CallActionsCategories tab={tab}/>
<CallActionsSubcategories handleSubcategoryButton={handleSubcategoryButton} tab={tab}/>
</Stack>
</Stack>
); );
} }

View File

@@ -25,7 +25,7 @@ const CallHistory = ({tab}) => {
overflow: "hidden" overflow: "hidden"
}}> }}>
<HistoryHeader tab={tab}/> <HistoryHeader tab={tab}/>
<Stack sx={{overflow: "scroll"}}> <Stack sx={{height: "100%", overflow: "scroll"}}>
{errorHistoryList ? ( {errorHistoryList ? (
<ErrorOrEmpty isErrorOrEmpty="error"/> <ErrorOrEmpty isErrorOrEmpty="error"/>
) : isLoadingHistoryList ? ( ) : isLoadingHistoryList ? (

View File

@@ -7,7 +7,7 @@ const CallTabPanel = ({tab}) => {
<Grid container columns={{xs: 3}} sx={{display: !tab.active && 'none', height: '100%', overflow: "hidden"}} <Grid container columns={{xs: 3}} sx={{display: !tab.active && 'none', height: '100%', overflow: "hidden"}}
role="tabpanel" role="tabpanel"
id={`answer-tabpanel-${tab.id}`} aria-labelledby={`answer-tab-${tab.id}`}> id={`answer-tabpanel-${tab.id}`} aria-labelledby={`answer-tab-${tab.id}`}>
<Grid item xs={2}> <Grid item xs={2} sx={{height: "100%", overflow: "scroll"}}>
<CallActions tab={tab}/> <CallActions tab={tab}/>
</Grid> </Grid>
<Grid item> <Grid item>