CFE-6 Merge branch 'feature/CFE-6_basic_call_wedget' into 'develop'
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -27,7 +27,7 @@ node_modules
|
|||||||
cypress/videos
|
cypress/videos
|
||||||
cypress/screenshots
|
cypress/screenshots
|
||||||
.next
|
.next
|
||||||
.env.local
|
.env*
|
||||||
.env
|
.env
|
||||||
.idea
|
.idea
|
||||||
package-lock.json
|
package-lock.json
|
||||||
@@ -2,8 +2,6 @@ import '@testing-library/jest-dom'
|
|||||||
import {server} from "./mocks/server";
|
import {server} from "./mocks/server";
|
||||||
import mockRouter from 'next-router-mock'
|
import mockRouter from 'next-router-mock'
|
||||||
|
|
||||||
require('dotenv').config({path: './.env.local'});
|
|
||||||
|
|
||||||
jest.mock('next/router', () => jest.requireActual('next-router-mock'))
|
jest.mock('next/router', () => jest.requireActual('next-router-mock'))
|
||||||
|
|
||||||
beforeAll(() => {
|
beforeAll(() => {
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ import {rest} from "msw";
|
|||||||
|
|
||||||
export const handler = [rest.get(GET_USER_ROUTE, (req, res, ctx) => {
|
export const handler = [rest.get(GET_USER_ROUTE, (req, res, ctx) => {
|
||||||
return res(ctx.json({
|
return res(ctx.json({
|
||||||
id: 10
|
data: {
|
||||||
|
id: 10
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
})]
|
})]
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import CenterLayout from "@/layouts/CenterLayout";
|
import CenterLayout from "@/layouts/CenterLayout";
|
||||||
import DashboardLayouts from "@/layouts/dashboardLayouts";
|
import DashboardLayouts from "@/layouts/DashboardLayout";
|
||||||
import {Button, Container, Paper, Stack, Typography,} from "@mui/material";
|
import {Button, Container, Paper, Stack, Typography,} from "@mui/material";
|
||||||
import {Formik} from "formik";
|
import {Formik} from "formik";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import StyledForm from "@/core/components/StyledForm";
|
import StyledForm from "@/core/components/StyledForm";
|
||||||
import CenterLayout from "@/layouts/CenterLayout";
|
import CenterLayout from "@/layouts/CenterLayout";
|
||||||
import DashboardLayouts from "@/layouts/dashboardLayouts";
|
import DashboardLayouts from "@/layouts/DashboardLayout";
|
||||||
import useUser from "@/lib/app/hooks/useUser";
|
import useUser from "@/lib/app/hooks/useUser";
|
||||||
import {Box, Container, Grid, Paper, Stack, TextField, Typography,} from "@mui/material";
|
import {Box, Container, Grid, Paper, Stack, TextField, Typography,} from "@mui/material";
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import DashboardLayouts from "@/layouts/dashboardLayouts";
|
import DashboardLayouts from "@/layouts/DashboardLayout";
|
||||||
|
|
||||||
const DashboardFirstComponent = () => {
|
const DashboardFirstComponent = () => {
|
||||||
return <DashboardLayouts></DashboardLayouts>;
|
return <DashboardLayouts></DashboardLayouts>;
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import PermPhoneMsgIcon from '@mui/icons-material/PermPhoneMsg';
|
||||||
|
import StyledFab from "@/core/components/StyledFab";
|
||||||
|
|
||||||
|
const CallWidgetButton = ({setOpen}) => {
|
||||||
|
return (
|
||||||
|
<StyledFab color="primary" aria-label="open-dialog"
|
||||||
|
onClick={() => setOpen(true)}>
|
||||||
|
<PermPhoneMsgIcon/>
|
||||||
|
</StyledFab>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CallWidgetButton
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import {Dialog} from "@mui/material";
|
||||||
|
import {DialogTransition} from "@/core/components/DialogTransition";
|
||||||
|
|
||||||
|
const CallWidgetDialog = ({open, setOpen}) => {
|
||||||
|
|
||||||
|
const handleClose = () => {
|
||||||
|
setOpen(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Dialog
|
||||||
|
fullScreen
|
||||||
|
open={open}
|
||||||
|
onClose={handleClose}
|
||||||
|
TransitionComponent={DialogTransition}
|
||||||
|
>
|
||||||
|
|
||||||
|
</Dialog>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CallWidgetDialog
|
||||||
15
src/components/layouts/Dashboard/CallWidget/index.jsx
Normal file
15
src/components/layouts/Dashboard/CallWidget/index.jsx
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import CallWidgetButton from "@/components/layouts/Dashboard/CallWidget/CallWidgetButton";
|
||||||
|
import CallWidgetDialog from "@/components/layouts/Dashboard/CallWidget/CallWidgetDialog";
|
||||||
|
import {useState} from "react";
|
||||||
|
|
||||||
|
const CallWidget = () => {
|
||||||
|
const [open, setOpen] = useState(false)
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<CallWidgetButton setOpen={setOpen}/>
|
||||||
|
<CallWidgetDialog open={open} setOpen={setOpen}/>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export default CallWidget
|
||||||
@@ -14,7 +14,7 @@ const SidebarDrawer = ({handleDrawerToggle}) => {
|
|||||||
{t("app_short_name")}
|
{t("app_short_name")}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography variant="caption">
|
<Typography variant="caption">
|
||||||
{user.name} | {user.position}
|
{user.full_name} | {user.position}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Toolbar>
|
</Toolbar>
|
||||||
@@ -18,7 +18,6 @@ function reducer(state, action) {
|
|||||||
case "SELECTED":
|
case "SELECTED":
|
||||||
return state.map((itemsArr) =>
|
return state.map((itemsArr) =>
|
||||||
itemsArr.map((item) => {
|
itemsArr.map((item) => {
|
||||||
console.log(item)
|
|
||||||
if (item.type === "page") {
|
if (item.type === "page") {
|
||||||
if (action.route === item.route)
|
if (action.route === item.route)
|
||||||
return {...item, selected: true}
|
return {...item, selected: true}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
import {useState} from "react";
|
import Header from "src/components/layouts/Dashboard/Header";
|
||||||
import FullPageLayout from "../FullPageLayout";
|
import Sidebar from "src/components/layouts/Dashboard/Sidebar";
|
||||||
import Header from "./header";
|
import FullPageLayout from "@/layouts/FullPageLayout";
|
||||||
import Sidebar from "./sidebar";
|
|
||||||
import {Toolbar} from "@mui/material";
|
import {Toolbar} from "@mui/material";
|
||||||
import BreadCrumbs from "./breadcrumbs";
|
import BreadCrumbs from "src/components/layouts/Dashboard/Breadcrumbs";
|
||||||
|
import {useState} from "react";
|
||||||
|
|
||||||
const drawerWidth = 240;
|
const drawerWidth = 240;
|
||||||
|
|
||||||
const DashboardLayouts = (props) => {
|
const Dashboard = (props) => {
|
||||||
const {window} = props;
|
const {window} = props;
|
||||||
const [mobileOpen, setMobileOpen] = useState(false);
|
const [mobileOpen, setMobileOpen] = useState(false);
|
||||||
const container =
|
const container =
|
||||||
@@ -39,7 +39,7 @@ const DashboardLayouts = (props) => {
|
|||||||
</FullPageLayout>
|
</FullPageLayout>
|
||||||
</FullPageLayout>
|
</FullPageLayout>
|
||||||
</FullPageLayout>
|
</FullPageLayout>
|
||||||
);
|
)
|
||||||
};
|
}
|
||||||
|
|
||||||
export default DashboardLayouts;
|
export default Dashboard
|
||||||
@@ -10,7 +10,7 @@ import useRequest from "@/lib/app/hooks/useRequest";
|
|||||||
import useUser from "@/lib/app/hooks/useUser";
|
import useUser from "@/lib/app/hooks/useUser";
|
||||||
import {useTranslations} from "next-intl";
|
import {useTranslations} from "next-intl";
|
||||||
|
|
||||||
const LoginExpertComponent = () =>{
|
const LoginExpertComponent = () => {
|
||||||
const t = useTranslations();
|
const t = useTranslations();
|
||||||
const requestServer = useRequest()
|
const requestServer = useRequest()
|
||||||
const {setToken} = useUser(); // pass token to set token
|
const {setToken} = useUser(); // pass token to set token
|
||||||
@@ -24,7 +24,7 @@ const LoginExpertComponent = () =>{
|
|||||||
notification: {show: false}
|
notification: {show: false}
|
||||||
}
|
}
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
setToken(response.data.token)
|
setToken(response.data.data.token)
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
props.setSubmitting(false)
|
props.setSubmitting(false)
|
||||||
})
|
})
|
||||||
@@ -38,7 +38,7 @@ const LoginExpertComponent = () =>{
|
|||||||
password: Yup.string().required(t("LoginPage.password_error_message_required")),
|
password: Yup.string().required(t("LoginPage.password_error_message_required")),
|
||||||
});
|
});
|
||||||
|
|
||||||
return(
|
return (
|
||||||
<Container maxWidth="sm">
|
<Container maxWidth="sm">
|
||||||
<Paper elevation={0}>
|
<Paper elevation={0}>
|
||||||
<Formik
|
<Formik
|
||||||
|
|||||||
6
src/core/components/DialogTransition.jsx
Normal file
6
src/core/components/DialogTransition.jsx
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
import {forwardRef} from "react";
|
||||||
|
import {Slide} from "@mui/material";
|
||||||
|
|
||||||
|
export const DialogTransition = forwardRef(function DialogTransition(props, ref) {
|
||||||
|
return <Slide direction="up" ref={ref} {...props}/>;
|
||||||
|
});
|
||||||
11
src/core/components/StyledFab.jsx
Normal file
11
src/core/components/StyledFab.jsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import {Fab, styled} from "@mui/material";
|
||||||
|
|
||||||
|
const StyledFab = styled(Fab)`
|
||||||
|
position: absolute;
|
||||||
|
bottom: 16px;
|
||||||
|
/* @noflip */
|
||||||
|
left: 16px;
|
||||||
|
z-index: 1500;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default StyledFab;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL;
|
const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL;
|
||||||
|
|
||||||
//login
|
//login
|
||||||
export const GET_USER_TOKEN = BASE_URL + "/dashboard/login";
|
export const GET_USER_TOKEN = BASE_URL + "/api/auth/login";
|
||||||
//end login
|
//end login
|
||||||
|
|
||||||
//change password
|
//change password
|
||||||
@@ -9,5 +9,5 @@ export const SET_USER_PASSWORD = BASE_URL + "/dashboard/profile/change_password"
|
|||||||
//end change password
|
//end change password
|
||||||
|
|
||||||
//user data
|
//user data
|
||||||
export const GET_USER_ROUTE = BASE_URL + "/dashboard/profile/info";
|
export const GET_USER_ROUTE = BASE_URL + "/api/profile/info";
|
||||||
//user data
|
//user data
|
||||||
14
src/layouts/DashboardLayout.jsx
Normal file
14
src/layouts/DashboardLayout.jsx
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import CallWidget from "src/components/layouts/Dashboard/CallWidget";
|
||||||
|
import Dashboard from "src/components/layouts/Dashboard";
|
||||||
|
|
||||||
|
const DashboardLayouts = (props) => {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Dashboard {...props}/>
|
||||||
|
<CallWidget/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default DashboardLayouts;
|
||||||
Reference in New Issue
Block a user