@treely/strapi-slices 8.3.1 → 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/index.js CHANGED
@@ -3662,12 +3662,20 @@ var CertificationBadge_default = CertificationBadge;
3662
3662
  // src/components/CertificationBadge/index.ts
3663
3663
  var CertificationBadge_default2 = CertificationBadge_default;
3664
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
+
3665
3673
  // src/components/ProjectGridCard/ProjectGridCard.tsx
3666
3674
  import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
3667
3675
  var ProjectGridCard = ({
3668
3676
  project
3669
3677
  }) => {
3670
- const { formatNumber } = useContext10(IntlContext);
3678
+ const { formatNumber, locale } = useContext10(IntlContext);
3671
3679
  return /* @__PURE__ */ jsx26(Container, { height: "full", children: /* @__PURE__ */ jsxs23(Flex12, { flexDir: "column", height: "full", children: [
3672
3680
  project.thumbnail && /* @__PURE__ */ jsx26(Box17, { borderRadius: "xl", position: "relative", height: "36", mb: "2", children: /* @__PURE__ */ jsx26(
3673
3681
  Image17,
@@ -3681,7 +3689,7 @@ var ProjectGridCard = ({
3681
3689
  }
3682
3690
  }
3683
3691
  ) }),
3684
- /* @__PURE__ */ jsx26(Heading8, { my: "4", size: "lg", children: project.friendlyName || project.title }),
3692
+ /* @__PURE__ */ jsx26(Heading8, { my: "4", size: "lg", children: getProjectTranslation_default(project.nameTranslations, locale, project.title) }),
3685
3693
  /* @__PURE__ */ jsxs23(Flex12, { flexDir: "row", gap: "2", flexWrap: "wrap", children: [
3686
3694
  /* @__PURE__ */ jsx26(BoemlyTag3, { backgroundColor: "gray.100", children: /* @__PURE__ */ jsx26(Text9, { size: "xsLowBold", color: "gray.800", children: formatNumber(
3687
3695
  (project.area || 0) / 1e4,
@@ -4186,7 +4194,7 @@ var getProjectTypeLabel = (projectType, formatMessage) => {
4186
4194
  var ProjectGridCardV2 = ({
4187
4195
  project
4188
4196
  }) => {
4189
- const { formatNumber, formatMessage } = useContext12(IntlContext);
4197
+ const { formatNumber, formatMessage, locale } = useContext12(IntlContext);
4190
4198
  return /* @__PURE__ */ jsx32(Box23, { height: "full", borderRadius: "lg", boxShadow: "sm", overflow: "hidden", children: /* @__PURE__ */ jsxs28(Flex14, { flexDir: "column", height: "full", children: [
4191
4199
  /* @__PURE__ */ jsxs28(Box23, { position: "relative", height: "56", children: [
4192
4200
  project.thumbnail && /* @__PURE__ */ jsx32(
@@ -4230,7 +4238,7 @@ var ProjectGridCardV2 = ({
4230
4238
  )
4231
4239
  ] }),
4232
4240
  /* @__PURE__ */ jsxs28(Box23, { padding: "6", backgroundColor: "white", children: [
4233
- /* @__PURE__ */ jsx32(Heading11, { size: "xl", color: "primary.700", mb: "2", children: project.friendlyName || project.title }),
4241
+ /* @__PURE__ */ jsx32(Heading11, { size: "xl", color: "primary.700", mb: "2", children: getProjectTranslation_default(project.nameTranslations, locale, project.title) }),
4234
4242
  /* @__PURE__ */ jsxs28(Flex14, { flexDir: "column", gap: "2", children: [
4235
4243
  /* @__PURE__ */ jsxs28(Flex14, { alignItems: "center", gap: "3", children: [
4236
4244
  /* @__PURE__ */ jsx32(MapPinIcon, { size: 20, color: "var(--boemly-colors-gray-500)" }),
@@ -5245,11 +5253,23 @@ var ProjectsMap = ({
5245
5253
  const coordinates = e.features[0].geometry.coordinates.slice();
5246
5254
  const {
5247
5255
  title,
5256
+ nameTranslations: nameTranslationsRaw,
5248
5257
  projectDeveloper,
5249
5258
  slug,
5250
5259
  portfolioHost,
5251
5260
  creditAvailability
5252
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
+ );
5253
5273
  const point = map.current.project(coordinates);
5254
5274
  const popupHeight = 150;
5255
5275
  const offset = point.y - popupHeight - 20 < 0 ? [0, 20] : [0, -20];
@@ -5306,7 +5326,7 @@ var ProjectsMap = ({
5306
5326
  const description = `
5307
5327
  <div style="padding: 2px; padding-right: 16px; min-width: 180px; max-width: 260px;">
5308
5328
  ${badge}
5309
- <h3 style="font-size: 15px; font-weight: bold;">${title}</h3>
5329
+ <h3 style="font-size: 15px; font-weight: bold;">${displayName}</h3>
5310
5330
  <p style="font-size: 15px; color: #64748b;">${developer}</p>
5311
5331
  ${button}
5312
5332
  </div>
@@ -5377,7 +5397,11 @@ var ProjectsMap = ({
5377
5397
  map.current.addControl(new mapboxgl.NavigationControl(), "top-right");
5378
5398
  map.current.on("load", () => {
5379
5399
  if (map.current?.getLayer("road-number-shield")) {
5380
- map.current?.setLayoutProperty("road-number-shield", "visibility", "none");
5400
+ map.current?.setLayoutProperty(
5401
+ "road-number-shield",
5402
+ "visibility",
5403
+ "none"
5404
+ );
5381
5405
  }
5382
5406
  setIsMapReady(true);
5383
5407
  });