nvis-fe-cms-libs 2.0.8 → 2.1.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/README.md
CHANGED
|
@@ -238,3 +238,5 @@ const SectionRenderer = ({ section }) => {
|
|
|
238
238
|
|
|
239
239
|
Thư viện **nvis-fe-cms-libs** giúp tách rời các section thành module độc lập, dễ tái sử dụng và bảo trì.
|
|
240
240
|
Bạn có thể mở rộng bằng cách thêm component mới và publish phiên bản tiếp theo lên npm.
|
|
241
|
+
|
|
242
|
+
# Web lấy icon svg https://www.svgrepo.com
|
|
@@ -938,7 +938,7 @@ const PartnersSection = ({ data, t, imageBaseUrl = "", section }) => {
|
|
|
938
938
|
"button",
|
|
939
939
|
{
|
|
940
940
|
onClick: () => setCurrentPartnerSlide(index2),
|
|
941
|
-
className: `w-3 h-3 rounded-full transition-all duration-300 ${index2 === currentPartnerSlide ? "bg-brand-primary scale-125 shadow-lg" : "bg-
|
|
941
|
+
className: `w-3 h-3 rounded-full transition-all duration-300 ${index2 === currentPartnerSlide ? "bg-brand-primary scale-125 shadow-lg" : "bg-surface hover:bg-brand-primary/70"}`,
|
|
942
942
|
"aria-label": `Slide ${index2 + 1}`
|
|
943
943
|
},
|
|
944
944
|
index2
|
|
@@ -1341,17 +1341,17 @@ const PartnerListSection = ({ t, getPartnerList, imageBaseUrl = "", section }) =
|
|
|
1341
1341
|
border: "none",
|
|
1342
1342
|
cursor: "pointer",
|
|
1343
1343
|
transition: "all 0.3s ease",
|
|
1344
|
-
backgroundColor: index2 === currentPartnerSlide ? "var(--brand-primary)" : "rgba(
|
|
1344
|
+
backgroundColor: index2 === currentPartnerSlide ? "var(--brand-primary)" : "rgba(151, 151, 151, 0.8)",
|
|
1345
1345
|
transform: index2 === currentPartnerSlide ? "scale(1.3)" : "scale(1)"
|
|
1346
1346
|
},
|
|
1347
1347
|
onMouseEnter: (e) => {
|
|
1348
1348
|
if (index2 !== currentPartnerSlide) {
|
|
1349
|
-
e.currentTarget.style.backgroundColor = "rgba(
|
|
1349
|
+
e.currentTarget.style.backgroundColor = "rgba(151, 151, 151, 0.8)";
|
|
1350
1350
|
}
|
|
1351
1351
|
},
|
|
1352
1352
|
onMouseLeave: (e) => {
|
|
1353
1353
|
if (index2 !== currentPartnerSlide) {
|
|
1354
|
-
e.currentTarget.style.backgroundColor = "rgba(
|
|
1354
|
+
e.currentTarget.style.backgroundColor = "rgba(151, 151, 151, 0.8)";
|
|
1355
1355
|
}
|
|
1356
1356
|
},
|
|
1357
1357
|
"aria-label": `Slide ${index2 + 1}`
|
|
@@ -2900,7 +2900,7 @@ const __iconNode = [
|
|
|
2900
2900
|
]
|
|
2901
2901
|
];
|
|
2902
2902
|
const Zap = createLucideIcon("zap", __iconNode);
|
|
2903
|
-
const DiagramSection = ({ data, t, isDarkMode }) => {
|
|
2903
|
+
const DiagramSection = ({ data, t, isDarkMode, imageBaseUrl = "" }) => {
|
|
2904
2904
|
var _a, _b;
|
|
2905
2905
|
const [mounted, setMounted] = useState(false);
|
|
2906
2906
|
const [isMobile, setIsMobile] = useState(false);
|
|
@@ -2918,12 +2918,55 @@ const DiagramSection = ({ data, t, isDarkMode }) => {
|
|
|
2918
2918
|
return () => window.removeEventListener("resize", checkMobile);
|
|
2919
2919
|
}, []);
|
|
2920
2920
|
const diagramData = (_b = (_a = data == null ? void 0 : data.sectionDataBindingItems) == null ? void 0 : _a[0]) == null ? void 0 : _b.data;
|
|
2921
|
+
const getImageUrl = (images) => {
|
|
2922
|
+
console.log("getImageUrl called with:", images);
|
|
2923
|
+
console.log("Type of images:", typeof images);
|
|
2924
|
+
if (!images) {
|
|
2925
|
+
console.log("No images found");
|
|
2926
|
+
return null;
|
|
2927
|
+
}
|
|
2928
|
+
let imageUrl;
|
|
2929
|
+
if (typeof images === "string") {
|
|
2930
|
+
imageUrl = images;
|
|
2931
|
+
} else if (Array.isArray(images) && images.length > 0) {
|
|
2932
|
+
imageUrl = images[0];
|
|
2933
|
+
} else {
|
|
2934
|
+
console.log("Invalid images format");
|
|
2935
|
+
return null;
|
|
2936
|
+
}
|
|
2937
|
+
console.log("Image URL:", imageUrl);
|
|
2938
|
+
if (!imageUrl || imageUrl.trim() === "") {
|
|
2939
|
+
console.log("Image URL is empty");
|
|
2940
|
+
return null;
|
|
2941
|
+
}
|
|
2942
|
+
if (imageUrl.startsWith("http")) {
|
|
2943
|
+
console.log("Full URL (already has http):", imageUrl);
|
|
2944
|
+
return imageUrl;
|
|
2945
|
+
}
|
|
2946
|
+
const fullUrl = `${imageBaseUrl}${imageUrl}`;
|
|
2947
|
+
console.log("Full URL:", fullUrl);
|
|
2948
|
+
return fullUrl;
|
|
2949
|
+
};
|
|
2921
2950
|
if (!diagramData) {
|
|
2922
2951
|
return null;
|
|
2923
2952
|
}
|
|
2924
2953
|
const diagramName = diagramData.name || safeT("diagram.defaults.name");
|
|
2925
2954
|
const diagramDescription = diagramData.description || safeT("diagram.defaults.description");
|
|
2926
2955
|
const modules = diagramData.diagramChildrenDTOs || [];
|
|
2956
|
+
useEffect(() => {
|
|
2957
|
+
console.log("=== DIAGRAM MODULES DEBUG ===");
|
|
2958
|
+
console.log("Total modules:", modules.length);
|
|
2959
|
+
console.log("imageBaseUrl:", imageBaseUrl);
|
|
2960
|
+
modules.forEach((module, index2) => {
|
|
2961
|
+
console.log(`Module ${index2 + 1}:`, {
|
|
2962
|
+
name: module.name,
|
|
2963
|
+
images: module.images,
|
|
2964
|
+
imagesType: typeof module.images,
|
|
2965
|
+
isArray: Array.isArray(module.images),
|
|
2966
|
+
hasImages: Boolean(module.images)
|
|
2967
|
+
});
|
|
2968
|
+
});
|
|
2969
|
+
}, [modules, imageBaseUrl]);
|
|
2927
2970
|
const getIconComponent = (iconName) => {
|
|
2928
2971
|
const icons = {
|
|
2929
2972
|
Calculator,
|
|
@@ -2953,10 +2996,10 @@ const DiagramSection = ({ data, t, isDarkMode }) => {
|
|
|
2953
2996
|
};
|
|
2954
2997
|
}
|
|
2955
2998
|
return {
|
|
2956
|
-
gradient: "linear-gradient(to right, var(--gradient-
|
|
2957
|
-
border: "var(--gradient-
|
|
2958
|
-
line: "var(--gradient-
|
|
2959
|
-
iconBg: "var(--gradient-
|
|
2999
|
+
gradient: "linear-gradient(to right, var(--gradient-brand-strong-start), var(--gradient-brand-strong-end))",
|
|
3000
|
+
border: "var(--gradient-brand-strong-start)",
|
|
3001
|
+
line: "var(--gradient-brand-strong-start)",
|
|
3002
|
+
iconBg: "var(--gradient-brand-strong-start)",
|
|
2960
3003
|
shadow: "rgba(139, 92, 246, 0.2)"
|
|
2961
3004
|
};
|
|
2962
3005
|
};
|
|
@@ -3012,15 +3055,30 @@ const DiagramSection = ({ data, t, isDarkMode }) => {
|
|
|
3012
3055
|
animation: `slideUp 0.5s ease-out ${index2 * 0.1}s both`
|
|
3013
3056
|
},
|
|
3014
3057
|
children: [
|
|
3015
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
3058
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3016
3059
|
"div",
|
|
3017
3060
|
{
|
|
3018
|
-
className: "flex-shrink-0 p-3 rounded-xl border",
|
|
3061
|
+
className: "flex-shrink-0 p-3 rounded-xl border bg-surface",
|
|
3019
3062
|
style: {
|
|
3020
3063
|
backgroundColor: `${colors.iconBg}33`,
|
|
3021
3064
|
borderColor: colors.border
|
|
3022
3065
|
},
|
|
3023
|
-
children:
|
|
3066
|
+
children: [
|
|
3067
|
+
module.images ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3068
|
+
"img",
|
|
3069
|
+
{
|
|
3070
|
+
src: getImageUrl(module.images),
|
|
3071
|
+
alt: module.name,
|
|
3072
|
+
className: "w-6 h-6 object-contain",
|
|
3073
|
+
onError: (e) => {
|
|
3074
|
+
console.error("Image load error:", e.target.src);
|
|
3075
|
+
e.target.style.display = "none";
|
|
3076
|
+
e.target.nextElementSibling.style.display = "block";
|
|
3077
|
+
}
|
|
3078
|
+
}
|
|
3079
|
+
) : null,
|
|
3080
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Icon2, { className: "w-6 h-6 text-inverse", strokeWidth: 2, style: { display: module.images ? "none" : "block" } })
|
|
3081
|
+
]
|
|
3024
3082
|
}
|
|
3025
3083
|
),
|
|
3026
3084
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1", children: [
|
|
@@ -3276,7 +3334,7 @@ const DiagramSection = ({ data, t, isDarkMode }) => {
|
|
|
3276
3334
|
] }, `line-${module.id}`);
|
|
3277
3335
|
}) }),
|
|
3278
3336
|
modules.map((module, index2) => {
|
|
3279
|
-
|
|
3337
|
+
getIconComponent(module.icon);
|
|
3280
3338
|
const colors = getColorStyles(index2);
|
|
3281
3339
|
const angle = angles[index2] * Math.PI / 180;
|
|
3282
3340
|
const radius = 360;
|
|
@@ -3284,6 +3342,7 @@ const DiagramSection = ({ data, t, isDarkMode }) => {
|
|
|
3284
3342
|
const y = Math.sin(angle) * radius;
|
|
3285
3343
|
const normalizedAngle = (angles[index2] % 360 + 360) % 360;
|
|
3286
3344
|
const isRightSide = normalizedAngle > 270 || normalizedAngle < 90;
|
|
3345
|
+
const isTopHalf = y < 0;
|
|
3287
3346
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3288
3347
|
"a",
|
|
3289
3348
|
{
|
|
@@ -3318,36 +3377,40 @@ const DiagramSection = ({ data, t, isDarkMode }) => {
|
|
|
3318
3377
|
style: { borderColor: colors.border }
|
|
3319
3378
|
}
|
|
3320
3379
|
),
|
|
3321
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3322
|
-
"div",
|
|
3323
|
-
{
|
|
3324
|
-
className: "flex-shrink-0 p-2.5 rounded-lg border transition-all duration-300 group-hover:rotate-12 group-hover:scale-125 relative z-10",
|
|
3325
|
-
style: {
|
|
3326
|
-
backgroundColor: `${colors.iconBg}33`,
|
|
3327
|
-
borderColor: colors.border
|
|
3328
|
-
},
|
|
3329
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon2, { className: "w-5 h-5 text-inverse", strokeWidth: 2 })
|
|
3330
|
-
}
|
|
3331
|
-
),
|
|
3332
3380
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `flex-1 text-inverse text-small tracking-wide overflow-hidden text-ellipsis whitespace-nowrap ${isRightSide ? "text-right" : "text-left"} relative z-10 min-w-0`, children: module.name }),
|
|
3333
3381
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
3334
3382
|
"div",
|
|
3335
3383
|
{
|
|
3336
|
-
className: `absolute bottom-full left-1/2 -translate-x-1/2
|
|
3384
|
+
className: `absolute ${isTopHalf ? "top-full mt-4" : "bottom-full mb-4"} left-1/2 -translate-x-1/2 px-6 py-4 rounded-xl shadow-2xl opacity-0 group-hover:opacity-100 transition-all duration-300 pointer-events-none z-50 border-2 ${isDarkMode ? "bg-surface" : "bg-body"}`,
|
|
3337
3385
|
style: {
|
|
3338
3386
|
borderColor: "var(--border-color)",
|
|
3339
|
-
maxHeight: "
|
|
3340
|
-
|
|
3387
|
+
maxHeight: "400px",
|
|
3388
|
+
minWidth: "320px",
|
|
3389
|
+
maxWidth: "420px",
|
|
3390
|
+
overflowY: "auto",
|
|
3391
|
+
whiteSpace: "normal"
|
|
3341
3392
|
},
|
|
3342
3393
|
children: [
|
|
3343
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "
|
|
3344
|
-
|
|
3394
|
+
module.images && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-3", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3395
|
+
"img",
|
|
3396
|
+
{
|
|
3397
|
+
src: getImageUrl(module.images),
|
|
3398
|
+
alt: module.name,
|
|
3399
|
+
className: "w-full h-48 object-cover rounded-lg",
|
|
3400
|
+
onError: (e) => {
|
|
3401
|
+
console.error("Tooltip image load error:", e.target.src);
|
|
3402
|
+
e.target.style.display = "none";
|
|
3403
|
+
}
|
|
3404
|
+
}
|
|
3405
|
+
) }),
|
|
3406
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-base text-main font-bold mb-2", children: module.name }),
|
|
3407
|
+
module.description && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-small text-muted leading-relaxed", children: module.description }),
|
|
3345
3408
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
3346
3409
|
"div",
|
|
3347
3410
|
{
|
|
3348
|
-
className:
|
|
3411
|
+
className: `absolute ${isTopHalf ? "bottom-full" : "top-full"} left-1/2 -translate-x-1/2 ${isTopHalf ? "-mb-px" : "-mt-px"} border-8 border-transparent`,
|
|
3349
3412
|
style: {
|
|
3350
|
-
borderTopColor: isDarkMode ? "var(--bg-surface)" : "var(--bg-body)"
|
|
3413
|
+
[isTopHalf ? "borderBottomColor" : "borderTopColor"]: isDarkMode ? "var(--bg-surface)" : "var(--bg-body)"
|
|
3351
3414
|
}
|
|
3352
3415
|
}
|
|
3353
3416
|
)
|