diff --git a/actions/azurestorage.js b/actions/azurestorage.js index a3c02dc0..2ecad913 100644 --- a/actions/azurestorage.js +++ b/actions/azurestorage.js @@ -1693,14 +1693,91 @@ export const listBlobHierarchical = async ( } } }; + +function formatTimeSince(date) { + if (!date) return "Unknown date"; + + const now = new Date(); + const diffMs = now - date; + const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24)); + + if (diffDays < 7) { + return `${diffDays} day${diffDays !== 1 ? "s" : ""} ago`; + } else { + const diffWeeks = Math.floor(diffDays / 7); + return `${diffWeeks} week${diffWeeks !== 1 ? "s" : ""} ago`; + } +} + +function formatDateDisplay(date) { + return date + ? `${date.toLocaleString("en-GB")} (${formatTimeSince(date)})` + : "Unknown"; +} + +function formatBlobDates(blob) { + const created = blob.createdOn ? new Date(blob.createdOn) : null; + const modified = blob.lastModified ? new Date(blob.lastModified) : null; + + if (!created && !modified) return "Unknown"; + + // If both exist and are the same + if (created && modified && created.getTime() === modified.getTime()) { + return `${created.toLocaleString("en-GB")} (${formatTimeSince( + created + )})`; + } + + // If modified exists and is newer than created + if (created && modified && modified.getTime() > created.getTime()) { + return `Created: ${created.toLocaleString("en-GB")} (${formatTimeSince( + created + )}), Modified: ${modified.toLocaleString("en-GB")} (${formatTimeSince( + modified + )})`; + } + + // Only one date exists + const date = modified || created; + return `${date.toLocaleString("en-GB")} (${formatTimeSince(date)})`; +} + export async function listBlobHierarchicalForUser(containerClient) { const blobNames = []; for await (const blob of containerClient.listBlobsFlat()) { - // blobNames.push(blob.name); + const lastModifiedDate = blob.properties?.lastModified || null; + const createdOnDate = blob.properties?.createdOn || null; + + let displayDate = ""; + + if (createdOnDate && lastModifiedDate) { + if ( + createdOnDate.toDateString() === lastModifiedDate.toDateString() + ) { + // Same day — show just one + displayDate = `Date: ${formatDateDisplay(lastModifiedDate)}`; + } else { + // Different days — show both + displayDate = `Created: ${formatDateDisplay( + createdOnDate + )}, Modified: ${formatDateDisplay(lastModifiedDate)}`; + } + } else if (lastModifiedDate) { + displayDate = `Modified: ${formatDateDisplay(lastModifiedDate)}`; + } else if (createdOnDate) { + displayDate = `Created: ${formatDateDisplay(createdOnDate)}`; + } else { + displayDate = "Unknown date"; + } blobNames.push({ name: blob.name, - size: blob.properties.contentLength || 0, // in bytes + size: blob.properties.contentLength || 0, + lastModified: lastModifiedDate + ? lastModifiedDate.toISOString() + : null, + createdOn: createdOnDate ? createdOnDate.toISOString() : null, + displayDate, }); } return blobNames; diff --git a/components/homepage/casecomment.js b/components/homepage/casecomment.js index eace402d..258063b7 100644 --- a/components/homepage/casecomment.js +++ b/components/homepage/casecomment.js @@ -8,17 +8,7 @@ export default function CaseComment() { const { locale } = router; return (
- {t("home:casescomment-card-paragraph-three")} -
-- {t("home:casescomment-card-paragraph-four")} -
+{t("home:casescomment-card-paragraph-one")}{" "}
-- {t("home:casescomment-card-paragraph-two")} -
-- {t("home:watch-case-paragraph-one")} -
+ {/*{t("home:casescomment-card-paragraph-two")}
*/} diff --git a/components/homepage/login.js b/components/homepage/login.js index 6c67dfcb..496f37f0 100644 --- a/components/homepage/login.js +++ b/components/homepage/login.js @@ -78,49 +78,24 @@ let Login = (props) => {{t("home:signin-benefits-paragraph")}
-- {t("home:login-comingsoon-temp-1")}{" "} -
- {/*- {t("home:login-comingsoon-temp-1a")}{" "} -
*/} +{t("home:login-comingsoon-temp-2")} @@ -178,9 +153,17 @@ let Login = (props) => { +
+ {t("home:casescomment-card-paragraph-one")}{" "} + + {t("home:login-contact-email")} + +
rep.json file found:{" "} {folder.repJsonBlob.name}
)} */} - {folder.hasRepJson && ( -