implementation of dynamic timeline in first page

This commit is contained in:
AmirHossein Mahmoodi
2023-12-11 16:43:33 +03:30
parent fc944c0d35
commit 96ebf94bfe

View File

@@ -4,6 +4,7 @@ import {useRequest} from "@witel/webapp-builder";
import TimelineManager from "@/core/components/timelines/timelineManager"; import TimelineManager from "@/core/components/timelines/timelineManager";
import moment from "jalali-moment"; import moment from "jalali-moment";
import {Timeline} from "@mui/lab"; import {Timeline} from "@mui/lab";
import {LinearProgress} from "@mui/material";
const TimeLineDetails = () => { const TimeLineDetails = () => {
const t = useTranslations(); const t = useTranslations();
@@ -14,7 +15,6 @@ const TimeLineDetails = () => {
useEffect(() => { useEffect(() => {
setLoading(true) setLoading(true)
request(process.env.NEXT_PUBLIC_CONFIG_APP_URL, 'get').then(res => { request(process.env.NEXT_PUBLIC_CONFIG_APP_URL, 'get').then(res => {
setLoading(false)
let tempArr = [] let tempArr = []
for (const timeLine of res.data.time_lines.navgan_first_page) { for (const timeLine of res.data.time_lines.navgan_first_page) {
let temp = {} let temp = {}
@@ -33,6 +33,7 @@ const TimeLineDetails = () => {
tempArr.push(temp) tempArr.push(temp)
} }
setTimeLineList(tempArr) setTimeLineList(tempArr)
setLoading(false)
}).catch(() => { }).catch(() => {
setLoading(false) setLoading(false)
}) })
@@ -41,7 +42,7 @@ const TimeLineDetails = () => {
return ( return (
<> <>
{loading ? ( {loading ? (
<>loading...</> <LinearProgress/>
) : ( ) : (
<Timeline position="alternate"> <Timeline position="alternate">
{timeLineList.map((timeLine, index) => ( {timeLineList.map((timeLine, index) => (