display all timeline logs inside expense

This commit is contained in:
pramod.mahajan 2025-11-07 16:55:33 +05:30
parent bb1fb2a696
commit 8f83d91d25

View File

@ -5,7 +5,7 @@ import Timeline from "../common/TimeLine";
import moment from "moment";
import { getColorNameFromHex } from "../../utils/appUtils";
const ExpenseStatusLogs = ({ data }) => {
const [visibleCount, setVisibleCount] = useState(4);
const sortedLogs = useMemo(() => {
if (!data?.expenseLogs) return [];
@ -14,13 +14,8 @@ const ExpenseStatusLogs = ({ data }) => {
);
}, [data?.expenseLogs]);
const logsToShow = useMemo(
() => sortedLogs.slice(0, visibleCount),
[sortedLogs, visibleCount]
);
console.log(logsToShow);
const timelineData = useMemo(() => {
return logsToShow.map((log, index) => ({
return sortedLogs.map((log, index) => ({
id: index + 1,
title: log.action || "Status Updated",
description: log.comment || "",
@ -37,7 +32,7 @@ const ExpenseStatusLogs = ({ data }) => {
]
: [],
}));
}, [logsToShow]);
}, [sortedLogs]);
const handleShowMore = () => {
setVisibleCount((prev) => prev + 4);