mirror of
https://github.com/Kingsrook/qqq-frontend-material-dashboard.git
synced 2025-07-18 13:20:43 +00:00
Fixed display of times (were all coming from 0th); store sortDirection in localStorage
This commit is contained in:
@ -58,7 +58,7 @@ function AuditBody({tableMetaData, recordId, record}: Props): JSX.Element
|
|||||||
const [limit, setLimit] = useState(1000);
|
const [limit, setLimit] = useState(1000);
|
||||||
const [statusString, setStatusString] = useState("Loading audits...");
|
const [statusString, setStatusString] = useState("Loading audits...");
|
||||||
const [auditsByDate, setAuditsByDate] = useState([] as QRecord[][]);
|
const [auditsByDate, setAuditsByDate] = useState([] as QRecord[][]);
|
||||||
const [sortDirection, setSortDirection] = useState(false);
|
const [sortDirection, setSortDirection] = useState(localStorage.getItem("audit.sortDirection") === "true");
|
||||||
|
|
||||||
useEffect(() =>
|
useEffect(() =>
|
||||||
{
|
{
|
||||||
@ -160,7 +160,9 @@ function AuditBody({tableMetaData, recordId, record}: Props): JSX.Element
|
|||||||
const changeSortDirection = () =>
|
const changeSortDirection = () =>
|
||||||
{
|
{
|
||||||
setAudits([]);
|
setAudits([]);
|
||||||
setSortDirection(!sortDirection);
|
const newSortDirection = !sortDirection
|
||||||
|
setSortDirection(newSortDirection);
|
||||||
|
localStorage.setItem("audit.sortDirection", String(newSortDirection));
|
||||||
};
|
};
|
||||||
|
|
||||||
const todayFormatted = ValueUtils.formatDateTime(new Date()).split(" ")[0];
|
const todayFormatted = ValueUtils.formatDateTime(new Date()).split(" ")[0];
|
||||||
@ -223,6 +225,9 @@ function AuditBody({tableMetaData, recordId, record}: Props): JSX.Element
|
|||||||
{
|
{
|
||||||
audits.map((audit) =>
|
audits.map((audit) =>
|
||||||
{
|
{
|
||||||
|
const formattedTimestamp = ValueUtils.formatDateTime(audit.values.get("timestamp"));
|
||||||
|
const timestampParts = formattedTimestamp.split(" ");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box key={audit.values.get("id")} display="flex" flexDirection="row" mb={1} className="singleAuditBlock">
|
<Box key={audit.values.get("id")} display="flex" flexDirection="row" mb={1} className="singleAuditBlock">
|
||||||
<Avatar sx={{bgcolor: colors.info.main, zIndex: 2}}>
|
<Avatar sx={{bgcolor: colors.info.main, zIndex: 2}}>
|
||||||
|
Reference in New Issue
Block a user