From ce74dcff367d82fe40d4274b3d1aa722b4d37d06 Mon Sep 17 00:00:00 2001 From: Aiga115 Date: Thu, 21 Aug 2025 11:56:34 +0200 Subject: [PATCH] ILEX-90 add tooltip with the whole date and time --- .../SingleTermView/History/HistoryItem.jsx | 26 ++++++++++++++----- src/components/SingleTermView/index.jsx | 26 +++++++++---------- 2 files changed, 33 insertions(+), 19 deletions(-) diff --git a/src/components/SingleTermView/History/HistoryItem.jsx b/src/components/SingleTermView/History/HistoryItem.jsx index e60e560b..6d632187 100644 --- a/src/components/SingleTermView/History/HistoryItem.jsx +++ b/src/components/SingleTermView/History/HistoryItem.jsx @@ -5,7 +5,8 @@ import { ListItemText, ListItemIcon, Stack, - Typography + Typography, + Tooltip } from "@mui/material"; import { CreateForkHistoryIcon } from "../../../Icons"; // import CustomButton from "../../common/CustomButton"; @@ -14,10 +15,20 @@ import { vars } from "../../../theme/variables"; const { gray200, gray600, gray700, brand600 } = vars; -const formatDate = (dateString) => { +const formatDate = (dateString, includeDayAndTime = false) => { const fixedDateString = dateString.replace(',', '.'); try { const date = new Date(fixedDateString); + const months = ['January', 'February', 'March', 'April', 'May', 'June', + 'July', 'August', 'September', 'October', 'November', 'December']; + const month = months[date.getUTCMonth()]; + const day = date.getUTCDate(); + const year = date.getUTCFullYear(); + + if (!includeDayAndTime) { + return `${month} ${day}, ${year}`; + } + const weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']; const weekday = weekdays[date.getUTCDay()]; @@ -27,7 +38,8 @@ const formatDate = (dateString) => { hours = hours ? hours : 12; const minutes = date.getUTCMinutes().toString().padStart(2, '0'); - return `${weekday} ${hours}:${minutes}${ampm}`; + return `${month} ${day}, ${year} ${weekday} ${hours}:${minutes}${ampm}`; + } catch (e) { console.error("Error formatting date:", dateString, e); return dateString.split('T')[0]; @@ -80,9 +92,11 @@ const HistoryItem = ({ entry }) => ( } secondary={ - - {formatDate(entry.date)} - + + + {formatDate(entry.date)} + + {/* Restore version diff --git a/src/components/SingleTermView/index.jsx b/src/components/SingleTermView/index.jsx index 4d6bebac..190c62d0 100644 --- a/src/components/SingleTermView/index.jsx +++ b/src/components/SingleTermView/index.jsx @@ -75,7 +75,7 @@ const SingleTermView = () => { const [isLoadingTerm, setIsLoadingTerm] = useState(false); const [actualGroup, setActualGroup] = useState(group); // Track the actual group the data comes from const [isUsingFallback, setIsUsingFallback] = useState(false); // Track if we're using fallback data - + // Remove redundant query logic - use term from URL params directly const searchTerm = term; const openDataFormatMenu = Boolean(dataFormatAnchorEl); @@ -214,11 +214,11 @@ const SingleTermView = () => { // Optimize tab URL synchronization useEffect(() => { const newTabValue = tabMapping[tab] !== undefined ? tabMapping[tab] : 0; - + if (newTabValue !== tabValue) { setTabValue(newTabValue); } - + // If no tab is specified in URL, redirect to overview if (!tab && group && term) { navigate(`/${group}/${term}/overview`, { replace: true }); @@ -246,7 +246,7 @@ const SingleTermView = () => { // Memoize the toggle button group for overview tab const toggleButtonGroup = useMemo(() => { if (tabValue !== 0) return null; - + return ( {isCodeViewVisible && ( @@ -255,10 +255,10 @@ const SingleTermView = () => { Format to visualize: - setSelectedDataFormat(v)} - options={dataFormats} + setSelectedDataFormat(v)} + options={dataFormats} /> @@ -305,11 +305,11 @@ const SingleTermView = () => { {isItFork ? : null} {isUsingFallback && ( -