gov-layout 1.2.28 → 1.2.29

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
@@ -222,6 +222,7 @@ const menuItems: MenuItem[] = [
222
222
  - ✅ Default ตั้งค่าระบบ + ช่วยเหลือ (override ได้)
223
223
  - ✅ โปรไฟล์ + ออกจากระบบ ล่างสุดเสมอ
224
224
  - ✅ `dividerAfter` เส้นคั่นระหว่างกลุ่ม
225
+ - ✅ แสดง Avatar Icon อัตโนมัติกรณีผู้ใช้ไม่มีรูปโปรไฟล์ (v1.2.28+) 🆕
225
226
 
226
227
  ---
227
228
 
package/dist/index.js CHANGED
@@ -625,18 +625,6 @@ function ProfileIcon() {
625
625
  }
626
626
  );
627
627
  }
628
- function AvatarIcon({ size = 20 }) {
629
- return /* @__PURE__ */ jsxRuntime.jsx(
630
- "svg",
631
- {
632
- width: size,
633
- height: size,
634
- viewBox: "0 0 24 24",
635
- fill: "currentColor",
636
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z" })
637
- }
638
- );
639
- }
640
628
  function SidebarUserProfile({
641
629
  user,
642
630
  roleLabel,
@@ -652,6 +640,11 @@ function SidebarUserProfile({
652
640
  }
653
641
  return user.firstName || user.lastName || "\u0E1C\u0E39\u0E49\u0E43\u0E0A\u0E49";
654
642
  };
643
+ const getInitial = () => {
644
+ if (user.firstName) return user.firstName.substring(0, 2);
645
+ if (user.lastName) return user.lastName.substring(0, 2);
646
+ return "\u0E1C\u0E39\u0E49";
647
+ };
655
648
  if (collapsed) {
656
649
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: {
657
650
  padding: "12px 8px",
@@ -667,7 +660,7 @@ function SidebarUserProfile({
667
660
  onClick: onProfile,
668
661
  title: onProfile ? "\u0E14\u0E39\u0E42\u0E1B\u0E23\u0E44\u0E1F\u0E25\u0E4C" : getFullName(),
669
662
  style: { cursor: onProfile ? "pointer" : "default" },
670
- children: user.pictureUrl ? /* @__PURE__ */ jsxRuntime.jsx(
663
+ children: user.pictureUrl && !user.pictureUrl.startsWith("/") ? /* @__PURE__ */ jsxRuntime.jsx(
671
664
  "img",
672
665
  {
673
666
  src: user.pictureUrl,
@@ -694,7 +687,7 @@ function SidebarUserProfile({
694
687
  fontWeight: 700,
695
688
  fontSize: "14px"
696
689
  },
697
- children: /* @__PURE__ */ jsxRuntime.jsx(AvatarIcon, { size: 20 })
690
+ children: getInitial()
698
691
  }
699
692
  )
700
693
  }
@@ -786,7 +779,7 @@ function SidebarUserProfile({
786
779
  transition: "opacity 0.15s ease"
787
780
  },
788
781
  children: [
789
- user.pictureUrl ? /* @__PURE__ */ jsxRuntime.jsx(
782
+ user.pictureUrl && !user.pictureUrl.startsWith("/") ? /* @__PURE__ */ jsxRuntime.jsx(
790
783
  "img",
791
784
  {
792
785
  src: user.pictureUrl,
@@ -815,7 +808,7 @@ function SidebarUserProfile({
815
808
  fontSize: "16px",
816
809
  flexShrink: 0
817
810
  },
818
- children: /* @__PURE__ */ jsxRuntime.jsx(AvatarIcon, { size: 24 })
811
+ children: getInitial()
819
812
  }
820
813
  ),
821
814
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { flex: 1, minWidth: 0 }, children: [