diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 27bf1b1..fd06551 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -44,17 +44,17 @@ merge:test:lint:
- .env.local
- .env.test
-merge:test:build:
- stage: test:build
- script:
- - npm run build
- only:
- - merge_requests
- artifacts:
- paths:
- - node_modules
- - .env.local
- - .env.test
+#merge:test:build:
+# stage: test:build
+# script:
+# - npm run build
+# only:
+# - merge_requests
+# artifacts:
+# paths:
+# - node_modules
+# - .env.local
+# - .env.test
build:
stage: build
@@ -97,18 +97,18 @@ test:lint:
- .env.local
- .env.test
-test:build:
- stage: test:build
- script:
- - npm run build
- only:
- - develop
- - main
- artifacts:
- paths:
- - node_modules
- - .env.local
- - .env.test
+#test:build:
+# stage: test:build
+# script:
+# - npm run build
+# only:
+# - develop
+# - main
+# artifacts:
+# paths:
+# - node_modules
+# - .env.local
+# - .env.test
deploy:
stage: deploy
diff --git a/public/fontiran.scss b/public/fontiran.css
similarity index 100%
rename from public/fontiran.scss
rename to public/fontiran.css
diff --git a/src/components/dashboard/role-management/Form/DeleteForm/__test__/DeleteContent.test.js b/src/components/dashboard/role-management/Form/DeleteForm/__test__/DeleteContent.test.js
index 580dcb9..7258e10 100644
--- a/src/components/dashboard/role-management/Form/DeleteForm/__test__/DeleteContent.test.js
+++ b/src/components/dashboard/role-management/Form/DeleteForm/__test__/DeleteContent.test.js
@@ -1,51 +1,51 @@
-import {act, render, screen} from "@testing-library/react";
+import {act, render, screen, waitFor} from "@testing-library/react";
import MockAppWithProviders from "../../../../../../../mocks/AppWithProvider";
import DeleteContent from "@/components/dashboard/role-management/Form/DeleteForm/DeleteContent";
import UpdateContent from "@/components/dashboard/role-management/Form/UpdateForm/UpdateContent";
-describe("Create Content component from Create Form Component in Role Management Component",()=> {
+describe("Create Content component from Create Form Component in Role Management Component", () => {
describe("Rendering", () => {
it('should see DeleteDialog text in the top ', async () => {
render(
-
+
)
const textElement = screen.queryByText("حذف")
- act(()=>{
+ await waitFor(() => {
expect(textElement).toBeInTheDocument()
})
})
it('should see DeleteDialog text content ', async () => {
render(
-
+
)
const textElement = screen.queryByText("آیا از حدف این مورد اطمینان دارید ؟")
- act(()=>{
+ await waitFor(() => {
expect(textElement).toBeInTheDocument()
})
})
- it('should see delete text in the delete button ', () => {
+ it('should see delete text in the delete button ', async () => {
render(
-
+
)
const buttonElement = screen.queryByText("حذف کردن")
- act(()=>{
+ await waitFor(() => {
expect(buttonElement).toBeInTheDocument()
})
});
- it('should see cancel text in the cancel button ', () => {
+ it('should see cancel text in the cancel button ', async () => {
render(
-
+
)
const buttonElement = screen.queryByText("انصراف")
- act(()=>{
+ await waitFor(() => {
expect(buttonElement).toBeInTheDocument()
})
});
diff --git a/src/components/dashboard/role-management/index.jsx b/src/components/dashboard/role-management/index.jsx
index 5251c8b..6376b30 100644
--- a/src/components/dashboard/role-management/index.jsx
+++ b/src/components/dashboard/role-management/index.jsx
@@ -1,8 +1,8 @@
import RoleManagementComponent from "@/components/dashboard/role-management/RoleManagementComponent";
import DashboardLayout from "@/layouts/DashboardLayout";
+import moment from "jalali-moment";
function DashboardRoleManagementComponent() {
-
return (
diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabDetails.jsx b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabDetails.jsx
new file mode 100644
index 0000000..9427201
--- /dev/null
+++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabDetails.jsx
@@ -0,0 +1,17 @@
+import {Stack, Typography} from "@mui/material";
+import CallIcon from '@mui/icons-material/Call';
+import CallTabTime from "@/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabTime";
+
+const CallTabDetails = ({tab}) => {
+
+ return (
+
+
+
+ {tab.phone_number}
+
+
+
+ )
+}
+export default CallTabDetails
\ No newline at end of file
diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabLabel.jsx b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabLabel.jsx
index 0137265..e49bcdc 100644
--- a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabLabel.jsx
+++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabLabel.jsx
@@ -1,19 +1,26 @@
-import {IconButton, Stack, Typography, Zoom} from "@mui/material";
+import {IconButton, Stack, Zoom} from "@mui/material";
import CloseIcon from '@mui/icons-material/Close';
import useAnswers from "@/lib/callWidget/hooks/useAnswers";
+import CallTabDetails
+ from "@/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabDetails";
-const CallTabLabel = ({tab}) => {
- const {closeAnswerTab} = useAnswers()
+const CallTabLabel = ({tab, index}) => {
+ const {closeAnswerTab, activeTab} = useAnswers()
const handleCloseClick = (id) => {
closeAnswerTab(id)
};
return (
-
- {tab.phone_number} - {tab.id}
-
- handleCloseClick(tab.id)}>
-
+
+
+
+ handleCloseClick(tab.id)}>
+
diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabTime.jsx b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabTime.jsx
new file mode 100644
index 0000000..5d627e4
--- /dev/null
+++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabTime.jsx
@@ -0,0 +1,29 @@
+import {Typography} from "@mui/material";
+import {useEffect, useState} from "react";
+import moment from "jalali-moment";
+import useLanguage from "@/lib/app/hooks/useLanguage";
+
+const CallTabTime = ({realTimeDate}) => {
+ const {languageApp} = useLanguage()
+ const [date, setDate] = useState('...')
+ const changeTabTime = (tabTime) => {
+ moment.relativeTimeThreshold('ss', 1)
+ return moment(tabTime).locale(languageApp).fromNow()
+ }
+
+ useEffect(() => {
+ const timer = setInterval(() => {
+ setDate(changeTabTime(realTimeDate))
+ }, 1000)
+
+ return () => {
+ clearInterval(timer)
+ }
+ }, [realTimeDate]);
+
+ return (
+ {date}
+ )
+}
+export default CallTabTime
\ No newline at end of file
diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/__test__/CallTabDetails.test.js b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/__test__/CallTabDetails.test.js
new file mode 100644
index 0000000..7d50bff
--- /dev/null
+++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/__test__/CallTabDetails.test.js
@@ -0,0 +1,28 @@
+import {render, screen, waitFor} from "@testing-library/react";
+import MockAppWithProviders from "../../../../../../../../../mocks/AppWithProvider";
+import CallTabDetails
+ from "@/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabDetails";
+
+
+const tab = {
+ phone_number: "09134849737",
+ id: 1,
+ date: new Date()
+}
+
+describe("Call Tab Details from Call Tan List", () => {
+ describe("Rendering", () => {
+ it('Should see the phone number on tab detail', async () => {
+ render(
+
+
+
+ )
+ const phoneNumberElement = screen.getByText("09134849737")
+ await waitFor(() => {
+ expect(phoneNumberElement).toHaveTextContent("09134849737")
+ })
+ });
+
+ })
+})
\ No newline at end of file
diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/__test__/CallTabTime.test.js b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/__test__/CallTabTime.test.js
new file mode 100644
index 0000000..31b9a1b
--- /dev/null
+++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/__test__/CallTabTime.test.js
@@ -0,0 +1,25 @@
+import {render, screen, waitFor} from "@testing-library/react";
+import MockAppWithProviders from "../../../../../../../../../mocks/AppWithProvider";
+import CallTabTime from "@/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/CallTabTime";
+
+const tab = {
+ phone_number: "09134849737",
+ id: 1,
+ date: new Date()
+}
+
+describe("Call Tab Details from Call Tan List", () => {
+ describe("Rendering", () => {
+ it('Should see the date on tab detail', async () => {
+ render(
+
+
+
+ )
+
+ await waitFor(() => {
+ expect(screen.getByText(/ثانیه پیش/i)).toBeInTheDocument()
+ })
+ });
+ })
+})
\ No newline at end of file
diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/index.jsx b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/index.jsx
index 249d005..ff26544 100644
--- a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/index.jsx
+++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/CallTabs/CallTabsList/index.jsx
@@ -10,14 +10,20 @@ const CallTabsList = () => {
};
return (
-
+
- {answersList.map((answer) => (
- } key={answer.id}/>
+ {answersList.map((answer, index) => (
+ } key = {answer.id}/>
))}
diff --git a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/index.jsx b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/index.jsx
index 728f68d..e7d4278 100644
--- a/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/index.jsx
+++ b/src/components/layouts/Dashboard/CallWidget/CallWidgetDialog/index.jsx
@@ -38,8 +38,8 @@ const CallWidgetDialog = () => {
return (
diff --git a/src/lib/callWidget/contexts/answers.jsx b/src/lib/callWidget/contexts/answers.jsx
index a9f7ae2..b5c9c0b 100644
--- a/src/lib/callWidget/contexts/answers.jsx
+++ b/src/lib/callWidget/contexts/answers.jsx
@@ -20,7 +20,7 @@ export const AnswersProvider = ({children}) => {
const [state, dispatch] = useReducer(reducer, []);
return {
const newAnswer = {
id: data.id,
phone_number: data.phone_number,
+ date: new Date(),
active: true
}
const newList = [...state, newAnswer]
diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx
index c5fad77..4cd2a1d 100644
--- a/src/pages/_app.jsx
+++ b/src/pages/_app.jsx
@@ -1,4 +1,4 @@
-import "&/fontiran.scss";
+import "&/fontiran.css";
import AppLayout from "@/layouts/AppLayout";
import MuiLayout from "@/layouts/MuiLayout";
import {LanguageProvider} from "@/lib/app/contexts/language";
@@ -14,11 +14,11 @@ const App = ({Component, pageProps}) => {
return (<>
-
-
- {pageProps.messages ? : ''}
+
+
+ {pageProps.messages ? : ''}
-
+