@loafmarkets/ui 0.1.63 → 0.1.65

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.mjs CHANGED
@@ -6,6 +6,7 @@ import { clsx } from 'clsx';
6
6
  import { twMerge } from 'tailwind-merge';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import styled25, { keyframes, css } from 'styled-components';
9
+ import * as ReactDOM from 'react-dom';
9
10
  import { Newspaper, BedDouble, Bath, CarFront } from 'lucide-react';
10
11
  import * as LightweightCharts from 'lightweight-charts';
11
12
  import { BiChevronUp, BiChevronDown, BiX, BiCoin, BiWallet, BiCreditCard, BiCalendar, BiInfoCircle, BiPencil, BiImages, BiVideo, BiMap } from 'react-icons/bi';
@@ -2675,15 +2676,17 @@ var ensureAnimationsInjected = () => {
2675
2676
  50% { opacity: 1; transform: scale(1); }
2676
2677
  100% { opacity: 0.6; transform: scale(0.9); }
2677
2678
  }
2678
-
2679
2679
  @keyframes propertyNewsSlideIn {
2680
2680
  from { transform: translateY(-6px); opacity: 0; }
2681
2681
  to { transform: translateY(0); opacity: 1; }
2682
2682
  }
2683
-
2684
2683
  @keyframes propertyNewsSpin {
2685
2684
  to { transform: rotate(360deg); }
2686
2685
  }
2686
+ @keyframes propertyNewsModalIn {
2687
+ from { opacity: 0; transform: translateY(12px) scale(0.98); }
2688
+ to { opacity: 1; transform: translateY(0) scale(1); }
2689
+ }
2687
2690
  `;
2688
2691
  document.head.appendChild(style);
2689
2692
  };
@@ -2704,11 +2707,7 @@ var categoryStyles = {
2704
2707
  var formatDate = (value) => {
2705
2708
  if (typeof value === "string") return value;
2706
2709
  if (!(value instanceof Date) || Number.isNaN(value.getTime())) return "";
2707
- return value.toLocaleDateString(void 0, {
2708
- month: "short",
2709
- day: "numeric",
2710
- year: "numeric"
2711
- });
2710
+ return value.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" });
2712
2711
  };
2713
2712
  var formatTimeAgo = (timestamp) => {
2714
2713
  const diff = (Date.now() - new Date(timestamp).getTime()) / 1e3;
@@ -2716,6 +2715,144 @@ var formatTimeAgo = (timestamp) => {
2716
2715
  if (diff < 3600) return `${Math.floor(diff / 60)}m ago`;
2717
2716
  return `${Math.floor(diff / 3600)}h ago`;
2718
2717
  };
2718
+ function getSentimentInfo(score) {
2719
+ if (score == null) return null;
2720
+ if (score > 0.15) return { arrow: "\u25B2", label: "Bullish", color: "#0ecb81" };
2721
+ if (score < -0.15) return { arrow: "\u25BC", label: "Bearish", color: "#f6465d" };
2722
+ return { arrow: "\u2014", label: "Neutral", color: "#848e9c" };
2723
+ }
2724
+ function NewsArticleModal({ item, onClose }) {
2725
+ const sentimentInfo = getSentimentInfo(item.sentimentScore);
2726
+ const catStyle = categoryStyles[item.type] ?? categoryStyles.market;
2727
+ React5.useEffect(() => {
2728
+ const handler = (e) => {
2729
+ if (e.key === "Escape") onClose();
2730
+ };
2731
+ document.addEventListener("keydown", handler);
2732
+ document.body.style.overflow = "hidden";
2733
+ return () => {
2734
+ document.removeEventListener("keydown", handler);
2735
+ document.body.style.overflow = "";
2736
+ };
2737
+ }, [onClose]);
2738
+ const modal = /* @__PURE__ */ jsx(
2739
+ "div",
2740
+ {
2741
+ style: {
2742
+ position: "fixed",
2743
+ inset: 0,
2744
+ background: "rgba(0,0,0,0.72)",
2745
+ zIndex: 9999,
2746
+ display: "flex",
2747
+ alignItems: "center",
2748
+ justifyContent: "center",
2749
+ padding: "1rem"
2750
+ },
2751
+ onClick: onClose,
2752
+ children: /* @__PURE__ */ jsxs(
2753
+ "div",
2754
+ {
2755
+ style: {
2756
+ background: "#1c1c1c",
2757
+ border: "1px solid rgba(255,255,255,0.12)",
2758
+ borderRadius: "14px",
2759
+ padding: "1.5rem",
2760
+ maxWidth: "540px",
2761
+ width: "100%",
2762
+ maxHeight: "80vh",
2763
+ overflowY: "auto",
2764
+ boxShadow: "0 24px 64px rgba(0,0,0,0.6)",
2765
+ animation: "propertyNewsModalIn 0.22s ease-out"
2766
+ },
2767
+ onClick: (e) => e.stopPropagation(),
2768
+ children: [
2769
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", justifyContent: "flex-end", marginBottom: "0.75rem" }, children: /* @__PURE__ */ jsx(
2770
+ "button",
2771
+ {
2772
+ type: "button",
2773
+ onClick: onClose,
2774
+ style: {
2775
+ background: "rgba(255,255,255,0.07)",
2776
+ border: "none",
2777
+ borderRadius: "6px",
2778
+ cursor: "pointer",
2779
+ color: "rgba(255,255,255,0.6)",
2780
+ padding: "0.3rem 0.5rem",
2781
+ lineHeight: 1,
2782
+ display: "flex",
2783
+ alignItems: "center"
2784
+ },
2785
+ children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }) })
2786
+ }
2787
+ ) }),
2788
+ sentimentInfo && /* @__PURE__ */ jsx("div", { style: { marginBottom: "0.6rem" }, children: /* @__PURE__ */ jsxs(
2789
+ "span",
2790
+ {
2791
+ style: {
2792
+ display: "inline-flex",
2793
+ alignItems: "center",
2794
+ gap: "0.3rem",
2795
+ fontSize: "0.7rem",
2796
+ fontWeight: 700,
2797
+ color: sentimentInfo.color,
2798
+ padding: "0.2rem 0.55rem",
2799
+ borderRadius: "4px",
2800
+ background: `${sentimentInfo.color}1a`,
2801
+ border: `1px solid ${sentimentInfo.color}40`
2802
+ },
2803
+ children: [
2804
+ sentimentInfo.arrow,
2805
+ " ",
2806
+ sentimentInfo.label
2807
+ ]
2808
+ }
2809
+ ) }),
2810
+ /* @__PURE__ */ jsx("h2", { style: { fontSize: "1rem", fontWeight: 600, color: "#fff", lineHeight: 1.5, margin: "0 0 1rem" }, children: item.title }),
2811
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center", flexWrap: "wrap", marginBottom: "1.25rem" }, children: [
2812
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "0.72rem", color: "#848e9c" }, children: typeof item.date === "string" ? item.date : formatDate(item.date) }),
2813
+ item.source && /* @__PURE__ */ jsx(
2814
+ "span",
2815
+ {
2816
+ style: {
2817
+ padding: "0.15rem 0.45rem",
2818
+ borderRadius: "3px",
2819
+ fontSize: "0.65rem",
2820
+ fontWeight: 500,
2821
+ background: "rgba(255,255,255,0.07)",
2822
+ color: "#848e9c"
2823
+ },
2824
+ children: item.source
2825
+ }
2826
+ ),
2827
+ /* @__PURE__ */ jsx(
2828
+ "span",
2829
+ {
2830
+ style: {
2831
+ padding: "0.2rem 0.55rem",
2832
+ borderRadius: "4px",
2833
+ border: `1px solid ${catStyle.borderColor}`,
2834
+ background: catStyle.backgroundColor,
2835
+ color: catStyle.color,
2836
+ fontSize: "0.65rem",
2837
+ fontWeight: 600,
2838
+ textTransform: "uppercase"
2839
+ },
2840
+ children: item.type === "property" ? catStyle.label : "Market News"
2841
+ }
2842
+ )
2843
+ ] }),
2844
+ /* @__PURE__ */ jsx("div", { style: { height: "1px", background: "rgba(255,255,255,0.08)", marginBottom: "1.25rem" } }),
2845
+ item.summary ? /* @__PURE__ */ jsx("p", { style: { fontSize: "0.875rem", color: "rgba(255,255,255,0.8)", lineHeight: 1.75, margin: 0 }, children: item.summary }) : /* @__PURE__ */ jsx("p", { style: { fontSize: "0.8rem", color: "rgba(255,255,255,0.35)", fontStyle: "italic", margin: 0 }, children: "Summary not available for this article." })
2846
+ ]
2847
+ }
2848
+ )
2849
+ }
2850
+ );
2851
+ if (typeof document !== "undefined") {
2852
+ return ReactDOM.createPortal(modal, document.body);
2853
+ }
2854
+ return modal;
2855
+ }
2719
2856
  var PropertyNewsUpdates = React5.forwardRef(
2720
2857
  ({
2721
2858
  className,
@@ -2738,6 +2875,8 @@ var PropertyNewsUpdates = React5.forwardRef(
2738
2875
  const [homePage, setHomePage] = React5.useState(0);
2739
2876
  const purchaseItems = purchasesProp ?? [];
2740
2877
  const [page, setPage] = React5.useState(0);
2878
+ const [expandedId, setExpandedId] = React5.useState(null);
2879
+ const [selectedItem, setSelectedItem] = React5.useState(null);
2741
2880
  React5.useEffect(() => {
2742
2881
  ensureAnimationsInjected();
2743
2882
  }, []);
@@ -2745,7 +2884,10 @@ var PropertyNewsUpdates = React5.forwardRef(
2745
2884
  setHomePage(0);
2746
2885
  }, [homeTab]);
2747
2886
  const hasItems = Array.isArray(items) && items.length > 0;
2748
- const totalPages = React5.useMemo(() => hasItems ? Math.max(1, Math.ceil(items.length / ITEMS_PER_PAGE)) : 1, [hasItems, items.length]);
2887
+ const totalPages = React5.useMemo(
2888
+ () => hasItems ? Math.max(1, Math.ceil(items.length / ITEMS_PER_PAGE)) : 1,
2889
+ [hasItems, items.length]
2890
+ );
2749
2891
  React5.useEffect(() => {
2750
2892
  setPage((prev) => Math.min(prev, totalPages - 1));
2751
2893
  }, [totalPages]);
@@ -2759,6 +2901,9 @@ var PropertyNewsUpdates = React5.forwardRef(
2759
2901
  [homeFilteredItems.length]
2760
2902
  );
2761
2903
  const homePaginatedItems = homeFilteredItems.slice(homePage * ITEMS_PER_PAGE, (homePage + 1) * ITEMS_PER_PAGE);
2904
+ const toggleExpand = React5.useCallback((key) => {
2905
+ setExpandedId((prev) => prev === key ? null : key);
2906
+ }, []);
2762
2907
  return /* @__PURE__ */ jsxs(
2763
2908
  "div",
2764
2909
  {
@@ -2772,89 +2917,22 @@ var PropertyNewsUpdates = React5.forwardRef(
2772
2917
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
2773
2918
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem" }, children: [
2774
2919
  isHomeVariant && /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "currentColor", style: { color: "var(--color-text, #fff)" }, children: /* @__PURE__ */ jsx("path", { d: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-5 14H4v-4h11v4zm0-5H4V9h11v4zm5 5h-4V9h4v9z" }) }),
2775
- isPurchaseVariant && /* @__PURE__ */ jsx(
2776
- "span",
2777
- {
2778
- style: {
2779
- display: "inline-block",
2780
- width: "8px",
2781
- height: "8px",
2782
- borderRadius: "50%",
2783
- backgroundColor: "#0ecb81",
2784
- boxShadow: "0 0 8px rgba(14,203,129,0.8)",
2785
- animation: "propertyNewsPulse 1.5s infinite"
2786
- }
2787
- }
2788
- ),
2920
+ isPurchaseVariant && /* @__PURE__ */ jsx("span", { style: { display: "inline-block", width: "8px", height: "8px", borderRadius: "50%", backgroundColor: "#0ecb81", boxShadow: "0 0 8px rgba(14,203,129,0.8)", animation: "propertyNewsPulse 1.5s infinite" } }),
2789
2921
  /* @__PURE__ */ jsxs("div", { children: [
2790
2922
  /* @__PURE__ */ jsx("p", { className: isHomeVariant ? "text-base font-semibold text-white" : "text-lg font-semibold text-white", children: resolvedHeading }),
2791
2923
  subheading ? /* @__PURE__ */ jsx("p", { className: "text-sm text-white/60", children: subheading }) : null
2792
2924
  ] })
2793
2925
  ] }),
2794
- isHomeVariant && viewAllHref ? /* @__PURE__ */ jsxs(
2795
- "a",
2796
- {
2797
- href: viewAllHref,
2798
- style: {
2799
- color: "var(--color-accent, #f0b90b)",
2800
- fontWeight: 500,
2801
- fontSize: "0.8rem",
2802
- textDecoration: "none",
2803
- display: "flex",
2804
- alignItems: "center",
2805
- gap: "0.25rem"
2806
- },
2807
- children: [
2808
- viewAllLabel,
2809
- /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" }) })
2810
- ]
2811
- }
2812
- ) : !isHomeVariant && !isPurchaseVariant ? connectionStatus === "connecting" ? /* @__PURE__ */ jsxs(
2813
- "div",
2814
- {
2815
- className: "inline-flex items-center font-semibold uppercase",
2816
- style: { gap: "0.35rem", fontSize: "0.8rem", letterSpacing: "0.15em", color: "#f97316" },
2817
- children: [
2818
- /* @__PURE__ */ jsx(
2819
- "span",
2820
- {
2821
- style: {
2822
- display: "inline-block",
2823
- width: "10px",
2824
- height: "10px",
2825
- borderRadius: "50%",
2826
- border: "2px solid rgba(249,115,22,0.3)",
2827
- borderTopColor: "#f97316",
2828
- animation: "propertyNewsSpin 0.8s linear infinite"
2829
- }
2830
- }
2831
- ),
2832
- "CONNECTING"
2833
- ]
2834
- }
2835
- ) : /* @__PURE__ */ jsxs(
2836
- "div",
2837
- {
2838
- className: "inline-flex items-center font-semibold uppercase text-emerald-300",
2839
- style: { gap: "0.35rem", fontSize: "0.8rem", letterSpacing: "0.15em" },
2840
- children: [
2841
- /* @__PURE__ */ jsx(
2842
- "span",
2843
- {
2844
- style: {
2845
- display: "inline-block",
2846
- width: "6px",
2847
- height: "6px",
2848
- borderRadius: "50%",
2849
- backgroundColor: "#34d399",
2850
- animation: "propertyNewsPulse 2s infinite"
2851
- }
2852
- }
2853
- ),
2854
- "LIVE"
2855
- ]
2856
- }
2857
- ) : null
2926
+ isHomeVariant && viewAllHref ? /* @__PURE__ */ jsxs("a", { href: viewAllHref, style: { color: "var(--color-accent, #f0b90b)", fontWeight: 500, fontSize: "0.8rem", textDecoration: "none", display: "flex", alignItems: "center", gap: "0.25rem" }, children: [
2927
+ viewAllLabel,
2928
+ /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" }) })
2929
+ ] }) : !isHomeVariant && !isPurchaseVariant ? connectionStatus === "connecting" ? /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center font-semibold uppercase", style: { gap: "0.35rem", fontSize: "0.8rem", letterSpacing: "0.15em", color: "#f97316" }, children: [
2930
+ /* @__PURE__ */ jsx("span", { style: { display: "inline-block", width: "10px", height: "10px", borderRadius: "50%", border: "2px solid rgba(249,115,22,0.3)", borderTopColor: "#f97316", animation: "propertyNewsSpin 0.8s linear infinite" } }),
2931
+ "CONNECTING"
2932
+ ] }) : /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center font-semibold uppercase text-emerald-300", style: { gap: "0.35rem", fontSize: "0.8rem", letterSpacing: "0.15em" }, children: [
2933
+ /* @__PURE__ */ jsx("span", { style: { display: "inline-block", width: "6px", height: "6px", borderRadius: "50%", backgroundColor: "#34d399", animation: "propertyNewsPulse 2s infinite" } }),
2934
+ "LIVE"
2935
+ ] }) : null
2858
2936
  ] }),
2859
2937
  isHomeVariant && /* @__PURE__ */ jsx("div", { style: { display: "flex", gap: 0, marginTop: "0.75rem", marginBottom: "0.25rem" }, children: ["all", "property", "market"].map((tab) => /* @__PURE__ */ jsx(
2860
2938
  "button",
@@ -2879,8 +2957,8 @@ var PropertyNewsUpdates = React5.forwardRef(
2879
2957
  /* @__PURE__ */ jsx(
2880
2958
  "div",
2881
2959
  {
2882
- className: "mt-4 flex flex-1 flex-col gap-3 overflow-visible",
2883
- style: !isPurchaseVariant && !isHomeVariant ? { minHeight: `${ITEMS_PER_PAGE * 88}px` } : void 0,
2960
+ className: "mt-4 flex flex-1 flex-col gap-3 overflow-hidden",
2961
+ style: !isPurchaseVariant && !isHomeVariant ? { minHeight: `${ITEMS_PER_PAGE * 86}px` } : void 0,
2884
2962
  children: isPurchaseVariant ? purchaseItems.length > 0 ? purchaseItems.slice(0, 7).map((purchase, index) => {
2885
2963
  const maxAmount = 6e4;
2886
2964
  const barPercent = Math.min(85, Math.max(15, purchase.amount / maxAmount * 100));
@@ -2888,31 +2966,9 @@ var PropertyNewsUpdates = React5.forwardRef(
2888
2966
  return /* @__PURE__ */ jsxs(
2889
2967
  "div",
2890
2968
  {
2891
- style: {
2892
- display: "flex",
2893
- justifyContent: "space-between",
2894
- alignItems: "center",
2895
- padding: "0.625rem 0.75rem",
2896
- borderBottom: "1px solid rgba(255,255,255,0.05)",
2897
- position: "relative",
2898
- overflow: "hidden",
2899
- backgroundColor: isAlternate ? "rgba(255,255,255,0.03)" : "transparent"
2900
- },
2969
+ style: { display: "flex", justifyContent: "space-between", alignItems: "center", padding: "0.625rem 0.75rem", borderBottom: "1px solid rgba(255,255,255,0.05)", position: "relative", overflow: "hidden", backgroundColor: isAlternate ? "rgba(255,255,255,0.03)" : "transparent" },
2901
2970
  children: [
2902
- /* @__PURE__ */ jsx(
2903
- "div",
2904
- {
2905
- style: {
2906
- position: "absolute",
2907
- top: 0,
2908
- right: 0,
2909
- bottom: 0,
2910
- width: `${barPercent}%`,
2911
- background: "linear-gradient(90deg, transparent 0%, rgba(14,203,129,0.15) 100%)",
2912
- pointerEvents: "none"
2913
- }
2914
- }
2915
- ),
2971
+ /* @__PURE__ */ jsx("div", { style: { position: "absolute", top: 0, right: 0, bottom: 0, width: `${barPercent}%`, background: "linear-gradient(90deg, transparent 0%, rgba(14,203,129,0.15) 100%)", pointerEvents: "none" } }),
2916
2972
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", minWidth: 0, position: "relative" }, children: [
2917
2973
  /* @__PURE__ */ jsx("span", { style: { fontWeight: 500, fontSize: "0.875rem", color: "#fff", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: purchase.name }),
2918
2974
  /* @__PURE__ */ jsx("span", { style: { fontSize: "0.7rem", color: "var(--color-text-secondary, #848e9c)", marginTop: "0.125rem" }, children: formatTimeAgo(purchase.timestamp) })
@@ -2926,77 +2982,43 @@ var PropertyNewsUpdates = React5.forwardRef(
2926
2982
  purchase.id
2927
2983
  );
2928
2984
  }) : /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", padding: "3rem 0", gap: "0.75rem" }, children: [
2929
- /* @__PURE__ */ jsx(
2930
- "div",
2931
- {
2932
- style: {
2933
- width: "28px",
2934
- height: "28px",
2935
- border: "3px solid rgba(255,255,255,0.1)",
2936
- borderTopColor: "var(--color-accent, #f0b90b)",
2937
- borderRadius: "50%",
2938
- animation: "propertyNewsSpin 1s linear infinite"
2939
- }
2940
- }
2941
- ),
2985
+ /* @__PURE__ */ jsx("div", { style: { width: "28px", height: "28px", border: "3px solid rgba(255,255,255,0.1)", borderTopColor: "var(--color-accent, #f0b90b)", borderRadius: "50%", animation: "propertyNewsSpin 1s linear infinite" } }),
2942
2986
  /* @__PURE__ */ jsx("span", { style: { fontSize: "0.8rem", color: "rgba(255,255,255,0.4)" }, children: "Awaiting offering..." })
2943
2987
  ] }) : isHomeVariant ? hasItems ? homePaginatedItems.map((item, index) => {
2944
2988
  const key = item.displayId ?? item.id ?? `${item.title}-${index}`;
2945
- const tagType = item.type;
2946
- const isProperty = tagType === "property";
2989
+ const isProperty = item.type === "property";
2990
+ const sentimentInfo = getSentimentInfo(item.sentimentScore);
2991
+ const isExpanded = expandedId === key;
2947
2992
  return /* @__PURE__ */ jsxs(
2948
- "a",
2993
+ "div",
2949
2994
  {
2950
- href: item.url ?? "#",
2951
- target: "_blank",
2952
- rel: "noopener noreferrer",
2953
- style: {
2954
- display: "flex",
2955
- justifyContent: "space-between",
2956
- alignItems: "center",
2957
- padding: "0.75rem 0",
2958
- borderBottom: index < homePaginatedItems.length - 1 ? "1px solid rgba(255,255,255,0.05)" : "none",
2959
- cursor: "pointer",
2960
- textDecoration: "none",
2961
- color: "inherit"
2962
- },
2995
+ style: { padding: "0.75rem 0", borderBottom: index < homePaginatedItems.length - 1 ? "1px solid rgba(255,255,255,0.05)" : "none" },
2963
2996
  children: [
2964
- /* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
2965
- /* @__PURE__ */ jsx("h3", { style: { fontSize: "0.85rem", fontWeight: 400, marginBottom: "0.25rem", color: "#f8f9fa", lineHeight: 1.4 }, children: item.title }),
2966
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center", flexWrap: "wrap" }, children: [
2967
- /* @__PURE__ */ jsx("span", { style: { color: "#848e9c", fontSize: "0.7rem" }, children: typeof item.date === "string" ? item.date : formatDate(item.date) }),
2968
- item.source && /* @__PURE__ */ jsx(
2969
- "span",
2970
- {
2971
- style: {
2972
- padding: "0.1rem 0.4rem",
2973
- borderRadius: "3px",
2974
- fontSize: "0.62rem",
2975
- fontWeight: 500,
2976
- backgroundColor: "rgba(255,255,255,0.07)",
2977
- color: "#848e9c",
2978
- whiteSpace: "nowrap"
2979
- },
2980
- children: item.source
2981
- }
2982
- ),
2983
- /* @__PURE__ */ jsx(
2984
- "span",
2985
- {
2986
- style: {
2987
- padding: "0.15rem 0.4rem",
2988
- borderRadius: "2px",
2989
- fontSize: "0.65rem",
2990
- fontWeight: 500,
2991
- backgroundColor: isProperty ? "rgba(14,203,129,0.1)" : "rgba(240,185,11,0.1)",
2992
- color: isProperty ? "#0ecb81" : "#f0b90b"
2993
- },
2994
- children: isProperty ? "Property Update" : "Market News"
2995
- }
2996
- )
2997
- ] })
2998
- ] }),
2999
- /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", color: "#848e9c", marginLeft: "0.5rem" }, children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ jsx("path", { d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z" }) }) })
2997
+ /* @__PURE__ */ jsxs(
2998
+ "button",
2999
+ {
3000
+ type: "button",
3001
+ onClick: () => toggleExpand(key),
3002
+ style: { width: "100%", textAlign: "left", background: "transparent", border: "none", cursor: "pointer", padding: 0, display: "flex", justifyContent: "space-between", alignItems: "flex-start", gap: "0.5rem", color: "inherit" },
3003
+ children: [
3004
+ /* @__PURE__ */ jsxs("div", { style: { flex: 1 }, children: [
3005
+ /* @__PURE__ */ jsx("h3", { style: { fontSize: "0.85rem", fontWeight: 400, marginBottom: "0.25rem", color: "#f8f9fa", lineHeight: 1.4 }, children: item.title }),
3006
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "0.5rem", alignItems: "center", flexWrap: "wrap" }, children: [
3007
+ /* @__PURE__ */ jsx("span", { style: { color: "#848e9c", fontSize: "0.7rem" }, children: typeof item.date === "string" ? item.date : formatDate(item.date) }),
3008
+ item.source && /* @__PURE__ */ jsx("span", { style: { padding: "0.1rem 0.4rem", borderRadius: "3px", fontSize: "0.62rem", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.07)", color: "#848e9c", whiteSpace: "nowrap" }, children: item.source }),
3009
+ /* @__PURE__ */ jsx("span", { style: { padding: "0.15rem 0.4rem", borderRadius: "2px", fontSize: "0.65rem", fontWeight: 500, backgroundColor: isProperty ? "rgba(14,203,129,0.1)" : "rgba(240,185,11,0.1)", color: isProperty ? "#0ecb81" : "#f0b90b" }, children: isProperty ? "Property Update" : "Market News" }),
3010
+ sentimentInfo && /* @__PURE__ */ jsxs("span", { style: { fontSize: "0.65rem", fontWeight: 600, color: sentimentInfo.color }, children: [
3011
+ sentimentInfo.arrow,
3012
+ " ",
3013
+ sentimentInfo.label
3014
+ ] })
3015
+ ] })
3016
+ ] }),
3017
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", alignItems: "center", color: "#848e9c", marginLeft: "0.5rem", paddingTop: "2px" }, children: /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "14", height: "14", viewBox: "0 0 24 24", fill: "currentColor", style: { transition: "transform 0.2s", transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)" }, children: /* @__PURE__ */ jsx("path", { d: "M8.59 16.59L13.17 12 8.59 7.41 10 6l6 6-6 6-1.41-1.41z" }) }) })
3018
+ ]
3019
+ }
3020
+ ),
3021
+ isExpanded && /* @__PURE__ */ jsx("div", { style: { marginTop: "0.625rem", padding: "0.75rem", background: "rgba(255,255,255,0.04)", borderRadius: "6px", borderLeft: `3px solid ${sentimentInfo?.color ?? "rgba(255,255,255,0.15)"}`, animation: "propertyNewsSlideIn 0.2s ease-out" }, children: item.summary ? /* @__PURE__ */ jsx("p", { style: { fontSize: "0.8rem", color: "rgba(255,255,255,0.72)", lineHeight: 1.65, margin: 0 }, children: item.summary }) : /* @__PURE__ */ jsx("p", { style: { fontSize: "0.78rem", color: "rgba(255,255,255,0.35)", fontStyle: "italic", margin: 0 }, children: "Summary not available." }) })
3000
3022
  ]
3001
3023
  },
3002
3024
  key
@@ -3004,92 +3026,60 @@ var PropertyNewsUpdates = React5.forwardRef(
3004
3026
  }) : emptyState ?? /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center py-10 text-center text-sm text-white/60", children: "No property news yet." }) : hasItems ? paginatedItems.map((item, index) => {
3005
3027
  const absoluteIndex = page * ITEMS_PER_PAGE + index;
3006
3028
  const key = item.displayId ?? item.id ?? `${item.title}-${absoluteIndex}`;
3007
- const styles2 = categoryStyles[item.type] ?? categoryStyles.market;
3029
+ const catStyle = categoryStyles[item.type] ?? categoryStyles.market;
3008
3030
  const dateLabel = item.isNew ?? (highlightFirst && absoluteIndex === 0) ? "Just now" : typeof item.date === "string" && item.date.trim().length > 0 ? item.date : formatDate(item.date);
3009
3031
  const isHighlighted = item.isNew ?? (highlightFirst && absoluteIndex === 0);
3010
- return /* @__PURE__ */ jsxs(
3011
- "div",
3032
+ const sentimentInfo = getSentimentInfo(item.sentimentScore);
3033
+ return /* @__PURE__ */ jsx(
3034
+ "button",
3012
3035
  {
3036
+ type: "button",
3037
+ onClick: () => setSelectedItem(item),
3013
3038
  style: {
3014
- padding: "0.75rem",
3015
- borderRadius: "6px",
3016
- backgroundColor: isHighlighted ? "rgba(14, 203, 129, 0.1)" : "transparent",
3017
- border: "1px solid transparent",
3018
- transition: "background-color 0.2s",
3019
- animation: item.isNew ? "propertyNewsSlideIn 0.5s ease-out" : void 0
3039
+ display: "block",
3040
+ width: "100%",
3041
+ textAlign: "left",
3042
+ background: "transparent",
3043
+ border: "none",
3044
+ cursor: "pointer",
3045
+ padding: 0,
3046
+ color: "inherit"
3020
3047
  },
3021
- children: [
3022
- /* @__PURE__ */ jsx("p", { style: { fontSize: "0.9375rem", fontWeight: 500, marginBottom: "0.35rem", color: "#fff" }, children: item.url ? /* @__PURE__ */ jsx(
3023
- "a",
3024
- {
3025
- href: item.url,
3026
- target: "_blank",
3027
- rel: "noopener noreferrer",
3028
- style: { color: "inherit", textDecoration: "none" },
3029
- onMouseEnter: (e) => {
3030
- e.currentTarget.style.textDecoration = "underline";
3031
- },
3032
- onMouseLeave: (e) => {
3033
- e.currentTarget.style.textDecoration = "none";
3034
- },
3035
- children: item.title
3036
- }
3037
- ) : item.title }),
3038
- /* @__PURE__ */ jsxs(
3039
- "div",
3040
- {
3041
- style: {
3042
- display: "flex",
3043
- justifyContent: "space-between",
3044
- alignItems: "center",
3045
- fontSize: "0.75rem",
3046
- color: "#b5b8c5",
3047
- gap: "0.5rem"
3048
- },
3049
- children: [
3050
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem", minWidth: 0 }, children: [
3051
- /* @__PURE__ */ jsx("span", { style: { color: isHighlighted ? "#0ecb81" : "inherit", whiteSpace: "nowrap" }, children: dateLabel }),
3052
- item.source && /* @__PURE__ */ jsx(
3053
- "span",
3054
- {
3055
- style: {
3056
- padding: "0.15rem 0.45rem",
3057
- borderRadius: "3px",
3058
- fontSize: "0.65rem",
3059
- fontWeight: 500,
3060
- backgroundColor: "rgba(255,255,255,0.07)",
3061
- color: "#848e9c",
3062
- whiteSpace: "nowrap",
3063
- overflow: "hidden",
3064
- textOverflow: "ellipsis",
3065
- maxWidth: "120px"
3066
- },
3067
- children: item.source
3068
- }
3069
- )
3048
+ children: /* @__PURE__ */ jsxs(
3049
+ "div",
3050
+ {
3051
+ style: {
3052
+ padding: "0.75rem",
3053
+ borderRadius: "6px",
3054
+ backgroundColor: isHighlighted ? "rgba(14, 203, 129, 0.1)" : "transparent",
3055
+ transition: "background-color 0.15s",
3056
+ animation: item.isNew ? "propertyNewsSlideIn 0.5s ease-out" : void 0
3057
+ },
3058
+ onMouseEnter: (e) => {
3059
+ if (!isHighlighted) e.currentTarget.style.backgroundColor = "rgba(255,255,255,0.04)";
3060
+ },
3061
+ onMouseLeave: (e) => {
3062
+ if (!isHighlighted) e.currentTarget.style.backgroundColor = "transparent";
3063
+ },
3064
+ children: [
3065
+ /* @__PURE__ */ jsx("p", { style: { fontSize: "0.9375rem", fontWeight: 500, marginBottom: "0.4rem", color: "#fff", lineHeight: 1.4 }, children: item.title }),
3066
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-end", gap: "0.5rem" }, children: [
3067
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: "0.5rem", minWidth: 0, flexWrap: "wrap" }, children: [
3068
+ /* @__PURE__ */ jsx("span", { style: { fontSize: "0.75rem", color: isHighlighted ? "#0ecb81" : "#b5b8c5", whiteSpace: "nowrap" }, children: dateLabel }),
3069
+ item.source && /* @__PURE__ */ jsx("span", { style: { padding: "0.15rem 0.45rem", borderRadius: "3px", fontSize: "0.65rem", fontWeight: 500, backgroundColor: "rgba(255,255,255,0.07)", color: "#848e9c", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", maxWidth: "120px" }, children: item.source })
3070
3070
  ] }),
3071
- /* @__PURE__ */ jsx(
3072
- "span",
3073
- {
3074
- style: {
3075
- padding: "0.25rem 0.6rem",
3076
- borderRadius: "4px",
3077
- border: `1px solid ${styles2.borderColor}`,
3078
- backgroundColor: styles2.backgroundColor,
3079
- color: styles2.color,
3080
- fontSize: "0.68rem",
3081
- fontWeight: 600,
3082
- textTransform: "uppercase",
3083
- whiteSpace: "nowrap",
3084
- flexShrink: 0
3085
- },
3086
- children: item.type === "property" ? styles2.label : "Market News"
3087
- }
3088
- )
3089
- ]
3090
- }
3091
- )
3092
- ]
3071
+ /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", alignItems: "flex-end", gap: "0.3rem", flexShrink: 0 }, children: [
3072
+ sentimentInfo && /* @__PURE__ */ jsxs("span", { style: { fontSize: "0.65rem", fontWeight: 700, color: sentimentInfo.color, whiteSpace: "nowrap" }, children: [
3073
+ sentimentInfo.arrow,
3074
+ " ",
3075
+ sentimentInfo.label
3076
+ ] }),
3077
+ /* @__PURE__ */ jsx("span", { style: { padding: "0.25rem 0.6rem", borderRadius: "4px", border: `1px solid ${catStyle.borderColor}`, backgroundColor: catStyle.backgroundColor, color: catStyle.color, fontSize: "0.68rem", fontWeight: 600, textTransform: "uppercase", whiteSpace: "nowrap" }, children: item.type === "property" ? catStyle.label : "Market News" })
3078
+ ] })
3079
+ ] })
3080
+ ]
3081
+ }
3082
+ )
3093
3083
  },
3094
3084
  key
3095
3085
  );
@@ -3099,25 +3089,14 @@ var PropertyNewsUpdates = React5.forwardRef(
3099
3089
  ] })
3100
3090
  }
3101
3091
  ),
3102
- isHomeVariant && homeTotalPages > 1 ? /* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center justify-between text-xs text-white/60", children: [
3092
+ isHomeVariant && homeTotalPages > 1 && /* @__PURE__ */ jsxs("div", { className: "mt-3 flex items-center justify-between text-xs text-white/60", children: [
3103
3093
  /* @__PURE__ */ jsx(
3104
3094
  "button",
3105
3095
  {
3106
3096
  type: "button",
3107
- onClick: () => setHomePage((prev) => Math.max(0, prev - 1)),
3097
+ onClick: () => setHomePage((p) => Math.max(0, p - 1)),
3108
3098
  disabled: homePage === 0,
3109
- style: {
3110
- background: "transparent",
3111
- border: "1px solid rgba(255,255,255,0.15)",
3112
- borderRadius: "999px",
3113
- padding: "0.2rem 0.75rem",
3114
- fontSize: "0.7rem",
3115
- textTransform: "uppercase",
3116
- letterSpacing: "0.15em",
3117
- cursor: homePage === 0 ? "not-allowed" : "pointer",
3118
- opacity: homePage === 0 ? 0.4 : 1,
3119
- color: "rgba(255,255,255,0.6)"
3120
- },
3099
+ style: { background: "transparent", border: "1px solid rgba(255,255,255,0.15)", borderRadius: "999px", padding: "0.2rem 0.75rem", fontSize: "0.7rem", textTransform: "uppercase", letterSpacing: "0.15em", cursor: homePage === 0 ? "not-allowed" : "pointer", opacity: homePage === 0 ? 0.4 : 1, color: "rgba(255,255,255,0.6)" },
3121
3100
  children: "Prev"
3122
3101
  }
3123
3102
  ),
@@ -3130,35 +3109,21 @@ var PropertyNewsUpdates = React5.forwardRef(
3130
3109
  "button",
3131
3110
  {
3132
3111
  type: "button",
3133
- onClick: () => setHomePage((prev) => Math.min(homeTotalPages - 1, prev + 1)),
3112
+ onClick: () => setHomePage((p) => Math.min(homeTotalPages - 1, p + 1)),
3134
3113
  disabled: homePage >= homeTotalPages - 1,
3135
- style: {
3136
- background: "transparent",
3137
- border: "1px solid rgba(255,255,255,0.15)",
3138
- borderRadius: "999px",
3139
- padding: "0.2rem 0.75rem",
3140
- fontSize: "0.7rem",
3141
- textTransform: "uppercase",
3142
- letterSpacing: "0.15em",
3143
- cursor: homePage >= homeTotalPages - 1 ? "not-allowed" : "pointer",
3144
- opacity: homePage >= homeTotalPages - 1 ? 0.4 : 1,
3145
- color: "rgba(255,255,255,0.6)"
3146
- },
3114
+ style: { background: "transparent", border: "1px solid rgba(255,255,255,0.15)", borderRadius: "999px", padding: "0.2rem 0.75rem", fontSize: "0.7rem", textTransform: "uppercase", letterSpacing: "0.15em", cursor: homePage >= homeTotalPages - 1 ? "not-allowed" : "pointer", opacity: homePage >= homeTotalPages - 1 ? 0.4 : 1, color: "rgba(255,255,255,0.6)" },
3147
3115
  children: "Next"
3148
3116
  }
3149
3117
  )
3150
- ] }) : null,
3151
- !isPurchaseVariant && !isHomeVariant && hasItems && totalPages > 1 ? /* @__PURE__ */ jsxs("div", { className: "mt-4 flex items-center justify-between text-xs text-white/60", children: [
3118
+ ] }),
3119
+ !isPurchaseVariant && !isHomeVariant && hasItems && totalPages > 1 && /* @__PURE__ */ jsxs("div", { className: "mt-4 flex items-center justify-between text-xs text-white/60", children: [
3152
3120
  /* @__PURE__ */ jsx(
3153
3121
  "button",
3154
3122
  {
3155
3123
  type: "button",
3156
- onClick: () => setPage((prev) => Math.max(0, prev - 1)),
3124
+ onClick: () => setPage((p) => Math.max(0, p - 1)),
3157
3125
  disabled: page === 0,
3158
- className: cn(
3159
- "rounded-full border border-white/15 px-3 py-1 uppercase tracking-[0.2em]",
3160
- page === 0 ? "opacity-40 cursor-not-allowed" : "hover:border-white/40"
3161
- ),
3126
+ className: cn("rounded-full border border-white/15 px-3 py-1 uppercase tracking-[0.2em]", page === 0 ? "opacity-40 cursor-not-allowed" : "hover:border-white/40"),
3162
3127
  children: "Prev"
3163
3128
  }
3164
3129
  ),
@@ -3172,16 +3137,14 @@ var PropertyNewsUpdates = React5.forwardRef(
3172
3137
  "button",
3173
3138
  {
3174
3139
  type: "button",
3175
- onClick: () => setPage((prev) => Math.min(totalPages - 1, prev + 1)),
3140
+ onClick: () => setPage((p) => Math.min(totalPages - 1, p + 1)),
3176
3141
  disabled: page >= totalPages - 1,
3177
- className: cn(
3178
- "rounded-full border border-white/15 px-3 py-1 uppercase tracking-[0.2em]",
3179
- page >= totalPages - 1 ? "opacity-40 cursor-not-allowed" : "hover:border-white/40"
3180
- ),
3142
+ className: cn("rounded-full border border-white/15 px-3 py-1 uppercase tracking-[0.2em]", page >= totalPages - 1 ? "opacity-40 cursor-not-allowed" : "hover:border-white/40"),
3181
3143
  children: "Next"
3182
3144
  }
3183
3145
  )
3184
- ] }) : null
3146
+ ] }),
3147
+ selectedItem && !isHomeVariant && !isPurchaseVariant && /* @__PURE__ */ jsx(NewsArticleModal, { item: selectedItem, onClose: () => setSelectedItem(null) })
3185
3148
  ]
3186
3149
  }
3187
3150
  );