@treely/strapi-slices 8.3.0 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ProjectGridCard/ProjectGridCard.d.ts.map +1 -1
- package/dist/components/ProjectGridCardV2/ProjectGridCardV2.d.ts.map +1 -1
- package/dist/index.cjs +38 -22
- package/dist/index.cjs.map +3 -3
- package/dist/index.js +38 -22
- package/dist/index.js.map +3 -3
- package/dist/models/fpm/FPMProject.d.ts +6 -1
- package/dist/models/fpm/FPMProject.d.ts.map +1 -1
- package/dist/slices/ProjectsMap/ProjectsMap.d.ts.map +1 -1
- package/dist/utils/getProjectTranslation.d.ts +4 -0
- package/dist/utils/getProjectTranslation.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -260,10 +260,8 @@ var SLICES_WITH_PROJECTS = [
|
|
|
260
260
|
|
|
261
261
|
// src/utils/mergeGlobalAndStrapiBlogPostData.ts
|
|
262
262
|
var mergeGlobalAndStrapiBlogPostData = (context, global, post, blog, projects) => {
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
"large"
|
|
266
|
-
) : DEFAULT_SHARE_IMAGE;
|
|
263
|
+
const metaShareImageMedia = post.attributes.metadata?.shareImage?.media ?? global.attributes.metadata.shareImage?.media;
|
|
264
|
+
const metaShareImageUrl = metaShareImageMedia ? strapiMediaUrl_default(metaShareImageMedia, "large") : DEFAULT_SHARE_IMAGE;
|
|
267
265
|
const schemaMarkupTypes = post.attributes.metadata?.schemaMarkupTypes ?? global.attributes.metadata?.schemaMarkupTypes ?? [];
|
|
268
266
|
const returnBlog = post.attributes.slices.some(
|
|
269
267
|
(slice) => SLICES_WITH_BLOG_POSTS.includes(slice.__component)
|
|
@@ -312,10 +310,8 @@ var mergeGlobalAndStrapiBlogPostData_default = mergeGlobalAndStrapiBlogPostData;
|
|
|
312
310
|
|
|
313
311
|
// src/utils/mergeGlobalAndStrapiCustomerStoryData.ts
|
|
314
312
|
var mergeGlobalAndStrapiCustomerStoryData = (context, global, customerStory, customerStories) => {
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
"large"
|
|
318
|
-
) : DEFAULT_SHARE_IMAGE;
|
|
313
|
+
const metaShareImageMedia = customerStory.attributes.metadata?.shareImage?.media ?? global.attributes.metadata.shareImage?.media;
|
|
314
|
+
const metaShareImageUrl = metaShareImageMedia ? strapiMediaUrl_default(metaShareImageMedia, "large") : DEFAULT_SHARE_IMAGE;
|
|
319
315
|
const schemaMarkupTypes = customerStory.attributes.metadata?.schemaMarkupTypes ?? global.attributes.metadata?.schemaMarkupTypes ?? [];
|
|
320
316
|
const returnCustomerStories = customerStory.attributes.slices.some(
|
|
321
317
|
(slice) => SLICES_WITH_CUSTOMER_STORIES.includes(slice.__component)
|
|
@@ -360,10 +356,8 @@ var mergeGlobalAndStrapiCustomerStoryData_default = mergeGlobalAndStrapiCustomer
|
|
|
360
356
|
|
|
361
357
|
// src/utils/mergeGlobalAndStrapiPageData.ts
|
|
362
358
|
var mergeGlobalAndStrapiPageData = (context, global, page, blogPosts, customerStories, projects) => {
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
"large"
|
|
366
|
-
) : DEFAULT_SHARE_IMAGE;
|
|
359
|
+
const metaShareImageMedia = page.attributes.metadata?.shareImage?.media ?? global.attributes.metadata.shareImage?.media;
|
|
360
|
+
const metaShareImageUrl = metaShareImageMedia ? strapiMediaUrl_default(metaShareImageMedia, "large") : DEFAULT_SHARE_IMAGE;
|
|
367
361
|
const schemaMarkupTypes = page.attributes.metadata?.schemaMarkupTypes ?? global.attributes.metadata?.schemaMarkupTypes ?? [];
|
|
368
362
|
const returnBlogPosts = page.attributes.slices.some(
|
|
369
363
|
(slice) => SLICES_WITH_BLOG_POSTS.includes(slice.__component)
|
|
@@ -419,10 +413,8 @@ var mergeGlobalAndStrapiPageData_default = mergeGlobalAndStrapiPageData;
|
|
|
419
413
|
|
|
420
414
|
// src/utils/mergeGlobalAndStrapiProjectData.ts
|
|
421
415
|
var mergeGlobalAndStrapiProject = (context, global, project, blogPosts, projects) => {
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
"large"
|
|
425
|
-
) : DEFAULT_SHARE_IMAGE;
|
|
416
|
+
const metaShareImageMedia = project.attributes.metadata?.shareImage?.media ?? global.attributes.metadata.shareImage?.media;
|
|
417
|
+
const metaShareImageUrl = metaShareImageMedia ? strapiMediaUrl_default(metaShareImageMedia, "large") : DEFAULT_SHARE_IMAGE;
|
|
426
418
|
const schemaMarkupTypes = project.attributes.metadata?.schemaMarkupTypes ?? global.attributes.metadata?.schemaMarkupTypes ?? [];
|
|
427
419
|
const returnBlogPosts = project.attributes.slices.some(
|
|
428
420
|
(slice) => SLICES_WITH_BLOG_POSTS.includes(slice.__component)
|
|
@@ -3670,12 +3662,20 @@ var CertificationBadge_default = CertificationBadge;
|
|
|
3670
3662
|
// src/components/CertificationBadge/index.ts
|
|
3671
3663
|
var CertificationBadge_default2 = CertificationBadge_default;
|
|
3672
3664
|
|
|
3665
|
+
// src/utils/getProjectTranslation.ts
|
|
3666
|
+
var getProjectTranslation = (nameTranslations, locale, fallback) => {
|
|
3667
|
+
if (!nameTranslations || nameTranslations.length === 0) return fallback;
|
|
3668
|
+
const match = nameTranslations.find((t) => t.language === locale);
|
|
3669
|
+
return match?.value || fallback;
|
|
3670
|
+
};
|
|
3671
|
+
var getProjectTranslation_default = getProjectTranslation;
|
|
3672
|
+
|
|
3673
3673
|
// src/components/ProjectGridCard/ProjectGridCard.tsx
|
|
3674
3674
|
import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3675
3675
|
var ProjectGridCard = ({
|
|
3676
3676
|
project
|
|
3677
3677
|
}) => {
|
|
3678
|
-
const { formatNumber } = useContext10(IntlContext);
|
|
3678
|
+
const { formatNumber, locale } = useContext10(IntlContext);
|
|
3679
3679
|
return /* @__PURE__ */ jsx26(Container, { height: "full", children: /* @__PURE__ */ jsxs23(Flex12, { flexDir: "column", height: "full", children: [
|
|
3680
3680
|
project.thumbnail && /* @__PURE__ */ jsx26(Box17, { borderRadius: "xl", position: "relative", height: "36", mb: "2", children: /* @__PURE__ */ jsx26(
|
|
3681
3681
|
Image17,
|
|
@@ -3689,7 +3689,7 @@ var ProjectGridCard = ({
|
|
|
3689
3689
|
}
|
|
3690
3690
|
}
|
|
3691
3691
|
) }),
|
|
3692
|
-
/* @__PURE__ */ jsx26(Heading8, { my: "4", size: "lg", children: project.
|
|
3692
|
+
/* @__PURE__ */ jsx26(Heading8, { my: "4", size: "lg", children: getProjectTranslation_default(project.nameTranslations, locale, project.title) }),
|
|
3693
3693
|
/* @__PURE__ */ jsxs23(Flex12, { flexDir: "row", gap: "2", flexWrap: "wrap", children: [
|
|
3694
3694
|
/* @__PURE__ */ jsx26(BoemlyTag3, { backgroundColor: "gray.100", children: /* @__PURE__ */ jsx26(Text9, { size: "xsLowBold", color: "gray.800", children: formatNumber(
|
|
3695
3695
|
(project.area || 0) / 1e4,
|
|
@@ -4194,7 +4194,7 @@ var getProjectTypeLabel = (projectType, formatMessage) => {
|
|
|
4194
4194
|
var ProjectGridCardV2 = ({
|
|
4195
4195
|
project
|
|
4196
4196
|
}) => {
|
|
4197
|
-
const { formatNumber, formatMessage } = useContext12(IntlContext);
|
|
4197
|
+
const { formatNumber, formatMessage, locale } = useContext12(IntlContext);
|
|
4198
4198
|
return /* @__PURE__ */ jsx32(Box23, { height: "full", borderRadius: "lg", boxShadow: "sm", overflow: "hidden", children: /* @__PURE__ */ jsxs28(Flex14, { flexDir: "column", height: "full", children: [
|
|
4199
4199
|
/* @__PURE__ */ jsxs28(Box23, { position: "relative", height: "56", children: [
|
|
4200
4200
|
project.thumbnail && /* @__PURE__ */ jsx32(
|
|
@@ -4238,7 +4238,7 @@ var ProjectGridCardV2 = ({
|
|
|
4238
4238
|
)
|
|
4239
4239
|
] }),
|
|
4240
4240
|
/* @__PURE__ */ jsxs28(Box23, { padding: "6", backgroundColor: "white", children: [
|
|
4241
|
-
/* @__PURE__ */ jsx32(Heading11, { size: "xl", color: "primary.700", mb: "2", children: project.
|
|
4241
|
+
/* @__PURE__ */ jsx32(Heading11, { size: "xl", color: "primary.700", mb: "2", children: getProjectTranslation_default(project.nameTranslations, locale, project.title) }),
|
|
4242
4242
|
/* @__PURE__ */ jsxs28(Flex14, { flexDir: "column", gap: "2", children: [
|
|
4243
4243
|
/* @__PURE__ */ jsxs28(Flex14, { alignItems: "center", gap: "3", children: [
|
|
4244
4244
|
/* @__PURE__ */ jsx32(MapPinIcon, { size: 20, color: "var(--boemly-colors-gray-500)" }),
|
|
@@ -5253,11 +5253,23 @@ var ProjectsMap = ({
|
|
|
5253
5253
|
const coordinates = e.features[0].geometry.coordinates.slice();
|
|
5254
5254
|
const {
|
|
5255
5255
|
title,
|
|
5256
|
+
nameTranslations: nameTranslationsRaw,
|
|
5256
5257
|
projectDeveloper,
|
|
5257
5258
|
slug,
|
|
5258
5259
|
portfolioHost,
|
|
5259
5260
|
creditAvailability
|
|
5260
5261
|
} = e.features[0].properties;
|
|
5262
|
+
let parsedNameTranslations;
|
|
5263
|
+
try {
|
|
5264
|
+
parsedNameTranslations = nameTranslationsRaw ? JSON.parse(nameTranslationsRaw) : void 0;
|
|
5265
|
+
} catch {
|
|
5266
|
+
parsedNameTranslations = void 0;
|
|
5267
|
+
}
|
|
5268
|
+
const displayName = getProjectTranslation_default(
|
|
5269
|
+
parsedNameTranslations,
|
|
5270
|
+
locale,
|
|
5271
|
+
title
|
|
5272
|
+
);
|
|
5261
5273
|
const point = map.current.project(coordinates);
|
|
5262
5274
|
const popupHeight = 150;
|
|
5263
5275
|
const offset = point.y - popupHeight - 20 < 0 ? [0, 20] : [0, -20];
|
|
@@ -5314,7 +5326,7 @@ var ProjectsMap = ({
|
|
|
5314
5326
|
const description = `
|
|
5315
5327
|
<div style="padding: 2px; padding-right: 16px; min-width: 180px; max-width: 260px;">
|
|
5316
5328
|
${badge}
|
|
5317
|
-
<h3 style="font-size: 15px; font-weight: bold;">${
|
|
5329
|
+
<h3 style="font-size: 15px; font-weight: bold;">${displayName}</h3>
|
|
5318
5330
|
<p style="font-size: 15px; color: #64748b;">${developer}</p>
|
|
5319
5331
|
${button}
|
|
5320
5332
|
</div>
|
|
@@ -5385,7 +5397,11 @@ var ProjectsMap = ({
|
|
|
5385
5397
|
map.current.addControl(new mapboxgl.NavigationControl(), "top-right");
|
|
5386
5398
|
map.current.on("load", () => {
|
|
5387
5399
|
if (map.current?.getLayer("road-number-shield")) {
|
|
5388
|
-
map.current?.setLayoutProperty(
|
|
5400
|
+
map.current?.setLayoutProperty(
|
|
5401
|
+
"road-number-shield",
|
|
5402
|
+
"visibility",
|
|
5403
|
+
"none"
|
|
5404
|
+
);
|
|
5389
5405
|
}
|
|
5390
5406
|
setIsMapReady(true);
|
|
5391
5407
|
});
|