diff --git a/apps/trustlab/src/components/PageOverview/PageOverview.js b/apps/trustlab/src/components/PageOverview/PageOverview.js index f012ac40f..568e86afd 100644 --- a/apps/trustlab/src/components/PageOverview/PageOverview.js +++ b/apps/trustlab/src/components/PageOverview/PageOverview.js @@ -136,6 +136,9 @@ const PostImageOverview = forwardRef(function PostImageOverview( ImageProps={{ alt, src: url, + sx: { + objectPosition: { xs: "left top", sm: "center top" }, + }, }} sx={{ height: { xs: "260px", sm: "300px", md: "366px" }, @@ -144,6 +147,7 @@ const PostImageOverview = forwardRef(function PostImageOverview( width: { xs: "220px", sm: "100%" }, maxWidth: { sm: "280px", md: "360px" }, mx: { xs: 0, sm: "auto" }, + "& span img": { objectPosition: { xs: "left top", sm: "center top" }, }, diff --git a/apps/trustlab/src/components/ReportCard/ReportCard.js b/apps/trustlab/src/components/ReportCard/ReportCard.js index 8fa8eb9c6..e5bb5fa22 100644 --- a/apps/trustlab/src/components/ReportCard/ReportCard.js +++ b/apps/trustlab/src/components/ReportCard/ReportCard.js @@ -7,7 +7,7 @@ import { CardMedia, Divider, Typography, - CardActions, // added + CardActions, } from "@mui/material"; import { forwardRef } from "react"; @@ -30,6 +30,12 @@ const ReportCard = forwardRef(function ReportCard(props, ref) { sx={[ { borderRadius: "5px", + img: { + filter: "grayscale(100%)", + }, + "&:hover img": { + filter: "grayscale(0%)", + }, }, ...(Array.isArray(sx) ? sx : [sx]), ]} @@ -61,7 +67,14 @@ const ReportCard = forwardRef(function ReportCard(props, ref) { - + {title} @@ -70,7 +83,7 @@ const ReportCard = forwardRef(function ReportCard(props, ref) { component="div" sx={{ color: "#828499", - my: 2, + my: 1.25, }} > {date} @@ -132,11 +145,11 @@ const ReportCard = forwardRef(function ReportCard(props, ref) { renders in condensed mode 1`] = `
renders in condensed mode 1`] = ` class="MuiCardContent-root css-3p3r5n-MuiCardContent-root" >

Test Report

renders in condensed mode 1`] = ` class="MuiCardActions-root MuiCardActions-spacing css-11bzvph-MuiCardActions-root" >
renders in condensed mode 1`] = ` exports[` renders unchanged 1`] = `
renders unchanged 1`] = ` class="MuiCardContent-root css-9bakwa-MuiCardContent-root" >

Test Report

renders unchanged 1`] = ` class="MuiCardActions-root MuiCardActions-spacing css-brej4a-MuiCardActions-root" >
renders unchanged 1`] = ` exports[` renders without image 1`] = `
renders without image 1`] = ` class="MuiCardContent-root css-3p3r5n-MuiCardContent-root" >

Test Report

renders without image 1`] = ` class="MuiCardActions-root MuiCardActions-spacing css-11bzvph-MuiCardActions-root" >
renders without image 1`] = ` exports[` renders without link 1`] = `
renders without link 1`] = ` class="MuiCardContent-root css-9bakwa-MuiCardContent-root" >

Test Report

renders without link 1`] = ` class="MuiCardActions-root MuiCardActions-spacing css-brej4a-MuiCardActions-root" >
{/* Row 1: Filter By Label */} {filterByLabel && ( - + {filterByLabel} )} diff --git a/apps/trustlab/src/components/ReportFilters/ReportFilters.snap.js b/apps/trustlab/src/components/ReportFilters/ReportFilters.snap.js index bbd72cfd5..01179db79 100644 --- a/apps/trustlab/src/components/ReportFilters/ReportFilters.snap.js +++ b/apps/trustlab/src/components/ReportFilters/ReportFilters.snap.js @@ -6,7 +6,7 @@ exports[`ReportFilters renders unchanged 1`] = ` class="MuiBox-root css-yd8sa2" >
Filter By
diff --git a/apps/trustlab/src/components/ReportsList/ReportsList.js b/apps/trustlab/src/components/ReportsList/ReportsList.js index 99d9c76c8..8c8f8c9bf 100644 --- a/apps/trustlab/src/components/ReportsList/ReportsList.js +++ b/apps/trustlab/src/components/ReportsList/ReportsList.js @@ -97,42 +97,44 @@ const ReportsList = forwardRef(function ReportsList(props, ref) { return ( {hasFilters ? ( -
+
handleApplyFilters(filterParams)} />
) : null} - -
- - {reports.map((report, index) => ( - - +
+ + {reports.map((report, index) => ( + + + + ))} + + {hasPagination ? ( + + - - ))} - - {hasPagination ? ( - - - - ) : null} -
- + + ) : null} +
+
+ ) : null} ); }); diff --git a/apps/trustlab/src/components/ReportsList/ReportsList.snap.js b/apps/trustlab/src/components/ReportsList/ReportsList.snap.js index 322c81416..4db25ecd2 100644 --- a/apps/trustlab/src/components/ReportsList/ReportsList.snap.js +++ b/apps/trustlab/src/components/ReportsList/ReportsList.snap.js @@ -3,18 +3,5 @@ exports[` renders unchanged 1`] = `
-
-
-
-
-
-
+/> `; diff --git a/apps/trustlab/src/components/ResearchCategoryCard/ResearchCategoryCard.js b/apps/trustlab/src/components/ResearchCategoryCard/ResearchCategoryCard.js index 777158d5e..9ca00a445 100644 --- a/apps/trustlab/src/components/ResearchCategoryCard/ResearchCategoryCard.js +++ b/apps/trustlab/src/components/ResearchCategoryCard/ResearchCategoryCard.js @@ -20,7 +20,16 @@ const ResearchCategoryCard = forwardRef( ref={ref} elevation={0} href={link?.href} - sx={{ textDecoration: "none", backgroundColor: "transparent" }} + sx={{ + textDecoration: "none", + backgroundColor: "transparent", + img: { + filter: "grayscale(100%)", + }, + "&:hover img": { + filter: "grayscale(0%)", + }, + }} {...other} > {image?.src && ( diff --git a/apps/trustlab/src/components/ResearchCategoryCard/ResearchCategoryCard.snap.js b/apps/trustlab/src/components/ResearchCategoryCard/ResearchCategoryCard.snap.js index 8ec9d316a..eee927e27 100644 --- a/apps/trustlab/src/components/ResearchCategoryCard/ResearchCategoryCard.snap.js +++ b/apps/trustlab/src/components/ResearchCategoryCard/ResearchCategoryCard.snap.js @@ -2,7 +2,7 @@ exports[` renders unchanged 1`] = ` @@ -49,7 +49,7 @@ exports[` renders unchanged 1`] = ` exports[` renders without image 1`] = `
renders without image 1`] = ` exports[` renders without link 1`] = `
renders unchanged 1`] = ` class="MuiGrid2-root MuiGrid2-direction-xs-row MuiGrid2-grid-xs-12 MuiGrid2-grid-sm-4 css-8o12w-MuiGrid2-root" > renders unchanged 1`] = ` class="MuiGrid2-root MuiGrid2-direction-xs-row MuiGrid2-grid-xs-12 MuiGrid2-grid-sm-4 css-8o12w-MuiGrid2-root" > renders unchanged 1`] = ` class="MuiGrid2-root MuiGrid2-direction-xs-row MuiGrid2-grid-xs-12 MuiGrid2-grid-sm-4 css-8o12w-MuiGrid2-root" > { - if (category.report) { - const parentPage = context?.params?.slugs?.[0] || "research"; - const link = formatPagePath(parentPage, category.report); - return { - ...category, - link: { - href: link - ? `${link}/${category.report.slug}` - : `/${category.report.slug}`, - label: readMoreLabel, - }, - }; - } - return category; - }); - return { - ...block, - slug, - categories, - }; -} -export default researchCategoryList; diff --git a/apps/trustlab/src/pages/api/v1/reports/index.page.js b/apps/trustlab/src/pages/api/v1/reports/index.page.js index 8dd31bc70..a87482aae 100644 --- a/apps/trustlab/src/pages/api/v1/reports/index.page.js +++ b/apps/trustlab/src/pages/api/v1/reports/index.page.js @@ -36,7 +36,7 @@ export default async function handler(req, res) { // Build filters const andConditions = []; if (reportsType) { - andConditions.push({ reportType: reportsType }); + andConditions.push({ reportType: { equals: reportsType } }); } // Reports (slug) filter diff --git a/apps/trustlab/src/payload/blocks/ResearchCategory.js b/apps/trustlab/src/payload/blocks/ResearchCategory.js index c6194b586..860fab0be 100644 --- a/apps/trustlab/src/payload/blocks/ResearchCategory.js +++ b/apps/trustlab/src/payload/blocks/ResearchCategory.js @@ -35,23 +35,8 @@ const ResearchCategory = { linkGroup({ overrides: { name: "link", - admin: { - condition: (_, siblingData) => - siblingData?.reportType !== "baseline", - }, }, }), - { - name: "report", - type: "relationship", - relationTo: "reports", - admin: { - condition: (_, siblingData) => - siblingData?.reportType === "baseline", - description: - "Select the baseline report (only when Baseline is chosen)", - }, - }, ], }, { diff --git a/apps/trustlab/src/utils/reports.js b/apps/trustlab/src/utils/reports.js index c576af610..1493ccebb 100644 --- a/apps/trustlab/src/utils/reports.js +++ b/apps/trustlab/src/utils/reports.js @@ -1,18 +1,12 @@ -import { formatPagePath } from "@commons-ui/payload"; - export async function getReports(api, options) { const { docs, totalPages, page } = await api.getCollection("reports", { ...options, }); const reports = docs.map((doc) => { - const link = formatPagePath("research", doc); return { ...doc, date: new Date(doc.date).toISOString().split("T")[0], - link: { - href: link ? `${link}/${doc.slug}` : `/${doc.slug}`, - }, }; }); return {