@loafmarkets/ui 0.1.0 → 0.1.2
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.d.mts +76 -5
- package/dist/index.d.ts +76 -5
- package/dist/index.js +1858 -418
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1856 -419
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -6,7 +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 { Newspaper, BedDouble, Bath, CarFront } from 'lucide-react';
|
|
9
|
-
import
|
|
9
|
+
import * as LightweightCharts from 'lightweight-charts';
|
|
10
10
|
|
|
11
11
|
function cn(...inputs) {
|
|
12
12
|
return twMerge(clsx(inputs));
|
|
@@ -784,6 +784,745 @@ function HousePositionSlider({
|
|
|
784
784
|
] })
|
|
785
785
|
] });
|
|
786
786
|
}
|
|
787
|
+
var clamp2 = (v2, min, max) => Math.min(max, Math.max(min, v2));
|
|
788
|
+
var fmt02 = (v2) => Math.abs(v2).toLocaleString(void 0, { maximumFractionDigits: 0 });
|
|
789
|
+
var styles = {
|
|
790
|
+
// SliderContainer @media (max-width: 1024px)
|
|
791
|
+
sliderContainer: {
|
|
792
|
+
display: "flex",
|
|
793
|
+
flexDirection: "column",
|
|
794
|
+
alignItems: "center",
|
|
795
|
+
padding: "1.5rem 1rem 0.75rem",
|
|
796
|
+
background: "#111111",
|
|
797
|
+
borderRadius: "12px",
|
|
798
|
+
gap: "0.4rem",
|
|
799
|
+
position: "relative",
|
|
800
|
+
border: "1px solid rgba(255, 255, 255, 0.1)",
|
|
801
|
+
overflow: "hidden"
|
|
802
|
+
},
|
|
803
|
+
// ValueDisplay @media (max-width: 1024px)
|
|
804
|
+
valueDisplay: {
|
|
805
|
+
textAlign: "center",
|
|
806
|
+
marginBottom: "0.2rem"
|
|
807
|
+
},
|
|
808
|
+
// ValueLabel @media (max-width: 1024px)
|
|
809
|
+
valueLabel: {
|
|
810
|
+
fontSize: "0.65rem",
|
|
811
|
+
color: "#C9A227",
|
|
812
|
+
textTransform: "uppercase",
|
|
813
|
+
letterSpacing: "1px",
|
|
814
|
+
marginBottom: "0.2rem"
|
|
815
|
+
},
|
|
816
|
+
// ValueAmount @media (max-width: 1024px)
|
|
817
|
+
valueAmount: {
|
|
818
|
+
fontSize: "1.1rem",
|
|
819
|
+
fontWeight: 700,
|
|
820
|
+
color: "#fff",
|
|
821
|
+
display: "inline-flex",
|
|
822
|
+
alignItems: "baseline",
|
|
823
|
+
gap: "0.3rem"
|
|
824
|
+
},
|
|
825
|
+
// HouseWrapper @media (max-width: 1024px)
|
|
826
|
+
houseWrapper: {
|
|
827
|
+
display: "flex",
|
|
828
|
+
alignItems: "center",
|
|
829
|
+
justifyContent: "center",
|
|
830
|
+
gap: "0.75rem",
|
|
831
|
+
margin: "0.25rem 0",
|
|
832
|
+
width: "100%"
|
|
833
|
+
},
|
|
834
|
+
// HouseContainer @media (max-width: 1024px)
|
|
835
|
+
houseContainer: {
|
|
836
|
+
position: "relative",
|
|
837
|
+
width: "100px",
|
|
838
|
+
height: "130px",
|
|
839
|
+
cursor: "ns-resize",
|
|
840
|
+
touchAction: "none",
|
|
841
|
+
userSelect: "none"
|
|
842
|
+
},
|
|
843
|
+
// MobilePercentButtons @media (max-width: 1024px)
|
|
844
|
+
mobilePercentButtons: {
|
|
845
|
+
display: "flex",
|
|
846
|
+
flexDirection: "column",
|
|
847
|
+
justifyContent: "space-between",
|
|
848
|
+
height: "130px",
|
|
849
|
+
position: "absolute",
|
|
850
|
+
left: "-38px",
|
|
851
|
+
top: 0
|
|
852
|
+
},
|
|
853
|
+
// MobilePercentBtn
|
|
854
|
+
mobilePercentBtn: {
|
|
855
|
+
background: "rgba(255, 255, 255, 0.05)",
|
|
856
|
+
border: "1px solid rgba(255, 255, 255, 0.2)",
|
|
857
|
+
borderRadius: "4px",
|
|
858
|
+
color: "rgba(255, 255, 255, 0.6)",
|
|
859
|
+
fontSize: "0.55rem",
|
|
860
|
+
padding: "0.25rem 0.35rem",
|
|
861
|
+
cursor: "pointer",
|
|
862
|
+
transition: "all 0.15s ease",
|
|
863
|
+
textAlign: "center",
|
|
864
|
+
minWidth: "32px",
|
|
865
|
+
outline: "none",
|
|
866
|
+
WebkitTapHighlightColor: "transparent"
|
|
867
|
+
},
|
|
868
|
+
// ConfirmButton @media (max-width: 1024px)
|
|
869
|
+
confirmButton: {
|
|
870
|
+
width: "100%",
|
|
871
|
+
padding: "0.65rem",
|
|
872
|
+
fontSize: "0.85rem",
|
|
873
|
+
fontWeight: 600,
|
|
874
|
+
border: "none",
|
|
875
|
+
borderRadius: "8px",
|
|
876
|
+
cursor: "pointer",
|
|
877
|
+
transition: "all 0.2s ease"
|
|
878
|
+
},
|
|
879
|
+
// SummarySection @media (max-width: 1024px)
|
|
880
|
+
summarySection: {
|
|
881
|
+
width: "100%",
|
|
882
|
+
display: "flex",
|
|
883
|
+
flexDirection: "column",
|
|
884
|
+
gap: "0.4rem",
|
|
885
|
+
padding: "0.6rem",
|
|
886
|
+
background: "rgba(0, 0, 0, 0.2)",
|
|
887
|
+
borderRadius: "8px",
|
|
888
|
+
marginTop: 0
|
|
889
|
+
},
|
|
890
|
+
// BoxedSummaryRow @media (max-width: 1024px)
|
|
891
|
+
boxedSummaryRow: {
|
|
892
|
+
display: "flex",
|
|
893
|
+
justifyContent: "space-between",
|
|
894
|
+
alignItems: "center",
|
|
895
|
+
background: "transparent",
|
|
896
|
+
borderRadius: "6px",
|
|
897
|
+
padding: "0.35rem 0.5rem",
|
|
898
|
+
cursor: "text",
|
|
899
|
+
flexWrap: "nowrap",
|
|
900
|
+
fontSize: "0.75rem"
|
|
901
|
+
},
|
|
902
|
+
// SummaryLabel @media (max-width: 1024px)
|
|
903
|
+
summaryLabel: {
|
|
904
|
+
color: "rgba(255, 255, 255, 0.6)",
|
|
905
|
+
fontSize: "0.7rem",
|
|
906
|
+
whiteSpace: "nowrap"
|
|
907
|
+
},
|
|
908
|
+
// SummaryValue @media (max-width: 1024px)
|
|
909
|
+
summaryValue: {
|
|
910
|
+
color: "#fff",
|
|
911
|
+
fontWeight: 500,
|
|
912
|
+
fontSize: "0.8rem",
|
|
913
|
+
display: "flex",
|
|
914
|
+
alignItems: "center",
|
|
915
|
+
gap: "0.25rem",
|
|
916
|
+
overflow: "hidden",
|
|
917
|
+
flexShrink: 1,
|
|
918
|
+
minWidth: 0
|
|
919
|
+
},
|
|
920
|
+
// BoxedInput @media (max-width: 1024px)
|
|
921
|
+
boxedInput: {
|
|
922
|
+
background: "transparent",
|
|
923
|
+
border: "none",
|
|
924
|
+
fontWeight: 600,
|
|
925
|
+
fontSize: "0.8rem",
|
|
926
|
+
width: "50px",
|
|
927
|
+
textAlign: "right",
|
|
928
|
+
outline: "none",
|
|
929
|
+
padding: 0,
|
|
930
|
+
flexShrink: 0
|
|
931
|
+
},
|
|
932
|
+
// InputSuffix @media (max-width: 1024px)
|
|
933
|
+
inputSuffix: {
|
|
934
|
+
fontWeight: 600,
|
|
935
|
+
fontSize: "0.65rem",
|
|
936
|
+
marginLeft: "0.2rem",
|
|
937
|
+
display: "inline-flex",
|
|
938
|
+
alignItems: "center",
|
|
939
|
+
lineHeight: 1,
|
|
940
|
+
overflow: "hidden",
|
|
941
|
+
textOverflow: "ellipsis",
|
|
942
|
+
whiteSpace: "nowrap",
|
|
943
|
+
maxWidth: "80px"
|
|
944
|
+
},
|
|
945
|
+
// SummaryRow @media (max-width: 1024px)
|
|
946
|
+
summaryRow: {
|
|
947
|
+
display: "flex",
|
|
948
|
+
justifyContent: "space-between",
|
|
949
|
+
alignItems: "center",
|
|
950
|
+
fontSize: "0.8rem"
|
|
951
|
+
},
|
|
952
|
+
// OrderTypeToggle @media (max-width: 1024px)
|
|
953
|
+
orderTypeToggle: {
|
|
954
|
+
display: "flex",
|
|
955
|
+
backgroundColor: "rgba(255, 255, 255, 0.05)",
|
|
956
|
+
borderRadius: "6px",
|
|
957
|
+
padding: "2px",
|
|
958
|
+
marginBottom: 0,
|
|
959
|
+
width: "100%"
|
|
960
|
+
},
|
|
961
|
+
// OrderTypeButton @media (max-width: 1024px)
|
|
962
|
+
orderTypeButton: {
|
|
963
|
+
flex: 1,
|
|
964
|
+
padding: "0.35rem",
|
|
965
|
+
fontSize: "0.7rem",
|
|
966
|
+
fontWeight: 500,
|
|
967
|
+
border: "none",
|
|
968
|
+
borderRadius: "4px",
|
|
969
|
+
cursor: "pointer",
|
|
970
|
+
transition: "all 0.15s ease"
|
|
971
|
+
},
|
|
972
|
+
// AvailableFunds
|
|
973
|
+
availableFunds: {
|
|
974
|
+
width: "100%",
|
|
975
|
+
display: "flex",
|
|
976
|
+
justifyContent: "space-between",
|
|
977
|
+
alignItems: "center",
|
|
978
|
+
fontSize: "0.75rem",
|
|
979
|
+
color: "rgba(255, 255, 255, 0.5)"
|
|
980
|
+
},
|
|
981
|
+
// AddFundsButton
|
|
982
|
+
addFundsButton: {
|
|
983
|
+
background: "none",
|
|
984
|
+
border: "none",
|
|
985
|
+
color: "#f0b90b",
|
|
986
|
+
fontSize: "0.75rem",
|
|
987
|
+
cursor: "pointer",
|
|
988
|
+
padding: 0
|
|
989
|
+
}
|
|
990
|
+
};
|
|
991
|
+
function HousePositionSliderMobile({
|
|
992
|
+
tokenId,
|
|
993
|
+
tokenSymbol,
|
|
994
|
+
totalTokens,
|
|
995
|
+
currentPrice,
|
|
996
|
+
availableCash,
|
|
997
|
+
tokensHeld,
|
|
998
|
+
defaultOrderType = "market",
|
|
999
|
+
orderbook,
|
|
1000
|
+
ownershipPercentOverride,
|
|
1001
|
+
onConfirmOrder,
|
|
1002
|
+
className,
|
|
1003
|
+
...props
|
|
1004
|
+
}) {
|
|
1005
|
+
const [orderMode, setOrderMode] = o.useState("none");
|
|
1006
|
+
const [deltaDollars, setDeltaDollars] = o.useState(0);
|
|
1007
|
+
const [deltaTokensSell, setDeltaTokensSell] = o.useState(0);
|
|
1008
|
+
const [deltaTokensBuy, setDeltaTokensBuy] = o.useState(0);
|
|
1009
|
+
const [buyTrackingMode, setBuyTrackingMode] = o.useState("dollars");
|
|
1010
|
+
const [orderType, setOrderType] = o.useState(defaultOrderType);
|
|
1011
|
+
const [limitPrice, setLimitPrice] = o.useState(currentPrice);
|
|
1012
|
+
const [limitPriceInput, setLimitPriceInput] = o.useState(currentPrice.toFixed(2));
|
|
1013
|
+
const [limitPriceDirty, setLimitPriceDirty] = o.useState(false);
|
|
1014
|
+
const [tokenAmountInput, setTokenAmountInput] = o.useState("");
|
|
1015
|
+
const houseRef = o.useRef(null);
|
|
1016
|
+
o.useEffect(() => {
|
|
1017
|
+
if (orderType !== "limit") return;
|
|
1018
|
+
if (limitPriceDirty) return;
|
|
1019
|
+
setLimitPrice(currentPrice);
|
|
1020
|
+
setLimitPriceInput(currentPrice.toFixed(2));
|
|
1021
|
+
}, [orderType, currentPrice, limitPriceDirty]);
|
|
1022
|
+
const effectivePrice = orderType === "limit" ? limitPrice : currentPrice;
|
|
1023
|
+
const holdingsValue = tokensHeld * effectivePrice;
|
|
1024
|
+
const totalCapacity = holdingsValue + availableCash;
|
|
1025
|
+
const baselinePct = totalCapacity > 0 ? holdingsValue / totalCapacity * 100 : 0;
|
|
1026
|
+
let deltaTokens;
|
|
1027
|
+
let deltaValue;
|
|
1028
|
+
let targetTokens;
|
|
1029
|
+
let targetValue;
|
|
1030
|
+
if (orderMode === "buy") {
|
|
1031
|
+
if (buyTrackingMode === "tokens") {
|
|
1032
|
+
deltaTokens = deltaTokensBuy;
|
|
1033
|
+
deltaValue = deltaTokensBuy * effectivePrice;
|
|
1034
|
+
targetTokens = tokensHeld + deltaTokensBuy;
|
|
1035
|
+
targetValue = targetTokens * effectivePrice;
|
|
1036
|
+
} else {
|
|
1037
|
+
deltaValue = deltaDollars;
|
|
1038
|
+
deltaTokens = effectivePrice > 0 ? deltaDollars / effectivePrice : 0;
|
|
1039
|
+
targetTokens = tokensHeld + deltaTokens;
|
|
1040
|
+
targetValue = targetTokens * effectivePrice;
|
|
1041
|
+
}
|
|
1042
|
+
} else if (orderMode === "sell") {
|
|
1043
|
+
deltaTokens = deltaTokensSell;
|
|
1044
|
+
deltaValue = deltaTokensSell * effectivePrice;
|
|
1045
|
+
targetTokens = tokensHeld + deltaTokensSell;
|
|
1046
|
+
targetValue = targetTokens * effectivePrice;
|
|
1047
|
+
} else {
|
|
1048
|
+
deltaTokens = 0;
|
|
1049
|
+
deltaValue = 0;
|
|
1050
|
+
targetTokens = tokensHeld;
|
|
1051
|
+
targetValue = holdingsValue;
|
|
1052
|
+
}
|
|
1053
|
+
const targetPct = totalCapacity > 0 ? targetValue / totalCapacity * 100 : 0;
|
|
1054
|
+
const isIncrease = orderMode === "buy";
|
|
1055
|
+
const hasChange = orderMode !== "none" && (Math.abs(deltaTokens) > 1e-3 || Math.abs(deltaValue) > 0.01);
|
|
1056
|
+
const targetOwnership = totalTokens > 0 ? targetTokens / totalTokens * 100 : 0;
|
|
1057
|
+
const estFeeTokens = effectivePrice > 0 ? Math.abs(deltaValue) * 5e-3 / effectivePrice : 0;
|
|
1058
|
+
const updateOrderFromTargetValue = o.useCallback(
|
|
1059
|
+
(newTargetValue) => {
|
|
1060
|
+
const newDeltaValue = newTargetValue - holdingsValue;
|
|
1061
|
+
if (newDeltaValue > 0.01) {
|
|
1062
|
+
const capped = Math.min(newDeltaValue, availableCash);
|
|
1063
|
+
setOrderMode("buy");
|
|
1064
|
+
setBuyTrackingMode("dollars");
|
|
1065
|
+
setDeltaDollars(capped);
|
|
1066
|
+
setDeltaTokensBuy(0);
|
|
1067
|
+
setDeltaTokensSell(0);
|
|
1068
|
+
} else if (newDeltaValue < -0.01) {
|
|
1069
|
+
const newDeltaTokens = effectivePrice > 0 ? newTargetValue / effectivePrice - tokensHeld : 0;
|
|
1070
|
+
const capped = Math.max(newDeltaTokens, -tokensHeld);
|
|
1071
|
+
setOrderMode("sell");
|
|
1072
|
+
setBuyTrackingMode("dollars");
|
|
1073
|
+
setDeltaTokensSell(capped);
|
|
1074
|
+
setDeltaDollars(0);
|
|
1075
|
+
setDeltaTokensBuy(0);
|
|
1076
|
+
} else {
|
|
1077
|
+
setOrderMode("none");
|
|
1078
|
+
setBuyTrackingMode("dollars");
|
|
1079
|
+
setDeltaDollars(0);
|
|
1080
|
+
setDeltaTokensBuy(0);
|
|
1081
|
+
setDeltaTokensSell(0);
|
|
1082
|
+
}
|
|
1083
|
+
},
|
|
1084
|
+
[holdingsValue, availableCash, effectivePrice, tokensHeld]
|
|
1085
|
+
);
|
|
1086
|
+
const updateOrderFromTokenAmount = o.useCallback(
|
|
1087
|
+
(tokenAmount) => {
|
|
1088
|
+
if (tokenAmount > 0) {
|
|
1089
|
+
const maxTokens = effectivePrice > 0 ? availableCash / effectivePrice : 0;
|
|
1090
|
+
const capped = Math.min(tokenAmount, maxTokens);
|
|
1091
|
+
setOrderMode("buy");
|
|
1092
|
+
setBuyTrackingMode("tokens");
|
|
1093
|
+
setDeltaTokensBuy(capped);
|
|
1094
|
+
setDeltaDollars(0);
|
|
1095
|
+
setDeltaTokensSell(0);
|
|
1096
|
+
} else if (tokenAmount < 0) {
|
|
1097
|
+
const capped = Math.max(tokenAmount, -tokensHeld);
|
|
1098
|
+
setOrderMode("sell");
|
|
1099
|
+
setBuyTrackingMode("dollars");
|
|
1100
|
+
setDeltaTokensSell(capped);
|
|
1101
|
+
setDeltaDollars(0);
|
|
1102
|
+
setDeltaTokensBuy(0);
|
|
1103
|
+
} else {
|
|
1104
|
+
setOrderMode("none");
|
|
1105
|
+
setBuyTrackingMode("dollars");
|
|
1106
|
+
setDeltaDollars(0);
|
|
1107
|
+
setDeltaTokensBuy(0);
|
|
1108
|
+
setDeltaTokensSell(0);
|
|
1109
|
+
}
|
|
1110
|
+
},
|
|
1111
|
+
[effectivePrice, availableCash, tokensHeld]
|
|
1112
|
+
);
|
|
1113
|
+
const handleMarkerClick = o.useCallback(
|
|
1114
|
+
(pct) => {
|
|
1115
|
+
const newTargetValue = pct / 100 * totalCapacity;
|
|
1116
|
+
updateOrderFromTargetValue(newTargetValue);
|
|
1117
|
+
},
|
|
1118
|
+
[totalCapacity, updateOrderFromTargetValue]
|
|
1119
|
+
);
|
|
1120
|
+
const onMouseDown = o.useCallback(
|
|
1121
|
+
(e) => {
|
|
1122
|
+
e.preventDefault();
|
|
1123
|
+
const move = (ev) => {
|
|
1124
|
+
if (!houseRef.current) return;
|
|
1125
|
+
const rect = houseRef.current.getBoundingClientRect();
|
|
1126
|
+
const y2 = ev.clientY - rect.top;
|
|
1127
|
+
const pct = clamp2(100 - y2 / rect.height * 100, 0, 100);
|
|
1128
|
+
const newTargetValue = pct / 100 * totalCapacity;
|
|
1129
|
+
updateOrderFromTargetValue(newTargetValue);
|
|
1130
|
+
};
|
|
1131
|
+
const up = () => {
|
|
1132
|
+
document.removeEventListener("mousemove", move);
|
|
1133
|
+
document.removeEventListener("mouseup", up);
|
|
1134
|
+
};
|
|
1135
|
+
document.addEventListener("mousemove", move);
|
|
1136
|
+
document.addEventListener("mouseup", up);
|
|
1137
|
+
},
|
|
1138
|
+
[totalCapacity, updateOrderFromTargetValue]
|
|
1139
|
+
);
|
|
1140
|
+
const onTouchStart = o.useCallback(
|
|
1141
|
+
(e) => {
|
|
1142
|
+
e.preventDefault();
|
|
1143
|
+
e.stopPropagation();
|
|
1144
|
+
const move = (ev) => {
|
|
1145
|
+
ev.preventDefault();
|
|
1146
|
+
ev.stopPropagation();
|
|
1147
|
+
if (!houseRef.current) return;
|
|
1148
|
+
const rect = houseRef.current.getBoundingClientRect();
|
|
1149
|
+
const touch = ev.touches[0];
|
|
1150
|
+
const y2 = touch.clientY - rect.top;
|
|
1151
|
+
const pct = clamp2(100 - y2 / rect.height * 100, 0, 100);
|
|
1152
|
+
const newTargetValue = pct / 100 * totalCapacity;
|
|
1153
|
+
updateOrderFromTargetValue(newTargetValue);
|
|
1154
|
+
};
|
|
1155
|
+
const up = () => {
|
|
1156
|
+
document.removeEventListener("touchmove", move);
|
|
1157
|
+
document.removeEventListener("touchend", up);
|
|
1158
|
+
};
|
|
1159
|
+
document.addEventListener("touchmove", move, { passive: false });
|
|
1160
|
+
document.addEventListener("touchend", up);
|
|
1161
|
+
},
|
|
1162
|
+
[totalCapacity, updateOrderFromTargetValue]
|
|
1163
|
+
);
|
|
1164
|
+
const handleConfirm = () => {
|
|
1165
|
+
if (!hasChange || !onConfirmOrder) return;
|
|
1166
|
+
onConfirmOrder({
|
|
1167
|
+
side: isIncrease ? "buy" : "sell",
|
|
1168
|
+
orderType,
|
|
1169
|
+
tokenId,
|
|
1170
|
+
tokenSymbol,
|
|
1171
|
+
price: effectivePrice,
|
|
1172
|
+
deltaTokens: Math.abs(deltaTokens),
|
|
1173
|
+
deltaValue: Math.abs(deltaValue),
|
|
1174
|
+
targetOwnership,
|
|
1175
|
+
targetTokens,
|
|
1176
|
+
targetValue
|
|
1177
|
+
});
|
|
1178
|
+
setOrderMode("none");
|
|
1179
|
+
setDeltaDollars(0);
|
|
1180
|
+
setDeltaTokensBuy(0);
|
|
1181
|
+
setDeltaTokensSell(0);
|
|
1182
|
+
};
|
|
1183
|
+
const rectTop = 10;
|
|
1184
|
+
const rectBottom = 150;
|
|
1185
|
+
const totalFillableHeight = rectBottom - rectTop;
|
|
1186
|
+
const baselineFillHeight = baselinePct / 100 * totalFillableHeight;
|
|
1187
|
+
const targetFillHeight = targetPct / 100 * totalFillableHeight;
|
|
1188
|
+
const baselineFillY = rectBottom - baselineFillHeight;
|
|
1189
|
+
const targetFillY = rectBottom - targetFillHeight;
|
|
1190
|
+
const showIncrease = targetPct > baselinePct;
|
|
1191
|
+
const showDecrease = targetPct < baselinePct;
|
|
1192
|
+
const valueLabel = `${tokenSymbol} OWNED`;
|
|
1193
|
+
const getBorderColor = () => {
|
|
1194
|
+
if (!hasChange) return "rgba(201, 162, 39, 0.5)";
|
|
1195
|
+
return isIncrease ? "rgba(14, 203, 129, 0.3)" : "rgba(246, 70, 93, 0.3)";
|
|
1196
|
+
};
|
|
1197
|
+
const getValueColor = () => {
|
|
1198
|
+
if (!hasChange) return "#fff";
|
|
1199
|
+
return isIncrease ? "#0ecb81" : "#f6465d";
|
|
1200
|
+
};
|
|
1201
|
+
return /* @__PURE__ */ jsxs(
|
|
1202
|
+
"div",
|
|
1203
|
+
{
|
|
1204
|
+
style: styles.sliderContainer,
|
|
1205
|
+
className,
|
|
1206
|
+
...props,
|
|
1207
|
+
children: [
|
|
1208
|
+
/* @__PURE__ */ jsxs("div", { style: styles.valueDisplay, children: [
|
|
1209
|
+
/* @__PURE__ */ jsx("div", { style: styles.valueLabel, children: valueLabel }),
|
|
1210
|
+
/* @__PURE__ */ jsxs("div", { style: styles.valueAmount, children: [
|
|
1211
|
+
"$",
|
|
1212
|
+
fmt02(targetValue)
|
|
1213
|
+
] })
|
|
1214
|
+
] }),
|
|
1215
|
+
/* @__PURE__ */ jsx("div", { style: styles.houseWrapper, children: /* @__PURE__ */ jsxs(
|
|
1216
|
+
"div",
|
|
1217
|
+
{
|
|
1218
|
+
ref: houseRef,
|
|
1219
|
+
style: styles.houseContainer,
|
|
1220
|
+
onMouseDown,
|
|
1221
|
+
onTouchStart,
|
|
1222
|
+
children: [
|
|
1223
|
+
/* @__PURE__ */ jsxs("svg", { viewBox: "0 0 120 160", style: { width: "100%", height: "100%", overflow: "visible" }, children: [
|
|
1224
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
1225
|
+
/* @__PURE__ */ jsx("clipPath", { id: "mobile-clip", children: /* @__PURE__ */ jsx("rect", { x: "12", y: "12", width: "96", height: "136", rx: "6" }) }),
|
|
1226
|
+
/* @__PURE__ */ jsxs("linearGradient", { id: "mobileGoldFill", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
|
|
1227
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "rgba(220, 175, 120, 0.7)" }),
|
|
1228
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "rgba(220, 175, 120, 0.7)" })
|
|
1229
|
+
] }),
|
|
1230
|
+
/* @__PURE__ */ jsxs("linearGradient", { id: "mobileGreenFill", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
|
|
1231
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "rgba(14, 203, 129, 0.5)" }),
|
|
1232
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "rgba(14, 203, 129, 0.2)" })
|
|
1233
|
+
] }),
|
|
1234
|
+
/* @__PURE__ */ jsxs("linearGradient", { id: "mobileRedFill", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
|
|
1235
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: "rgba(246, 70, 93, 0.15)" }),
|
|
1236
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: "rgba(246, 70, 93, 0.5)" })
|
|
1237
|
+
] }),
|
|
1238
|
+
/* @__PURE__ */ jsxs("filter", { id: "mobileGoldGlow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
|
|
1239
|
+
/* @__PURE__ */ jsx("feGaussianBlur", { stdDeviation: "6", result: "blur" }),
|
|
1240
|
+
/* @__PURE__ */ jsx("feFlood", { floodColor: "rgba(234, 217, 162, 0.6)", result: "color" }),
|
|
1241
|
+
/* @__PURE__ */ jsx("feComposite", { in: "color", in2: "blur", operator: "in", result: "glow" }),
|
|
1242
|
+
/* @__PURE__ */ jsxs("feMerge", { children: [
|
|
1243
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "glow" }),
|
|
1244
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
|
|
1245
|
+
] })
|
|
1246
|
+
] }),
|
|
1247
|
+
/* @__PURE__ */ jsxs("filter", { id: "mobileGreenGlow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
|
|
1248
|
+
/* @__PURE__ */ jsx("feGaussianBlur", { stdDeviation: "6", result: "blur" }),
|
|
1249
|
+
/* @__PURE__ */ jsx("feFlood", { floodColor: "rgba(14, 203, 129, 0.6)", result: "color" }),
|
|
1250
|
+
/* @__PURE__ */ jsx("feComposite", { in: "color", in2: "blur", operator: "in", result: "glow" }),
|
|
1251
|
+
/* @__PURE__ */ jsxs("feMerge", { children: [
|
|
1252
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "glow" }),
|
|
1253
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
|
|
1254
|
+
] })
|
|
1255
|
+
] }),
|
|
1256
|
+
/* @__PURE__ */ jsxs("filter", { id: "mobileRedGlow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: [
|
|
1257
|
+
/* @__PURE__ */ jsx("feGaussianBlur", { stdDeviation: "6", result: "blur" }),
|
|
1258
|
+
/* @__PURE__ */ jsx("feFlood", { floodColor: "rgba(246, 70, 93, 0.6)", result: "color" }),
|
|
1259
|
+
/* @__PURE__ */ jsx("feComposite", { in: "color", in2: "blur", operator: "in", result: "glow" }),
|
|
1260
|
+
/* @__PURE__ */ jsxs("feMerge", { children: [
|
|
1261
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "glow" }),
|
|
1262
|
+
/* @__PURE__ */ jsx("feMergeNode", { in: "SourceGraphic" })
|
|
1263
|
+
] })
|
|
1264
|
+
] })
|
|
1265
|
+
] }),
|
|
1266
|
+
/* @__PURE__ */ jsx("rect", { x: "10", y: "10", width: "100", height: "140", rx: "8", fill: "rgba(255,255,255,0.04)" }),
|
|
1267
|
+
/* @__PURE__ */ jsxs("g", { clipPath: "url(#mobile-clip)", children: [
|
|
1268
|
+
/* @__PURE__ */ jsx(
|
|
1269
|
+
"rect",
|
|
1270
|
+
{
|
|
1271
|
+
x: "10",
|
|
1272
|
+
y: showDecrease ? targetFillY : baselineFillY,
|
|
1273
|
+
width: "100",
|
|
1274
|
+
height: showDecrease ? targetFillHeight : baselineFillHeight,
|
|
1275
|
+
fill: "url(#mobileGoldFill)"
|
|
1276
|
+
}
|
|
1277
|
+
),
|
|
1278
|
+
showIncrease && /* @__PURE__ */ jsx(
|
|
1279
|
+
"rect",
|
|
1280
|
+
{
|
|
1281
|
+
x: "10",
|
|
1282
|
+
y: targetFillY,
|
|
1283
|
+
width: "100",
|
|
1284
|
+
height: targetFillHeight - baselineFillHeight,
|
|
1285
|
+
fill: "url(#mobileGreenFill)"
|
|
1286
|
+
}
|
|
1287
|
+
),
|
|
1288
|
+
showDecrease && /* @__PURE__ */ jsx(
|
|
1289
|
+
"rect",
|
|
1290
|
+
{
|
|
1291
|
+
x: "10",
|
|
1292
|
+
y: baselineFillY,
|
|
1293
|
+
width: "100",
|
|
1294
|
+
height: baselineFillHeight - targetFillHeight,
|
|
1295
|
+
fill: "url(#mobileRedFill)"
|
|
1296
|
+
}
|
|
1297
|
+
),
|
|
1298
|
+
/* @__PURE__ */ jsx(
|
|
1299
|
+
"line",
|
|
1300
|
+
{
|
|
1301
|
+
x1: "12",
|
|
1302
|
+
y1: targetFillY,
|
|
1303
|
+
x2: "108",
|
|
1304
|
+
y2: targetFillY,
|
|
1305
|
+
stroke: showIncrease ? "rgba(14, 203, 129, 1)" : showDecrease ? "rgba(246, 70, 93, 1)" : "rgba(234, 217, 162, 1)",
|
|
1306
|
+
strokeWidth: "2",
|
|
1307
|
+
strokeLinecap: "round",
|
|
1308
|
+
filter: showIncrease ? "url(#mobileGreenGlow)" : showDecrease ? "url(#mobileRedGlow)" : "url(#mobileGoldGlow)"
|
|
1309
|
+
}
|
|
1310
|
+
)
|
|
1311
|
+
] }),
|
|
1312
|
+
/* @__PURE__ */ jsx(
|
|
1313
|
+
"rect",
|
|
1314
|
+
{
|
|
1315
|
+
x: "10",
|
|
1316
|
+
y: "10",
|
|
1317
|
+
width: "100",
|
|
1318
|
+
height: "140",
|
|
1319
|
+
rx: "8",
|
|
1320
|
+
fill: "none",
|
|
1321
|
+
stroke: showIncrease ? "rgba(14, 203, 129, 0.6)" : showDecrease ? "rgba(246, 70, 93, 0.6)" : "rgba(234, 217, 162, 0.6)",
|
|
1322
|
+
strokeWidth: "2",
|
|
1323
|
+
filter: showIncrease ? "url(#mobileGreenGlow)" : showDecrease ? "url(#mobileRedGlow)" : "url(#mobileGoldGlow)"
|
|
1324
|
+
}
|
|
1325
|
+
),
|
|
1326
|
+
/* @__PURE__ */ jsx("rect", { x: "10", y: "10", width: "100", height: "140", rx: "8", fill: "none", stroke: "rgba(255, 255, 255, 0.1)", strokeWidth: "1" })
|
|
1327
|
+
] }),
|
|
1328
|
+
/* @__PURE__ */ jsx(
|
|
1329
|
+
"div",
|
|
1330
|
+
{
|
|
1331
|
+
style: styles.mobilePercentButtons,
|
|
1332
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
1333
|
+
onTouchStart: (e) => e.stopPropagation(),
|
|
1334
|
+
children: [100, 50, 25, 0].map((pct) => /* @__PURE__ */ jsxs(
|
|
1335
|
+
"button",
|
|
1336
|
+
{
|
|
1337
|
+
type: "button",
|
|
1338
|
+
style: styles.mobilePercentBtn,
|
|
1339
|
+
onClick: (e) => {
|
|
1340
|
+
e.stopPropagation();
|
|
1341
|
+
handleMarkerClick(pct);
|
|
1342
|
+
},
|
|
1343
|
+
children: [
|
|
1344
|
+
pct,
|
|
1345
|
+
"%"
|
|
1346
|
+
]
|
|
1347
|
+
},
|
|
1348
|
+
pct
|
|
1349
|
+
))
|
|
1350
|
+
}
|
|
1351
|
+
)
|
|
1352
|
+
]
|
|
1353
|
+
}
|
|
1354
|
+
) }),
|
|
1355
|
+
/* @__PURE__ */ jsx(
|
|
1356
|
+
"button",
|
|
1357
|
+
{
|
|
1358
|
+
type: "button",
|
|
1359
|
+
disabled: !hasChange,
|
|
1360
|
+
onClick: handleConfirm,
|
|
1361
|
+
style: {
|
|
1362
|
+
...styles.confirmButton,
|
|
1363
|
+
backgroundColor: !hasChange ? "rgba(255, 255, 255, 0.1)" : isIncrease ? "#0ecb81" : "#f6465d",
|
|
1364
|
+
color: !hasChange ? "rgba(255, 255, 255, 0.3)" : "#fff",
|
|
1365
|
+
cursor: !hasChange ? "not-allowed" : "pointer"
|
|
1366
|
+
},
|
|
1367
|
+
children: !hasChange ? "Adjust Position" : isIncrease ? `Buy $${fmt02(deltaValue)}` : `Sell $${fmt02(deltaValue)}`
|
|
1368
|
+
}
|
|
1369
|
+
),
|
|
1370
|
+
/* @__PURE__ */ jsxs("div", { style: styles.summarySection, children: [
|
|
1371
|
+
/* @__PURE__ */ jsxs(
|
|
1372
|
+
"div",
|
|
1373
|
+
{
|
|
1374
|
+
style: {
|
|
1375
|
+
...styles.boxedSummaryRow,
|
|
1376
|
+
border: `1px solid ${getBorderColor()}`
|
|
1377
|
+
},
|
|
1378
|
+
onClick: (e) => {
|
|
1379
|
+
const input = e.currentTarget.querySelector("input");
|
|
1380
|
+
if (input && e.target !== input) {
|
|
1381
|
+
input.focus();
|
|
1382
|
+
const len = input.value.length;
|
|
1383
|
+
input.setSelectionRange(len, len);
|
|
1384
|
+
}
|
|
1385
|
+
},
|
|
1386
|
+
children: [
|
|
1387
|
+
/* @__PURE__ */ jsx("span", { style: styles.summaryLabel, children: isIncrease ? "Est. Buy" : "Est. Sell" }),
|
|
1388
|
+
/* @__PURE__ */ jsxs("span", { style: styles.summaryValue, children: [
|
|
1389
|
+
/* @__PURE__ */ jsx(
|
|
1390
|
+
"input",
|
|
1391
|
+
{
|
|
1392
|
+
type: "text",
|
|
1393
|
+
value: tokenAmountInput || Math.abs(deltaTokens).toFixed(2),
|
|
1394
|
+
onChange: (e) => {
|
|
1395
|
+
const val = e.target.value;
|
|
1396
|
+
if (val === "" || /^[0-9]*\.?[0-9]*$/.test(val)) setTokenAmountInput(val);
|
|
1397
|
+
},
|
|
1398
|
+
onFocus: () => setTokenAmountInput(Math.abs(deltaTokens).toFixed(2)),
|
|
1399
|
+
onBlur: () => {
|
|
1400
|
+
const num = Number.parseFloat(tokenAmountInput);
|
|
1401
|
+
if (Number.isFinite(num) && num >= 0) {
|
|
1402
|
+
const signed = isIncrease || orderMode === "none" ? num : -num;
|
|
1403
|
+
updateOrderFromTokenAmount(signed);
|
|
1404
|
+
}
|
|
1405
|
+
setTokenAmountInput("");
|
|
1406
|
+
},
|
|
1407
|
+
onKeyDown: (e) => {
|
|
1408
|
+
if (e.key === "Enter") e.target.blur();
|
|
1409
|
+
},
|
|
1410
|
+
style: {
|
|
1411
|
+
...styles.boxedInput,
|
|
1412
|
+
color: getValueColor()
|
|
1413
|
+
}
|
|
1414
|
+
}
|
|
1415
|
+
),
|
|
1416
|
+
/* @__PURE__ */ jsx("span", { style: { ...styles.inputSuffix, color: getValueColor() }, children: tokenSymbol })
|
|
1417
|
+
] })
|
|
1418
|
+
]
|
|
1419
|
+
}
|
|
1420
|
+
),
|
|
1421
|
+
/* @__PURE__ */ jsxs(
|
|
1422
|
+
"div",
|
|
1423
|
+
{
|
|
1424
|
+
style: {
|
|
1425
|
+
...styles.boxedSummaryRow,
|
|
1426
|
+
border: `1px solid ${getBorderColor()}`
|
|
1427
|
+
},
|
|
1428
|
+
onClick: (e) => {
|
|
1429
|
+
if (orderType === "limit") {
|
|
1430
|
+
const input = e.currentTarget.querySelector("input");
|
|
1431
|
+
if (input && e.target !== input) {
|
|
1432
|
+
input.focus();
|
|
1433
|
+
const len = input.value.length;
|
|
1434
|
+
input.setSelectionRange(len, len);
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
},
|
|
1438
|
+
children: [
|
|
1439
|
+
/* @__PURE__ */ jsx("span", { style: styles.summaryLabel, children: orderType === "market" ? "Price" : "Limit Price" }),
|
|
1440
|
+
orderType === "market" ? /* @__PURE__ */ jsx("span", { style: { fontWeight: 600, color: "rgba(255, 255, 255, 0.6)", fontSize: "0.8rem" }, children: "Market" }) : /* @__PURE__ */ jsxs("span", { style: styles.summaryValue, children: [
|
|
1441
|
+
/* @__PURE__ */ jsx(
|
|
1442
|
+
"input",
|
|
1443
|
+
{
|
|
1444
|
+
type: "text",
|
|
1445
|
+
value: limitPriceInput,
|
|
1446
|
+
onChange: (e) => {
|
|
1447
|
+
const input = e.target.value;
|
|
1448
|
+
if (input === "" || /^[0-9]*\.?[0-9]*$/.test(input)) {
|
|
1449
|
+
setLimitPriceDirty(true);
|
|
1450
|
+
setLimitPriceInput(input);
|
|
1451
|
+
const num = Number.parseFloat(input);
|
|
1452
|
+
if (Number.isFinite(num) && num > 0) setLimitPrice(num);
|
|
1453
|
+
}
|
|
1454
|
+
},
|
|
1455
|
+
onBlur: () => {
|
|
1456
|
+
const num = Number.parseFloat(limitPriceInput);
|
|
1457
|
+
if (Number.isFinite(num) && num > 0) {
|
|
1458
|
+
setLimitPriceInput(num.toFixed(2));
|
|
1459
|
+
setLimitPrice(num);
|
|
1460
|
+
} else {
|
|
1461
|
+
setLimitPriceInput(limitPrice.toFixed(2));
|
|
1462
|
+
}
|
|
1463
|
+
},
|
|
1464
|
+
onKeyDown: (e) => {
|
|
1465
|
+
if (e.key === "Enter") e.target.blur();
|
|
1466
|
+
},
|
|
1467
|
+
style: {
|
|
1468
|
+
...styles.boxedInput,
|
|
1469
|
+
color: getValueColor()
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
),
|
|
1473
|
+
/* @__PURE__ */ jsx("span", { style: { ...styles.inputSuffix, color: getValueColor() }, children: "USD" })
|
|
1474
|
+
] })
|
|
1475
|
+
]
|
|
1476
|
+
}
|
|
1477
|
+
),
|
|
1478
|
+
/* @__PURE__ */ jsxs("div", { style: styles.summaryRow, children: [
|
|
1479
|
+
/* @__PURE__ */ jsx("span", { style: styles.summaryLabel, children: "Est. Fee" }),
|
|
1480
|
+
/* @__PURE__ */ jsxs("span", { style: { color: "#fff", fontWeight: 500, fontSize: "0.8rem" }, children: [
|
|
1481
|
+
estFeeTokens.toFixed(6),
|
|
1482
|
+
" ",
|
|
1483
|
+
tokenSymbol
|
|
1484
|
+
] })
|
|
1485
|
+
] })
|
|
1486
|
+
] }),
|
|
1487
|
+
/* @__PURE__ */ jsxs("div", { style: styles.orderTypeToggle, children: [
|
|
1488
|
+
/* @__PURE__ */ jsx(
|
|
1489
|
+
"button",
|
|
1490
|
+
{
|
|
1491
|
+
type: "button",
|
|
1492
|
+
onClick: () => setOrderType("market"),
|
|
1493
|
+
style: {
|
|
1494
|
+
...styles.orderTypeButton,
|
|
1495
|
+
backgroundColor: orderType === "market" ? "rgba(201, 162, 39, 0.2)" : "transparent",
|
|
1496
|
+
color: orderType === "market" ? "#C9A227" : "rgba(255, 255, 255, 0.5)"
|
|
1497
|
+
},
|
|
1498
|
+
children: "Market"
|
|
1499
|
+
}
|
|
1500
|
+
),
|
|
1501
|
+
/* @__PURE__ */ jsx(
|
|
1502
|
+
"button",
|
|
1503
|
+
{
|
|
1504
|
+
type: "button",
|
|
1505
|
+
onClick: () => setOrderType("limit"),
|
|
1506
|
+
style: {
|
|
1507
|
+
...styles.orderTypeButton,
|
|
1508
|
+
backgroundColor: orderType === "limit" ? "rgba(201, 162, 39, 0.2)" : "transparent",
|
|
1509
|
+
color: orderType === "limit" ? "#C9A227" : "rgba(255, 255, 255, 0.5)"
|
|
1510
|
+
},
|
|
1511
|
+
children: "Limit"
|
|
1512
|
+
}
|
|
1513
|
+
)
|
|
1514
|
+
] }),
|
|
1515
|
+
/* @__PURE__ */ jsxs("div", { style: styles.availableFunds, children: [
|
|
1516
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
1517
|
+
"Cash: $",
|
|
1518
|
+
availableCash.toLocaleString()
|
|
1519
|
+
] }),
|
|
1520
|
+
/* @__PURE__ */ jsx("button", { type: "button", style: styles.addFundsButton, children: "Add Funds" })
|
|
1521
|
+
] })
|
|
1522
|
+
]
|
|
1523
|
+
}
|
|
1524
|
+
);
|
|
1525
|
+
}
|
|
787
1526
|
|
|
788
1527
|
// ../../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
|
|
789
1528
|
var __assign = function() {
|
|
@@ -2325,6 +3064,17 @@ var LoafLiquidityBadge = o.forwardRef(
|
|
|
2325
3064
|
}
|
|
2326
3065
|
);
|
|
2327
3066
|
LoafLiquidityBadge.displayName = "LoafLiquidityBadge";
|
|
3067
|
+
function useViewportCompact(breakpoint) {
|
|
3068
|
+
const [isCompact, setIsCompact] = o.useState(false);
|
|
3069
|
+
o.useEffect(() => {
|
|
3070
|
+
if (typeof window === "undefined") return;
|
|
3071
|
+
const check = () => setIsCompact(window.innerWidth <= breakpoint);
|
|
3072
|
+
check();
|
|
3073
|
+
window.addEventListener("resize", check);
|
|
3074
|
+
return () => window.removeEventListener("resize", check);
|
|
3075
|
+
}, [breakpoint]);
|
|
3076
|
+
return isCompact;
|
|
3077
|
+
}
|
|
2328
3078
|
var formatNumber = (value, precision) => value.toFixed(precision);
|
|
2329
3079
|
function DepthRow({
|
|
2330
3080
|
side,
|
|
@@ -2343,7 +3093,7 @@ function DepthRow({
|
|
|
2343
3093
|
"absolute inset-y-0 right-0",
|
|
2344
3094
|
isAsk ? "bg-rose-900/30" : "bg-emerald-900/30"
|
|
2345
3095
|
),
|
|
2346
|
-
style: { width: `${
|
|
3096
|
+
style: { width: `${clamp3(depthPct, 0, 100)}%` }
|
|
2347
3097
|
}
|
|
2348
3098
|
),
|
|
2349
3099
|
/* @__PURE__ */ jsxs(
|
|
@@ -2359,10 +3109,12 @@ function DepthRow({
|
|
|
2359
3109
|
/* @__PURE__ */ jsx("div", { className: "relative z-[1] text-right tabular-nums text-white/90", children: formatNumber(amount, amountPrecision) })
|
|
2360
3110
|
] });
|
|
2361
3111
|
}
|
|
2362
|
-
var
|
|
3112
|
+
var clamp3 = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
2363
3113
|
var LEVEL_ROWS_VISIBLE = 6;
|
|
2364
3114
|
var DEPTH_ROW_HEIGHT_PX = 34;
|
|
2365
|
-
var
|
|
3115
|
+
var COMPACT_ROWS_VISIBLE = 5;
|
|
3116
|
+
var COMPACT_ROW_HEIGHT_PX = 30;
|
|
3117
|
+
var COMPACT_BREAKPOINT_PX = 1024;
|
|
2366
3118
|
var Orderbook = o.forwardRef(
|
|
2367
3119
|
({
|
|
2368
3120
|
asks,
|
|
@@ -2377,11 +3129,13 @@ var Orderbook = o.forwardRef(
|
|
|
2377
3129
|
defaultTab = "orderbook",
|
|
2378
3130
|
onTabChange,
|
|
2379
3131
|
rightHeader = /* @__PURE__ */ jsx(LoafLiquidityBadge, { className: "text-[0.6rem]" }),
|
|
3132
|
+
variant = "auto",
|
|
2380
3133
|
className,
|
|
2381
3134
|
...props
|
|
2382
3135
|
}, ref) => {
|
|
2383
3136
|
const [tab, setTab] = o.useState(defaultTab);
|
|
2384
3137
|
const [tradeFilter, setTradeFilter] = o.useState("all");
|
|
3138
|
+
const viewportCompact = useViewportCompact(COMPACT_BREAKPOINT_PX);
|
|
2385
3139
|
o.useEffect(() => {
|
|
2386
3140
|
setTab(defaultTab);
|
|
2387
3141
|
}, [defaultTab]);
|
|
@@ -2389,178 +3143,450 @@ var Orderbook = o.forwardRef(
|
|
|
2389
3143
|
setTab(next2);
|
|
2390
3144
|
onTabChange?.(next2);
|
|
2391
3145
|
};
|
|
3146
|
+
const isCompact = variant === "compact" || variant === "auto" && viewportCompact;
|
|
3147
|
+
const sectionHeight = isCompact ? COMPACT_ROWS_VISIBLE * COMPACT_ROW_HEIGHT_PX : LEVEL_ROWS_VISIBLE * DEPTH_ROW_HEIGHT_PX;
|
|
2392
3148
|
const maxAskDepth = Math.max(1, ...asks.map((l2) => l2.depth ?? l2.amount));
|
|
2393
3149
|
const maxBidDepth = Math.max(1, ...bids.map((l2) => l2.depth ?? l2.amount));
|
|
2394
3150
|
const midClass = midChangePercent == null ? "text-white" : midChangePercent >= 0 ? "text-[#0ecb81]" : "text-[#f6465d]";
|
|
2395
3151
|
const tradeFiltered = trades.filter((t) => tradeFilter === "all" || t.type === tradeFilter);
|
|
2396
|
-
|
|
3152
|
+
const layoutProps = {
|
|
3153
|
+
tab,
|
|
3154
|
+
handleTab,
|
|
3155
|
+
tradeFilter,
|
|
3156
|
+
setTradeFilter,
|
|
3157
|
+
rightHeader,
|
|
3158
|
+
priceLabel,
|
|
3159
|
+
amountLabel,
|
|
3160
|
+
tradeFiltered,
|
|
3161
|
+
precision,
|
|
3162
|
+
amountPrecision,
|
|
3163
|
+
asks,
|
|
3164
|
+
bids,
|
|
3165
|
+
maxAskDepth,
|
|
3166
|
+
maxBidDepth,
|
|
3167
|
+
midPrice,
|
|
3168
|
+
midChangePercent,
|
|
3169
|
+
midClass,
|
|
3170
|
+
sectionHeight
|
|
3171
|
+
};
|
|
3172
|
+
return /* @__PURE__ */ jsx(
|
|
2397
3173
|
Card,
|
|
2398
3174
|
{
|
|
2399
3175
|
ref,
|
|
2400
3176
|
className: cn(
|
|
2401
3177
|
"w-full max-w-[520px] overflow-hidden rounded-[12px] border border-white/10 bg-[#111111] text-white shadow-md",
|
|
3178
|
+
isCompact && "max-w-none",
|
|
2402
3179
|
className
|
|
2403
3180
|
),
|
|
2404
3181
|
...props,
|
|
2405
|
-
children:
|
|
2406
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 pt-4", children: [
|
|
2407
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
2408
|
-
/* @__PURE__ */ jsxs(
|
|
2409
|
-
"button",
|
|
2410
|
-
{
|
|
2411
|
-
type: "button",
|
|
2412
|
-
onClick: () => handleTab("orderbook"),
|
|
2413
|
-
className: cn(
|
|
2414
|
-
"relative pb-2 text-sm font-semibold",
|
|
2415
|
-
tab === "orderbook" ? "text-white" : "text-white/60"
|
|
2416
|
-
),
|
|
2417
|
-
children: [
|
|
2418
|
-
"Orderbook",
|
|
2419
|
-
tab === "orderbook" ? /* @__PURE__ */ jsx("span", { className: "absolute -bottom-px left-0 h-[2px] w-full bg-[#C9A227]" }) : null
|
|
2420
|
-
]
|
|
2421
|
-
}
|
|
2422
|
-
),
|
|
2423
|
-
/* @__PURE__ */ jsxs(
|
|
2424
|
-
"button",
|
|
2425
|
-
{
|
|
2426
|
-
type: "button",
|
|
2427
|
-
onClick: () => handleTab("trades"),
|
|
2428
|
-
className: cn(
|
|
2429
|
-
"relative pb-2 text-sm font-medium",
|
|
2430
|
-
tab === "trades" ? "text-white" : "text-white/60"
|
|
2431
|
-
),
|
|
2432
|
-
children: [
|
|
2433
|
-
"Trades",
|
|
2434
|
-
tab === "trades" ? /* @__PURE__ */ jsx("span", { className: "absolute -bottom-px left-0 h-[2px] w-full bg-[#C9A227]" }) : null
|
|
2435
|
-
]
|
|
2436
|
-
}
|
|
2437
|
-
)
|
|
2438
|
-
] }),
|
|
2439
|
-
tab === "trades" ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
2440
|
-
/* @__PURE__ */ jsx(
|
|
2441
|
-
"button",
|
|
2442
|
-
{
|
|
2443
|
-
type: "button",
|
|
2444
|
-
onClick: () => setTradeFilter("all"),
|
|
2445
|
-
className: cn(
|
|
2446
|
-
"rounded-md px-2 py-1 transition",
|
|
2447
|
-
tradeFilter === "all" ? "bg-white/10 text-white" : "text-white/70 hover:bg-white/10"
|
|
2448
|
-
),
|
|
2449
|
-
children: "All"
|
|
2450
|
-
}
|
|
2451
|
-
),
|
|
2452
|
-
/* @__PURE__ */ jsx(
|
|
2453
|
-
"button",
|
|
2454
|
-
{
|
|
2455
|
-
type: "button",
|
|
2456
|
-
onClick: () => setTradeFilter("buy"),
|
|
2457
|
-
className: cn(
|
|
2458
|
-
"rounded-md px-2 py-1 transition",
|
|
2459
|
-
tradeFilter === "buy" ? "bg-white/10 text-white" : "text-white/70 hover:bg-white/10"
|
|
2460
|
-
),
|
|
2461
|
-
children: "Buy"
|
|
2462
|
-
}
|
|
2463
|
-
),
|
|
2464
|
-
/* @__PURE__ */ jsx(
|
|
2465
|
-
"button",
|
|
2466
|
-
{
|
|
2467
|
-
type: "button",
|
|
2468
|
-
onClick: () => setTradeFilter("sell"),
|
|
2469
|
-
className: cn(
|
|
2470
|
-
"rounded-md px-2 py-1 transition",
|
|
2471
|
-
tradeFilter === "sell" ? "bg-white/10 text-white" : "text-white/70 hover:bg-white/10"
|
|
2472
|
-
),
|
|
2473
|
-
children: "Sell"
|
|
2474
|
-
}
|
|
2475
|
-
)
|
|
2476
|
-
] }) : /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3", children: rightHeader })
|
|
2477
|
-
] }),
|
|
2478
|
-
/* @__PURE__ */ jsxs("div", { className: "px-4 pb-3 pt-2", children: [
|
|
2479
|
-
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 px-3 py-2 text-xs text-white/60", children: [
|
|
2480
|
-
/* @__PURE__ */ jsx("div", { children: priceLabel }),
|
|
2481
|
-
/* @__PURE__ */ jsx("div", { className: "text-right", children: amountLabel })
|
|
2482
|
-
] }),
|
|
2483
|
-
tab === "trades" ? /* @__PURE__ */ jsx(
|
|
2484
|
-
"div",
|
|
2485
|
-
{
|
|
2486
|
-
className: "max-h-[380px] overflow-y-auto overflow-x-hidden",
|
|
2487
|
-
style: { scrollbarGutter: "stable" },
|
|
2488
|
-
children: tradeFiltered.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3 py-10 text-center text-sm text-white/50", children: "No trades" }) : /* @__PURE__ */ jsx("div", { className: "divide-y divide-white/5", children: tradeFiltered.map((trade, i) => /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 items-center gap-3 px-3 py-1.5", children: [
|
|
2489
|
-
/* @__PURE__ */ jsxs(
|
|
2490
|
-
"div",
|
|
2491
|
-
{
|
|
2492
|
-
className: cn(
|
|
2493
|
-
"tabular-nums",
|
|
2494
|
-
trade.type === "buy" ? "text-[#0ecb81]" : "text-[#f6465d]"
|
|
2495
|
-
),
|
|
2496
|
-
children: [
|
|
2497
|
-
"$",
|
|
2498
|
-
formatNumber(trade.price, precision)
|
|
2499
|
-
]
|
|
2500
|
-
}
|
|
2501
|
-
),
|
|
2502
|
-
/* @__PURE__ */ jsx("div", { className: "text-right tabular-nums text-white/90", children: formatNumber(trade.amount, amountPrecision) })
|
|
2503
|
-
] }, `${trade.type}-${trade.price}-${trade.amount}-${trade.time ?? i}`)) })
|
|
2504
|
-
}
|
|
2505
|
-
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2506
|
-
/* @__PURE__ */ jsx(
|
|
2507
|
-
"div",
|
|
2508
|
-
{
|
|
2509
|
-
className: "divide-y divide-white/5 overflow-y-auto",
|
|
2510
|
-
style: { height: `${SECTION_HEIGHT}px`, scrollbarGutter: "stable" },
|
|
2511
|
-
children: asks.map((l2, idx) => /* @__PURE__ */ jsx(
|
|
2512
|
-
DepthRow,
|
|
2513
|
-
{
|
|
2514
|
-
side: "ask",
|
|
2515
|
-
price: l2.price,
|
|
2516
|
-
amount: l2.amount,
|
|
2517
|
-
depthPct: (l2.depth ?? l2.amount) / maxAskDepth * 100,
|
|
2518
|
-
precision,
|
|
2519
|
-
amountPrecision
|
|
2520
|
-
},
|
|
2521
|
-
`ask-${idx}-${l2.price}-${l2.amount}`
|
|
2522
|
-
))
|
|
2523
|
-
}
|
|
2524
|
-
),
|
|
2525
|
-
/* @__PURE__ */ jsxs("div", { className: "mt-2 grid grid-cols-2 items-center gap-3 bg-[#0b1a24] px-3 py-2", children: [
|
|
2526
|
-
/* @__PURE__ */ jsxs("div", { className: cn("text-lg font-semibold tabular-nums", midClass), children: [
|
|
2527
|
-
"$",
|
|
2528
|
-
formatNumber(midPrice, precision),
|
|
2529
|
-
midChangePercent == null ? null : /* @__PURE__ */ jsxs("span", { className: "ml-2 text-sm font-semibold", children: [
|
|
2530
|
-
midChangePercent >= 0 ? "+" : "",
|
|
2531
|
-
midChangePercent.toFixed(2),
|
|
2532
|
-
"%"
|
|
2533
|
-
] })
|
|
2534
|
-
] }),
|
|
2535
|
-
/* @__PURE__ */ jsx("div", {})
|
|
2536
|
-
] }),
|
|
2537
|
-
/* @__PURE__ */ jsx(
|
|
2538
|
-
"div",
|
|
2539
|
-
{
|
|
2540
|
-
className: "divide-y divide-white/5 overflow-y-auto",
|
|
2541
|
-
style: { height: `${SECTION_HEIGHT}px`, scrollbarGutter: "stable" },
|
|
2542
|
-
children: bids.map((l2, idx) => /* @__PURE__ */ jsx(
|
|
2543
|
-
DepthRow,
|
|
2544
|
-
{
|
|
2545
|
-
side: "bid",
|
|
2546
|
-
price: l2.price,
|
|
2547
|
-
amount: l2.amount,
|
|
2548
|
-
depthPct: (l2.depth ?? l2.amount) / maxBidDepth * 100,
|
|
2549
|
-
precision,
|
|
2550
|
-
amountPrecision
|
|
2551
|
-
},
|
|
2552
|
-
`bid-${idx}-${l2.price}-${l2.amount}`
|
|
2553
|
-
))
|
|
2554
|
-
}
|
|
2555
|
-
)
|
|
2556
|
-
] })
|
|
2557
|
-
] })
|
|
2558
|
-
]
|
|
3182
|
+
children: isCompact ? /* @__PURE__ */ jsx(MobileOrderbookLayout, { ...layoutProps }) : /* @__PURE__ */ jsx(DesktopOrderbookLayout, { ...layoutProps })
|
|
2559
3183
|
}
|
|
2560
3184
|
);
|
|
2561
3185
|
}
|
|
2562
3186
|
);
|
|
2563
3187
|
Orderbook.displayName = "Orderbook";
|
|
3188
|
+
function DesktopOrderbookLayout({
|
|
3189
|
+
tab,
|
|
3190
|
+
handleTab,
|
|
3191
|
+
tradeFilter,
|
|
3192
|
+
setTradeFilter,
|
|
3193
|
+
rightHeader,
|
|
3194
|
+
priceLabel,
|
|
3195
|
+
amountLabel,
|
|
3196
|
+
tradeFiltered,
|
|
3197
|
+
precision,
|
|
3198
|
+
amountPrecision,
|
|
3199
|
+
asks,
|
|
3200
|
+
bids,
|
|
3201
|
+
maxAskDepth,
|
|
3202
|
+
maxBidDepth,
|
|
3203
|
+
midPrice,
|
|
3204
|
+
midChangePercent,
|
|
3205
|
+
midClass,
|
|
3206
|
+
sectionHeight
|
|
3207
|
+
}) {
|
|
3208
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3209
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between px-4 pt-4", children: [
|
|
3210
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
|
|
3211
|
+
/* @__PURE__ */ jsxs(
|
|
3212
|
+
"button",
|
|
3213
|
+
{
|
|
3214
|
+
type: "button",
|
|
3215
|
+
onClick: () => handleTab("orderbook"),
|
|
3216
|
+
className: cn(
|
|
3217
|
+
"relative pb-2 text-sm font-semibold",
|
|
3218
|
+
tab === "orderbook" ? "text-white" : "text-white/60"
|
|
3219
|
+
),
|
|
3220
|
+
children: [
|
|
3221
|
+
"Orderbook",
|
|
3222
|
+
tab === "orderbook" ? /* @__PURE__ */ jsx("span", { className: "absolute -bottom-px left-0 h-[2px] w-full bg-[#C9A227]" }) : null
|
|
3223
|
+
]
|
|
3224
|
+
}
|
|
3225
|
+
),
|
|
3226
|
+
/* @__PURE__ */ jsxs(
|
|
3227
|
+
"button",
|
|
3228
|
+
{
|
|
3229
|
+
type: "button",
|
|
3230
|
+
onClick: () => handleTab("trades"),
|
|
3231
|
+
className: cn(
|
|
3232
|
+
"relative pb-2 text-sm font-medium",
|
|
3233
|
+
tab === "trades" ? "text-white" : "text-white/60"
|
|
3234
|
+
),
|
|
3235
|
+
children: [
|
|
3236
|
+
"Trades",
|
|
3237
|
+
tab === "trades" ? /* @__PURE__ */ jsx("span", { className: "absolute -bottom-px left-0 h-[2px] w-full bg-[#C9A227]" }) : null
|
|
3238
|
+
]
|
|
3239
|
+
}
|
|
3240
|
+
)
|
|
3241
|
+
] }),
|
|
3242
|
+
tab === "trades" ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 text-xs", children: [
|
|
3243
|
+
/* @__PURE__ */ jsx(
|
|
3244
|
+
"button",
|
|
3245
|
+
{
|
|
3246
|
+
type: "button",
|
|
3247
|
+
onClick: () => setTradeFilter("all"),
|
|
3248
|
+
className: cn(
|
|
3249
|
+
"rounded-md px-2 py-1 transition",
|
|
3250
|
+
tradeFilter === "all" ? "bg-white/10 text-white" : "text-white/70 hover:bg-white/10"
|
|
3251
|
+
),
|
|
3252
|
+
children: "All"
|
|
3253
|
+
}
|
|
3254
|
+
),
|
|
3255
|
+
/* @__PURE__ */ jsx(
|
|
3256
|
+
"button",
|
|
3257
|
+
{
|
|
3258
|
+
type: "button",
|
|
3259
|
+
onClick: () => setTradeFilter("buy"),
|
|
3260
|
+
className: cn(
|
|
3261
|
+
"rounded-md px-2 py-1 transition",
|
|
3262
|
+
tradeFilter === "buy" ? "bg-white/10 text-white" : "text-white/70 hover:bg-white/10"
|
|
3263
|
+
),
|
|
3264
|
+
children: "Buy"
|
|
3265
|
+
}
|
|
3266
|
+
),
|
|
3267
|
+
/* @__PURE__ */ jsx(
|
|
3268
|
+
"button",
|
|
3269
|
+
{
|
|
3270
|
+
type: "button",
|
|
3271
|
+
onClick: () => setTradeFilter("sell"),
|
|
3272
|
+
className: cn(
|
|
3273
|
+
"rounded-md px-2 py-1 transition",
|
|
3274
|
+
tradeFilter === "sell" ? "bg-white/10 text-white" : "text-white/70 hover:bg-white/10"
|
|
3275
|
+
),
|
|
3276
|
+
children: "Sell"
|
|
3277
|
+
}
|
|
3278
|
+
)
|
|
3279
|
+
] }) : /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3", children: rightHeader })
|
|
3280
|
+
] }),
|
|
3281
|
+
/* @__PURE__ */ jsxs("div", { className: "px-4 pb-3 pt-2", children: [
|
|
3282
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 px-3 py-2 text-xs text-white/60", children: [
|
|
3283
|
+
/* @__PURE__ */ jsx("div", { children: priceLabel }),
|
|
3284
|
+
/* @__PURE__ */ jsx("div", { className: "text-right", children: amountLabel })
|
|
3285
|
+
] }),
|
|
3286
|
+
tab === "trades" ? /* @__PURE__ */ jsx(
|
|
3287
|
+
"div",
|
|
3288
|
+
{
|
|
3289
|
+
className: "max-h-[380px] overflow-y-auto overflow-x-hidden",
|
|
3290
|
+
style: { scrollbarGutter: "stable" },
|
|
3291
|
+
children: tradeFiltered.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-3 py-10 text-center text-sm text-white/50", children: "No trades" }) : /* @__PURE__ */ jsx("div", { className: "divide-y divide-white/5", children: tradeFiltered.map((trade, i) => /* @__PURE__ */ jsxs(
|
|
3292
|
+
"div",
|
|
3293
|
+
{
|
|
3294
|
+
className: "grid grid-cols-2 items-center gap-3 px-3 py-1.5",
|
|
3295
|
+
children: [
|
|
3296
|
+
/* @__PURE__ */ jsxs(
|
|
3297
|
+
"div",
|
|
3298
|
+
{
|
|
3299
|
+
className: cn(
|
|
3300
|
+
"tabular-nums",
|
|
3301
|
+
trade.type === "buy" ? "text-[#0ecb81]" : "text-[#f6465d]"
|
|
3302
|
+
),
|
|
3303
|
+
children: [
|
|
3304
|
+
"$",
|
|
3305
|
+
formatNumber(trade.price, precision)
|
|
3306
|
+
]
|
|
3307
|
+
}
|
|
3308
|
+
),
|
|
3309
|
+
/* @__PURE__ */ jsx("div", { className: "text-right tabular-nums text-white/90", children: formatNumber(trade.amount, amountPrecision) })
|
|
3310
|
+
]
|
|
3311
|
+
},
|
|
3312
|
+
`${trade.type}-${trade.price}-${trade.amount}-${trade.time ?? i}`
|
|
3313
|
+
)) })
|
|
3314
|
+
}
|
|
3315
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3316
|
+
/* @__PURE__ */ jsx(
|
|
3317
|
+
"div",
|
|
3318
|
+
{
|
|
3319
|
+
className: "divide-y divide-white/5 overflow-y-auto",
|
|
3320
|
+
style: { height: `${sectionHeight}px`, scrollbarGutter: "stable" },
|
|
3321
|
+
children: asks.map((l2, idx) => /* @__PURE__ */ jsx(
|
|
3322
|
+
DepthRow,
|
|
3323
|
+
{
|
|
3324
|
+
side: "ask",
|
|
3325
|
+
price: l2.price,
|
|
3326
|
+
amount: l2.amount,
|
|
3327
|
+
depthPct: (l2.depth ?? l2.amount) / maxAskDepth * 100,
|
|
3328
|
+
precision,
|
|
3329
|
+
amountPrecision
|
|
3330
|
+
},
|
|
3331
|
+
`ask-${idx}-${l2.price}-${l2.amount}`
|
|
3332
|
+
))
|
|
3333
|
+
}
|
|
3334
|
+
),
|
|
3335
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-2 grid grid-cols-2 items-center gap-3 bg-[#0b1a24] px-3 py-2", children: [
|
|
3336
|
+
/* @__PURE__ */ jsxs("div", { className: cn("text-lg font-semibold tabular-nums", midClass), children: [
|
|
3337
|
+
"$",
|
|
3338
|
+
formatNumber(midPrice, precision),
|
|
3339
|
+
midChangePercent == null ? null : /* @__PURE__ */ jsxs("span", { className: "ml-2 text-sm font-semibold", children: [
|
|
3340
|
+
midChangePercent >= 0 ? "+" : "",
|
|
3341
|
+
midChangePercent.toFixed(2),
|
|
3342
|
+
"%"
|
|
3343
|
+
] })
|
|
3344
|
+
] }),
|
|
3345
|
+
/* @__PURE__ */ jsx("div", {})
|
|
3346
|
+
] }),
|
|
3347
|
+
/* @__PURE__ */ jsx(
|
|
3348
|
+
"div",
|
|
3349
|
+
{
|
|
3350
|
+
className: "divide-y divide-white/5 overflow-y-auto",
|
|
3351
|
+
style: { height: `${sectionHeight}px`, scrollbarGutter: "stable" },
|
|
3352
|
+
children: bids.map((l2, idx) => /* @__PURE__ */ jsx(
|
|
3353
|
+
DepthRow,
|
|
3354
|
+
{
|
|
3355
|
+
side: "bid",
|
|
3356
|
+
price: l2.price,
|
|
3357
|
+
amount: l2.amount,
|
|
3358
|
+
depthPct: (l2.depth ?? l2.amount) / maxBidDepth * 100,
|
|
3359
|
+
precision,
|
|
3360
|
+
amountPrecision
|
|
3361
|
+
},
|
|
3362
|
+
`bid-${idx}-${l2.price}-${l2.amount}`
|
|
3363
|
+
))
|
|
3364
|
+
}
|
|
3365
|
+
)
|
|
3366
|
+
] })
|
|
3367
|
+
] })
|
|
3368
|
+
] });
|
|
3369
|
+
}
|
|
3370
|
+
function MobileOrderbookLayout({
|
|
3371
|
+
tab,
|
|
3372
|
+
handleTab,
|
|
3373
|
+
tradeFilter,
|
|
3374
|
+
setTradeFilter,
|
|
3375
|
+
rightHeader,
|
|
3376
|
+
priceLabel,
|
|
3377
|
+
amountLabel,
|
|
3378
|
+
tradeFiltered,
|
|
3379
|
+
precision,
|
|
3380
|
+
amountPrecision,
|
|
3381
|
+
asks,
|
|
3382
|
+
bids,
|
|
3383
|
+
maxAskDepth,
|
|
3384
|
+
maxBidDepth,
|
|
3385
|
+
midPrice,
|
|
3386
|
+
midChangePercent,
|
|
3387
|
+
midClass,
|
|
3388
|
+
sectionHeight
|
|
3389
|
+
}) {
|
|
3390
|
+
const visibleAsks = o.useMemo(() => asks.slice(0, COMPACT_ROWS_VISIBLE), [asks]);
|
|
3391
|
+
const visibleBids = o.useMemo(() => bids.slice(0, COMPACT_ROWS_VISIBLE), [bids]);
|
|
3392
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3393
|
+
/* @__PURE__ */ jsx("div", { className: "px-3 pt-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
3394
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
3395
|
+
/* @__PURE__ */ jsx(
|
|
3396
|
+
"span",
|
|
3397
|
+
{
|
|
3398
|
+
onClick: () => handleTab("orderbook"),
|
|
3399
|
+
style: {
|
|
3400
|
+
cursor: "pointer",
|
|
3401
|
+
fontSize: "0.8rem",
|
|
3402
|
+
fontWeight: tab === "orderbook" ? 600 : 400,
|
|
3403
|
+
color: tab === "orderbook" ? "#fff" : "rgba(255,255,255,0.6)",
|
|
3404
|
+
borderBottom: tab === "orderbook" ? "2px solid #C9A227" : "none",
|
|
3405
|
+
paddingBottom: "0.25rem"
|
|
3406
|
+
},
|
|
3407
|
+
children: "Orderbook"
|
|
3408
|
+
}
|
|
3409
|
+
),
|
|
3410
|
+
/* @__PURE__ */ jsx(
|
|
3411
|
+
"span",
|
|
3412
|
+
{
|
|
3413
|
+
onClick: () => handleTab("trades"),
|
|
3414
|
+
style: {
|
|
3415
|
+
cursor: "pointer",
|
|
3416
|
+
fontSize: "0.8rem",
|
|
3417
|
+
fontWeight: tab === "trades" ? 600 : 400,
|
|
3418
|
+
color: tab === "trades" ? "#fff" : "rgba(255,255,255,0.6)",
|
|
3419
|
+
borderBottom: tab === "trades" ? "2px solid #C9A227" : "none",
|
|
3420
|
+
paddingBottom: "0.25rem"
|
|
3421
|
+
},
|
|
3422
|
+
children: "Trades"
|
|
3423
|
+
}
|
|
3424
|
+
)
|
|
3425
|
+
] }),
|
|
3426
|
+
tab === "trades" ? /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 text-[0.6rem] text-white/70", children: ["all", "buy", "sell"].map((filter2) => /* @__PURE__ */ jsx(
|
|
3427
|
+
"button",
|
|
3428
|
+
{
|
|
3429
|
+
type: "button",
|
|
3430
|
+
onClick: () => setTradeFilter(filter2),
|
|
3431
|
+
className: cn(
|
|
3432
|
+
"rounded-md border border-white/15 px-2 py-1",
|
|
3433
|
+
tradeFilter === filter2 ? "bg-white/15 text-white" : "hover:bg-white/10"
|
|
3434
|
+
),
|
|
3435
|
+
children: filter2 === "all" ? "All" : filter2 === "buy" ? "Buy" : "Sell"
|
|
3436
|
+
},
|
|
3437
|
+
filter2
|
|
3438
|
+
)) }) : /* @__PURE__ */ jsx("div", { className: "hidden text-xs text-white/70 sm:flex", children: rightHeader })
|
|
3439
|
+
] }) }),
|
|
3440
|
+
tab === "orderbook" ? /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden px-3 pb-2", children: [
|
|
3441
|
+
/* @__PURE__ */ jsx(
|
|
3442
|
+
"div",
|
|
3443
|
+
{
|
|
3444
|
+
className: "inline-flex sm:hidden",
|
|
3445
|
+
style: { padding: "0.5rem 0", marginBottom: "0.5rem", transform: "scale(0.85)", transformOrigin: "left center" },
|
|
3446
|
+
children: rightHeader
|
|
3447
|
+
}
|
|
3448
|
+
),
|
|
3449
|
+
/* @__PURE__ */ jsxs(
|
|
3450
|
+
"div",
|
|
3451
|
+
{
|
|
3452
|
+
className: "grid text-white/60",
|
|
3453
|
+
style: { gridTemplateColumns: "1.2fr 0.8fr", padding: "0.3rem 0 0.2rem 0", fontSize: "0.75rem", fontWeight: 500 },
|
|
3454
|
+
children: [
|
|
3455
|
+
/* @__PURE__ */ jsx("div", { children: priceLabel }),
|
|
3456
|
+
/* @__PURE__ */ jsx("div", { style: { textAlign: "right", paddingRight: "0.5rem" }, children: amountLabel })
|
|
3457
|
+
]
|
|
3458
|
+
}
|
|
3459
|
+
),
|
|
3460
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, children: visibleAsks.map((l2, idx) => /* @__PURE__ */ jsx(
|
|
3461
|
+
MobileDepthRow,
|
|
3462
|
+
{
|
|
3463
|
+
side: "ask",
|
|
3464
|
+
price: l2.price,
|
|
3465
|
+
amount: l2.amount,
|
|
3466
|
+
depthPct: (l2.depth ?? l2.amount) / maxAskDepth * 100,
|
|
3467
|
+
precision,
|
|
3468
|
+
amountPrecision
|
|
3469
|
+
},
|
|
3470
|
+
`mobile-ask-${idx}-${l2.price}-${l2.amount}`
|
|
3471
|
+
)) }),
|
|
3472
|
+
/* @__PURE__ */ jsxs(
|
|
3473
|
+
"div",
|
|
3474
|
+
{
|
|
3475
|
+
className: "grid",
|
|
3476
|
+
style: {
|
|
3477
|
+
gridTemplateColumns: "1.2fr 0.8fr",
|
|
3478
|
+
padding: "0.3rem 0",
|
|
3479
|
+
fontSize: "0.8rem",
|
|
3480
|
+
backgroundColor: "rgba(0, 123, 255, 0.05)",
|
|
3481
|
+
borderTop: "1px solid rgba(255,255,255,0.1)",
|
|
3482
|
+
borderBottom: "1px solid rgba(255,255,255,0.1)"
|
|
3483
|
+
},
|
|
3484
|
+
children: [
|
|
3485
|
+
/* @__PURE__ */ jsxs("div", { style: { fontWeight: "bold", display: "flex", alignItems: "center", gap: "8px" }, className: midClass, children: [
|
|
3486
|
+
"$",
|
|
3487
|
+
formatNumber(midPrice, precision),
|
|
3488
|
+
midChangePercent != null && /* @__PURE__ */ jsxs("span", { style: { fontSize: "0.8rem" }, className: midClass, children: [
|
|
3489
|
+
midChangePercent >= 0 ? "+" : "",
|
|
3490
|
+
midChangePercent.toFixed(2),
|
|
3491
|
+
"%"
|
|
3492
|
+
] })
|
|
3493
|
+
] }),
|
|
3494
|
+
/* @__PURE__ */ jsx("div", {})
|
|
3495
|
+
]
|
|
3496
|
+
}
|
|
3497
|
+
),
|
|
3498
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column" }, children: visibleBids.map((l2, idx) => /* @__PURE__ */ jsx(
|
|
3499
|
+
MobileDepthRow,
|
|
3500
|
+
{
|
|
3501
|
+
side: "bid",
|
|
3502
|
+
price: l2.price,
|
|
3503
|
+
amount: l2.amount,
|
|
3504
|
+
depthPct: (l2.depth ?? l2.amount) / maxBidDepth * 100,
|
|
3505
|
+
precision,
|
|
3506
|
+
amountPrecision
|
|
3507
|
+
},
|
|
3508
|
+
`mobile-bid-${idx}-${l2.price}-${l2.amount}`
|
|
3509
|
+
)) })
|
|
3510
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col overflow-hidden px-3 pb-2", children: [
|
|
3511
|
+
/* @__PURE__ */ jsxs(
|
|
3512
|
+
"div",
|
|
3513
|
+
{
|
|
3514
|
+
className: "grid text-white/60",
|
|
3515
|
+
style: { gridTemplateColumns: "1.2fr 0.8fr", padding: "0.3rem 0 0.2rem 0", fontSize: "0.75rem", fontWeight: 500 },
|
|
3516
|
+
children: [
|
|
3517
|
+
/* @__PURE__ */ jsx("div", { children: priceLabel }),
|
|
3518
|
+
/* @__PURE__ */ jsx("div", { style: { textAlign: "right", paddingRight: "0.5rem" }, children: amountLabel })
|
|
3519
|
+
]
|
|
3520
|
+
}
|
|
3521
|
+
),
|
|
3522
|
+
/* @__PURE__ */ jsx("div", { style: { flex: 1, overflowY: "auto", minHeight: 0 }, children: tradeFiltered.length === 0 ? /* @__PURE__ */ jsx("div", { className: "py-6 text-center text-[0.7rem] text-white/50", children: "No trades" }) : tradeFiltered.map((trade, i) => /* @__PURE__ */ jsxs(
|
|
3523
|
+
"div",
|
|
3524
|
+
{
|
|
3525
|
+
className: "grid",
|
|
3526
|
+
style: { gridTemplateColumns: "1.2fr 0.8fr", padding: "0.2rem 0", fontSize: "0.8rem" },
|
|
3527
|
+
children: [
|
|
3528
|
+
/* @__PURE__ */ jsxs(
|
|
3529
|
+
"div",
|
|
3530
|
+
{
|
|
3531
|
+
style: { color: trade.type === "buy" ? "#0ecb81" : "#f6465d", fontWeight: 500 },
|
|
3532
|
+
children: [
|
|
3533
|
+
"$",
|
|
3534
|
+
formatNumber(trade.price, precision)
|
|
3535
|
+
]
|
|
3536
|
+
}
|
|
3537
|
+
),
|
|
3538
|
+
/* @__PURE__ */ jsx("div", { style: { textAlign: "right", paddingRight: "0.5rem" }, children: formatNumber(trade.amount, amountPrecision) })
|
|
3539
|
+
]
|
|
3540
|
+
},
|
|
3541
|
+
`${trade.type}-${trade.price}-${trade.amount}-${trade.time ?? i}`
|
|
3542
|
+
)) })
|
|
3543
|
+
] })
|
|
3544
|
+
] });
|
|
3545
|
+
}
|
|
3546
|
+
function MobileDepthRow({
|
|
3547
|
+
side,
|
|
3548
|
+
price,
|
|
3549
|
+
amount,
|
|
3550
|
+
depthPct,
|
|
3551
|
+
precision,
|
|
3552
|
+
amountPrecision
|
|
3553
|
+
}) {
|
|
3554
|
+
const isAsk = side === "ask";
|
|
3555
|
+
return /* @__PURE__ */ jsxs(
|
|
3556
|
+
"div",
|
|
3557
|
+
{
|
|
3558
|
+
style: {
|
|
3559
|
+
display: "grid",
|
|
3560
|
+
gridTemplateColumns: "1.2fr 0.8fr",
|
|
3561
|
+
padding: "0.2rem 0",
|
|
3562
|
+
fontSize: "0.8rem",
|
|
3563
|
+
position: "relative"
|
|
3564
|
+
},
|
|
3565
|
+
children: [
|
|
3566
|
+
/* @__PURE__ */ jsxs("div", { style: { position: "relative", zIndex: 1, color: isAsk ? "#f6465d" : "#0ecb81" }, children: [
|
|
3567
|
+
"$",
|
|
3568
|
+
formatNumber(price, precision)
|
|
3569
|
+
] }),
|
|
3570
|
+
/* @__PURE__ */ jsx("div", { style: { textAlign: "right", paddingRight: "0.5rem", position: "relative", zIndex: 1 }, children: formatNumber(amount, amountPrecision) }),
|
|
3571
|
+
/* @__PURE__ */ jsx(
|
|
3572
|
+
"div",
|
|
3573
|
+
{
|
|
3574
|
+
style: {
|
|
3575
|
+
position: "absolute",
|
|
3576
|
+
top: 0,
|
|
3577
|
+
right: 0,
|
|
3578
|
+
bottom: 0,
|
|
3579
|
+
width: `${clamp3(depthPct, 0, 100)}%`,
|
|
3580
|
+
backgroundColor: isAsk ? "#f6465d" : "#0ecb81",
|
|
3581
|
+
opacity: 0.1,
|
|
3582
|
+
zIndex: 0
|
|
3583
|
+
}
|
|
3584
|
+
}
|
|
3585
|
+
)
|
|
3586
|
+
]
|
|
3587
|
+
}
|
|
3588
|
+
);
|
|
3589
|
+
}
|
|
2564
3590
|
var PropertyTour = o.forwardRef(
|
|
2565
3591
|
({
|
|
2566
3592
|
className,
|
|
@@ -2765,7 +3791,7 @@ var PropertyNewsUpdates = o.forwardRef(
|
|
|
2765
3791
|
children: hasItems ? paginatedItems.map((item, index) => {
|
|
2766
3792
|
const absoluteIndex = page * ITEMS_PER_PAGE + index;
|
|
2767
3793
|
const key = item.displayId ?? item.id ?? `${item.title}-${absoluteIndex}`;
|
|
2768
|
-
const
|
|
3794
|
+
const styles2 = categoryStyles[item.type] ?? categoryStyles.market;
|
|
2769
3795
|
const dateLabel = item.isNew ?? (highlightFirst && absoluteIndex === 0) ? "Just now" : typeof item.date === "string" && item.date.trim().length > 0 ? item.date : formatDate(item.date);
|
|
2770
3796
|
const isHighlighted = item.isNew ?? (highlightFirst && absoluteIndex === 0);
|
|
2771
3797
|
return /* @__PURE__ */ jsxs(
|
|
@@ -2799,14 +3825,14 @@ var PropertyNewsUpdates = o.forwardRef(
|
|
|
2799
3825
|
style: {
|
|
2800
3826
|
padding: "0.25rem 0.6rem",
|
|
2801
3827
|
borderRadius: "4px",
|
|
2802
|
-
border: `1px solid ${
|
|
2803
|
-
backgroundColor:
|
|
2804
|
-
color:
|
|
3828
|
+
border: `1px solid ${styles2.borderColor}`,
|
|
3829
|
+
backgroundColor: styles2.backgroundColor,
|
|
3830
|
+
color: styles2.color,
|
|
2805
3831
|
fontSize: "0.68rem",
|
|
2806
3832
|
fontWeight: 600,
|
|
2807
3833
|
textTransform: "uppercase"
|
|
2808
3834
|
},
|
|
2809
|
-
children: item.type === "property" ?
|
|
3835
|
+
children: item.type === "property" ? styles2.label : "Market News"
|
|
2810
3836
|
}
|
|
2811
3837
|
)
|
|
2812
3838
|
]
|
|
@@ -2870,6 +3896,7 @@ var PropertyCompareBar = o.forwardRef(
|
|
|
2870
3896
|
onSelectAddress,
|
|
2871
3897
|
propertyValue,
|
|
2872
3898
|
propertyValueVariant = "classic",
|
|
3899
|
+
price,
|
|
2873
3900
|
...props
|
|
2874
3901
|
}, ref) => {
|
|
2875
3902
|
const normalizedAddresses = o.useMemo(() => {
|
|
@@ -2936,7 +3963,36 @@ var PropertyCompareBar = o.forwardRef(
|
|
|
2936
3963
|
const formattedPropertyChange = propertyValue?.change == null ? null : `${propertyValue.change >= 0 ? "+" : "-"}${propertyValueCurrency}${Math.abs(
|
|
2937
3964
|
propertyValue.change
|
|
2938
3965
|
).toLocaleString(void 0, propertyValueFormat)}`;
|
|
2939
|
-
|
|
3966
|
+
const priceCurrency = price?.currencySymbol ?? "$";
|
|
3967
|
+
const priceFormat = price?.formatOptions ?? { minimumFractionDigits: 2, maximumFractionDigits: 2 };
|
|
3968
|
+
const pricePercentFormat = price?.percentFormatOptions ?? { minimumFractionDigits: 2, maximumFractionDigits: 2 };
|
|
3969
|
+
const formattedPriceValue = price == null ? null : `${priceCurrency}${price.value.toLocaleString(void 0, priceFormat)}`;
|
|
3970
|
+
const formattedPriceChange = price?.change == null ? null : `${price.change >= 0 ? "+" : "-"}${priceCurrency}${Math.abs(price.change).toLocaleString(
|
|
3971
|
+
void 0,
|
|
3972
|
+
priceFormat
|
|
3973
|
+
)}`;
|
|
3974
|
+
const formattedPricePercent = price?.changePercent == null ? null : `${price.changePercent >= 0 ? "+" : "-"}${Math.abs(price.changePercent).toLocaleString(
|
|
3975
|
+
void 0,
|
|
3976
|
+
pricePercentFormat
|
|
3977
|
+
)}%`;
|
|
3978
|
+
const priceContent = formattedPriceValue && propertyValueVariant === "pill" ? /* @__PURE__ */ jsxs(PriceBlock, { $variant: propertyValueVariant, children: [
|
|
3979
|
+
/* @__PURE__ */ jsx(PriceAmount, { children: formattedPriceValue }),
|
|
3980
|
+
formattedPriceChange || formattedPricePercent ? /* @__PURE__ */ jsxs(
|
|
3981
|
+
PriceChange,
|
|
3982
|
+
{
|
|
3983
|
+
$isPositive: price?.change != null ? price.change >= 0 : price?.changePercent != null ? price.changePercent >= 0 : void 0,
|
|
3984
|
+
children: [
|
|
3985
|
+
formattedPriceChange ? /* @__PURE__ */ jsx("span", { children: formattedPriceChange }) : null,
|
|
3986
|
+
formattedPricePercent ? /* @__PURE__ */ jsx("span", { children: formattedPricePercent }) : null
|
|
3987
|
+
]
|
|
3988
|
+
}
|
|
3989
|
+
) : null
|
|
3990
|
+
] }) : null;
|
|
3991
|
+
const propertyValueContent = formattedPropertyValue ? /* @__PURE__ */ jsxs(PropertyValueBlock, { $variant: propertyValueVariant, children: [
|
|
3992
|
+
/* @__PURE__ */ jsx(PropertyValueLabel, { children: propertyValueLabel }),
|
|
3993
|
+
/* @__PURE__ */ jsx(PropertyValueAmount, { children: formattedPropertyValue }),
|
|
3994
|
+
formattedPropertyChange ? /* @__PURE__ */ jsx(PropertyValueChange, { $isPositive: propertyValue?.change != null ? propertyValue.change >= 0 : void 0, children: formattedPropertyChange }) : null
|
|
3995
|
+
] }) : null;
|
|
2940
3996
|
return /* @__PURE__ */ jsxs(PropertySelectorContainer, { ref, className, $variant: propertyValueVariant, ...props, children: [
|
|
2941
3997
|
/* @__PURE__ */ jsxs(PropertySelector, { ref: dropdownRef, onClick: () => hasAddresses && setIsDropdownOpen((prev2) => !prev2), children: [
|
|
2942
3998
|
/* @__PURE__ */ jsxs(PropertyAddress, { children: [
|
|
@@ -2967,11 +4023,10 @@ var PropertyCompareBar = o.forwardRef(
|
|
|
2967
4023
|
option.id
|
|
2968
4024
|
)) })
|
|
2969
4025
|
] }),
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
] }) : null
|
|
4026
|
+
propertyValueVariant === "pill" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4027
|
+
priceContent,
|
|
4028
|
+
propertyValueContent
|
|
4029
|
+
] }) : propertyValueContent
|
|
2975
4030
|
] });
|
|
2976
4031
|
}
|
|
2977
4032
|
);
|
|
@@ -2998,14 +4053,36 @@ var PropertySelectorContainer = at.div`
|
|
|
2998
4053
|
border-radius: 0;
|
|
2999
4054
|
margin-top: 0;
|
|
3000
4055
|
padding-top: 0.5rem;
|
|
3001
|
-
flex-direction: column;
|
|
3002
|
-
align-items: flex-start;
|
|
3003
|
-
gap: 0.75rem;
|
|
3004
4056
|
}
|
|
3005
4057
|
|
|
3006
4058
|
@media (max-width: 600px) {
|
|
3007
|
-
|
|
3008
|
-
|
|
4059
|
+
width: 100%;
|
|
4060
|
+
|
|
4061
|
+
${({ $variant }) => $variant === "pill" ? rt`
|
|
4062
|
+
display: grid;
|
|
4063
|
+
grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 1fr);
|
|
4064
|
+
gap: 0.35rem;
|
|
4065
|
+
align-items: center;
|
|
4066
|
+
|
|
4067
|
+
> *:nth-child(1) {
|
|
4068
|
+
width: 100%;
|
|
4069
|
+
}
|
|
4070
|
+
|
|
4071
|
+
> *:nth-child(2) {
|
|
4072
|
+
justify-self: center;
|
|
4073
|
+
width: 100%;
|
|
4074
|
+
}
|
|
4075
|
+
|
|
4076
|
+
> *:nth-child(3) {
|
|
4077
|
+
justify-self: end;
|
|
4078
|
+
text-align: right;
|
|
4079
|
+
}
|
|
4080
|
+
` : rt`
|
|
4081
|
+
flex-direction: row;
|
|
4082
|
+
align-items: center;
|
|
4083
|
+
justify-content: space-between;
|
|
4084
|
+
gap: 0.5rem;
|
|
4085
|
+
`};
|
|
3009
4086
|
}
|
|
3010
4087
|
`;
|
|
3011
4088
|
var PropertySelector = at.div`
|
|
@@ -3023,7 +4100,7 @@ var PropertySelector = at.div`
|
|
|
3023
4100
|
}
|
|
3024
4101
|
`;
|
|
3025
4102
|
var PropertyAddress = at.div`
|
|
3026
|
-
font-size: 1.
|
|
4103
|
+
font-size: 1.125rem;
|
|
3027
4104
|
font-weight: 600;
|
|
3028
4105
|
display: flex;
|
|
3029
4106
|
align-items: center;
|
|
@@ -3033,6 +4110,15 @@ var PropertyAddress = at.div`
|
|
|
3033
4110
|
svg {
|
|
3034
4111
|
transition: transform 0.2s;
|
|
3035
4112
|
}
|
|
4113
|
+
|
|
4114
|
+
@media (max-width: 600px) {
|
|
4115
|
+
flex-direction: column;
|
|
4116
|
+
align-items: flex-start;
|
|
4117
|
+
gap: 0.2rem;
|
|
4118
|
+
font-size: 1rem;
|
|
4119
|
+
line-height: 1.2;
|
|
4120
|
+
white-space: normal;
|
|
4121
|
+
}
|
|
3036
4122
|
`;
|
|
3037
4123
|
var PropertySelectorDropdown = at.div`
|
|
3038
4124
|
position: absolute;
|
|
@@ -3083,6 +4169,19 @@ var PropertyValueBlock = at.div`
|
|
|
3083
4169
|
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
|
3084
4170
|
gap: 0.85rem;
|
|
3085
4171
|
justify-content: flex-end;
|
|
4172
|
+
|
|
4173
|
+
@media (max-width: 600px) {
|
|
4174
|
+
margin: 0;
|
|
4175
|
+
width: auto;
|
|
4176
|
+
min-width: 0;
|
|
4177
|
+
flex-direction: column;
|
|
4178
|
+
align-items: flex-end;
|
|
4179
|
+
gap: 0.125rem;
|
|
4180
|
+
padding: 0;
|
|
4181
|
+
background: transparent;
|
|
4182
|
+
border-radius: 0;
|
|
4183
|
+
box-shadow: none;
|
|
4184
|
+
}
|
|
3086
4185
|
`}
|
|
3087
4186
|
|
|
3088
4187
|
${({ $variant }) => $variant === "pill" && rt`
|
|
@@ -3094,17 +4193,29 @@ var PropertyValueBlock = at.div`
|
|
|
3094
4193
|
padding: 0.5rem 1rem;
|
|
3095
4194
|
gap: 1rem;
|
|
3096
4195
|
align-items: center;
|
|
3097
|
-
`}
|
|
3098
4196
|
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
4197
|
+
@media (max-width: 600px) {
|
|
4198
|
+
margin: 0;
|
|
4199
|
+
width: 100%;
|
|
4200
|
+
min-width: 0;
|
|
4201
|
+
flex-direction: column;
|
|
4202
|
+
align-items: flex-end;
|
|
4203
|
+
text-align: right;
|
|
4204
|
+
gap: 0.2rem;
|
|
4205
|
+
padding: 0;
|
|
4206
|
+
background: transparent;
|
|
4207
|
+
border-radius: 0;
|
|
4208
|
+
border: none;
|
|
4209
|
+
white-space: normal;
|
|
4210
|
+
}
|
|
4211
|
+
`}
|
|
3102
4212
|
|
|
3103
4213
|
@media (max-width: 600px) {
|
|
3104
4214
|
margin: 0;
|
|
3105
4215
|
flex-direction: column;
|
|
3106
|
-
align-items: flex-
|
|
3107
|
-
gap: 0.
|
|
4216
|
+
align-items: flex-end;
|
|
4217
|
+
gap: 0.2rem;
|
|
4218
|
+
white-space: normal;
|
|
3108
4219
|
}
|
|
3109
4220
|
`;
|
|
3110
4221
|
var PropertyValueLabel = at.span`
|
|
@@ -3112,18 +4223,59 @@ var PropertyValueLabel = at.span`
|
|
|
3112
4223
|
color: var(--color-text-secondary, rgba(255, 255, 255, 0.6));
|
|
3113
4224
|
text-transform: uppercase;
|
|
3114
4225
|
letter-spacing: 0.5px;
|
|
4226
|
+
|
|
4227
|
+
@media (max-width: 600px) {
|
|
4228
|
+
font-size: 0.6rem;
|
|
4229
|
+
letter-spacing: 0.4px;
|
|
4230
|
+
}
|
|
3115
4231
|
`;
|
|
3116
4232
|
var PropertyValueAmount = at.span`
|
|
3117
4233
|
font-size: 1.1rem;
|
|
3118
4234
|
font-weight: 600;
|
|
3119
4235
|
color: #fff;
|
|
4236
|
+
|
|
4237
|
+
@media (max-width: 600px) {
|
|
4238
|
+
font-size: 0.95rem;
|
|
4239
|
+
}
|
|
3120
4240
|
`;
|
|
3121
4241
|
var PropertyValueChange = at.span`
|
|
3122
4242
|
font-size: 0.75rem;
|
|
3123
4243
|
font-weight: 500;
|
|
3124
4244
|
color: ${(props) => props.$isPositive == null ? "var(--color-text-secondary, rgba(255, 255, 255, 0.6))" : props.$isPositive ? "var(--color-positive, #0ecb81)" : "var(--color-negative, #f6465d)"};
|
|
4245
|
+
|
|
4246
|
+
@media (max-width: 600px) {
|
|
4247
|
+
font-size: 0.65rem;
|
|
4248
|
+
}
|
|
4249
|
+
`;
|
|
4250
|
+
var PriceBlock = at.div`
|
|
4251
|
+
display: none;
|
|
4252
|
+
|
|
4253
|
+
${({ $variant }) => $variant === "pill" && rt`
|
|
4254
|
+
@media (max-width: 600px) {
|
|
4255
|
+
display: flex;
|
|
4256
|
+
flex: none;
|
|
4257
|
+
flex-direction: column;
|
|
4258
|
+
align-items: center;
|
|
4259
|
+
justify-content: center;
|
|
4260
|
+
gap: 0.15rem;
|
|
4261
|
+
width: 100%;
|
|
4262
|
+
}
|
|
4263
|
+
`}
|
|
4264
|
+
`;
|
|
4265
|
+
var PriceAmount = at.span`
|
|
4266
|
+
font-size: 1.6rem;
|
|
4267
|
+
font-weight: 600;
|
|
4268
|
+
color: #fff;
|
|
4269
|
+
letter-spacing: 0.2px;
|
|
4270
|
+
`;
|
|
4271
|
+
var PriceChange = at.span`
|
|
4272
|
+
font-size: 0.85rem;
|
|
4273
|
+
font-weight: 500;
|
|
4274
|
+
display: inline-flex;
|
|
4275
|
+
gap: 0.35rem;
|
|
4276
|
+
color: ${(props) => props.$isPositive == null ? "var(--color-text-secondary, rgba(255, 255, 255, 0.6))" : props.$isPositive ? "var(--color-positive, #0ecb81)" : "var(--color-negative, #f6465d)"};
|
|
3125
4277
|
`;
|
|
3126
|
-
var
|
|
4278
|
+
var DEFAULT_TABS = [
|
|
3127
4279
|
{ id: "portfolio", label: "Portfolio" },
|
|
3128
4280
|
{ id: "openOrders", label: "Open Orders" },
|
|
3129
4281
|
{ id: "tradeHistory", label: "Trade History" },
|
|
@@ -3132,7 +4284,7 @@ var TABS = [
|
|
|
3132
4284
|
var panelStyle = {
|
|
3133
4285
|
width: "100%",
|
|
3134
4286
|
borderRadius: "16px",
|
|
3135
|
-
backgroundColor: "#
|
|
4287
|
+
backgroundColor: "#0b0e10",
|
|
3136
4288
|
border: "1px solid rgba(255,255,255,0.08)",
|
|
3137
4289
|
color: "#ffffff",
|
|
3138
4290
|
display: "flex",
|
|
@@ -3218,12 +4370,29 @@ var formatPercent = (value, fractionDigits = 2) => {
|
|
|
3218
4370
|
return `${value.toFixed(fractionDigits)}%`;
|
|
3219
4371
|
};
|
|
3220
4372
|
var YourOrders = o.forwardRef(
|
|
3221
|
-
({ className, title
|
|
3222
|
-
const [
|
|
3223
|
-
const
|
|
3224
|
-
const
|
|
4373
|
+
({ className, title, orders, tabs, activeTabId, onTabChange, renderOrderActions, ...props }, ref) => {
|
|
4374
|
+
const [internalActiveTab, setInternalActiveTab] = o.useState(tabs?.[0]?.id ?? "portfolio");
|
|
4375
|
+
const effectiveActiveTabId = activeTabId ?? internalActiveTab;
|
|
4376
|
+
const handleTabChange = (tabId) => {
|
|
4377
|
+
if (onTabChange) {
|
|
4378
|
+
onTabChange(tabId);
|
|
4379
|
+
} else {
|
|
4380
|
+
setInternalActiveTab(tabId);
|
|
4381
|
+
}
|
|
4382
|
+
};
|
|
4383
|
+
const resolvedTabs = tabs ?? DEFAULT_TABS.map((t) => ({ ...t, orders: orders ?? [], emptyState: `No ${t.label.toLowerCase()} data available.` }));
|
|
4384
|
+
const activeTab = resolvedTabs.find((t) => t.id === effectiveActiveTabId) ?? resolvedTabs[0];
|
|
4385
|
+
const activeOrders = activeTab?.orders ?? orders ?? [];
|
|
4386
|
+
const displayTitle = title ?? activeTab?.title ?? activeTab?.label ?? "Portfolio Holdings";
|
|
4387
|
+
console.log("[YourOrders] tabs:", tabs?.map((t) => ({ id: t.id, ordersCount: t.orders?.length })));
|
|
4388
|
+
console.log("[YourOrders] activeTabId prop:", activeTabId);
|
|
4389
|
+
console.log("[YourOrders] effectiveActiveTabId:", effectiveActiveTabId);
|
|
4390
|
+
console.log("[YourOrders] activeTab:", activeTab?.id, "orders count:", activeOrders?.length);
|
|
4391
|
+
const hasOrders = Array.isArray(activeOrders) && activeOrders.length > 0;
|
|
4392
|
+
const emptyMessage = activeTab?.emptyState ?? "No holdings yet. Start trading to build your portfolio.";
|
|
4393
|
+
const renderOrders = () => {
|
|
3225
4394
|
if (!hasOrders) {
|
|
3226
|
-
return /* @__PURE__ */ jsx("div", { style: emptyStateStyle, children:
|
|
4395
|
+
return /* @__PURE__ */ jsx("div", { style: emptyStateStyle, children: emptyMessage });
|
|
3227
4396
|
}
|
|
3228
4397
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3229
4398
|
/* @__PURE__ */ jsxs("div", { style: tableHeaderStyle, children: [
|
|
@@ -3234,7 +4403,7 @@ var YourOrders = o.forwardRef(
|
|
|
3234
4403
|
/* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "Avg Price" }),
|
|
3235
4404
|
/* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "P&L" })
|
|
3236
4405
|
] }),
|
|
3237
|
-
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.65rem" }, children:
|
|
4406
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.65rem" }, children: activeOrders.map((order) => {
|
|
3238
4407
|
const propertyName = order.asset;
|
|
3239
4408
|
const holding = order.holdingLabel ?? `${order.amount.toLocaleString(void 0, {
|
|
3240
4409
|
minimumFractionDigits: 0,
|
|
@@ -3327,60 +4496,52 @@ var YourOrders = o.forwardRef(
|
|
|
3327
4496
|
}) })
|
|
3328
4497
|
] });
|
|
3329
4498
|
};
|
|
3330
|
-
const
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
) : null
|
|
3377
|
-
]
|
|
3378
|
-
},
|
|
3379
|
-
tab.id
|
|
3380
|
-
);
|
|
3381
|
-
}) }),
|
|
3382
|
-
/* @__PURE__ */ jsx("div", { style: tabContentWrapper, children: tabContent })
|
|
3383
|
-
] });
|
|
4499
|
+
const tabContent = renderOrders();
|
|
4500
|
+
return /* @__PURE__ */ jsxs(
|
|
4501
|
+
"div",
|
|
4502
|
+
{
|
|
4503
|
+
ref,
|
|
4504
|
+
style: { ...panelStyle, ...props.style ?? {} },
|
|
4505
|
+
className,
|
|
4506
|
+
...props,
|
|
4507
|
+
children: [
|
|
4508
|
+
/* @__PURE__ */ jsx("div", { style: headerStyle, children: /* @__PURE__ */ jsx("h3", { style: titleStyle, children: displayTitle }) }),
|
|
4509
|
+
resolvedTabs.length > 1 && /* @__PURE__ */ jsx("div", { style: tabsRowStyle, children: resolvedTabs.map((tab) => {
|
|
4510
|
+
const isActive = effectiveActiveTabId === tab.id;
|
|
4511
|
+
return /* @__PURE__ */ jsxs(
|
|
4512
|
+
"button",
|
|
4513
|
+
{
|
|
4514
|
+
type: "button",
|
|
4515
|
+
onClick: () => handleTabChange(tab.id),
|
|
4516
|
+
style: {
|
|
4517
|
+
...tabButtonBase,
|
|
4518
|
+
color: isActive ? "#ffffff" : "rgba(255,255,255,0.55)",
|
|
4519
|
+
fontWeight: isActive ? 600 : 400
|
|
4520
|
+
},
|
|
4521
|
+
children: [
|
|
4522
|
+
tab.label,
|
|
4523
|
+
isActive ? /* @__PURE__ */ jsx(
|
|
4524
|
+
"div",
|
|
4525
|
+
{
|
|
4526
|
+
style: {
|
|
4527
|
+
position: "absolute",
|
|
4528
|
+
bottom: "-1px",
|
|
4529
|
+
left: 0,
|
|
4530
|
+
right: 0,
|
|
4531
|
+
height: "2px",
|
|
4532
|
+
background: "#f0b90b"
|
|
4533
|
+
}
|
|
4534
|
+
}
|
|
4535
|
+
) : null
|
|
4536
|
+
]
|
|
4537
|
+
},
|
|
4538
|
+
tab.id
|
|
4539
|
+
);
|
|
4540
|
+
}) }),
|
|
4541
|
+
/* @__PURE__ */ jsx("div", { style: tabContentWrapper, children: tabContent })
|
|
4542
|
+
]
|
|
4543
|
+
}
|
|
4544
|
+
);
|
|
3384
4545
|
}
|
|
3385
4546
|
);
|
|
3386
4547
|
YourOrders.displayName = "YourOrders";
|
|
@@ -3391,6 +4552,17 @@ var formatPrice = (value, currencySymbol) => {
|
|
|
3391
4552
|
maximumFractionDigits: 2
|
|
3392
4553
|
})}`;
|
|
3393
4554
|
};
|
|
4555
|
+
function createCandlestickSeries(chart, options) {
|
|
4556
|
+
const chartWithSeries = chart;
|
|
4557
|
+
if (typeof chartWithSeries.addCandlestickSeries === "function") {
|
|
4558
|
+
return chartWithSeries.addCandlestickSeries(options);
|
|
4559
|
+
}
|
|
4560
|
+
const candlestickCtor = LightweightCharts.CandlestickSeries;
|
|
4561
|
+
if (typeof chartWithSeries.addSeries === "function" && candlestickCtor) {
|
|
4562
|
+
return chartWithSeries.addSeries(candlestickCtor, options);
|
|
4563
|
+
}
|
|
4564
|
+
throw new Error("Candlestick series API is not available in the current lightweight-charts version.");
|
|
4565
|
+
}
|
|
3394
4566
|
var PriceChart = o.forwardRef(
|
|
3395
4567
|
({
|
|
3396
4568
|
className,
|
|
@@ -3422,10 +4594,16 @@ var PriceChart = o.forwardRef(
|
|
|
3422
4594
|
if (first == null || last == null || first === 0) return void 0;
|
|
3423
4595
|
return (last - first) / first * 100;
|
|
3424
4596
|
}, [changePercent, data]);
|
|
4597
|
+
const dollarChange = o.useMemo(() => {
|
|
4598
|
+
const first = data[0]?.open;
|
|
4599
|
+
const last = data.at(-1)?.close;
|
|
4600
|
+
if (first == null || last == null) return void 0;
|
|
4601
|
+
return last - first;
|
|
4602
|
+
}, [data]);
|
|
3425
4603
|
o.useEffect(() => {
|
|
3426
4604
|
const el = containerRef.current;
|
|
3427
4605
|
if (!el) return;
|
|
3428
|
-
const chart = createChart(el, {
|
|
4606
|
+
const chart = LightweightCharts.createChart(el, {
|
|
3429
4607
|
autoSize: true,
|
|
3430
4608
|
layout: {
|
|
3431
4609
|
background: { color: "transparent" },
|
|
@@ -3450,7 +4628,7 @@ var PriceChart = o.forwardRef(
|
|
|
3450
4628
|
horzLine: { color: "rgba(255,255,255,0.12)" }
|
|
3451
4629
|
}
|
|
3452
4630
|
});
|
|
3453
|
-
const series = chart
|
|
4631
|
+
const series = createCandlestickSeries(chart, {
|
|
3454
4632
|
upColor: "#0ecb81",
|
|
3455
4633
|
downColor: "#f6465d",
|
|
3456
4634
|
borderVisible: false,
|
|
@@ -3509,15 +4687,15 @@ var PriceChart = o.forwardRef(
|
|
|
3509
4687
|
{
|
|
3510
4688
|
ref,
|
|
3511
4689
|
className: cn(
|
|
3512
|
-
"w-full min-h-[
|
|
4690
|
+
"w-full min-h-[360px] rounded-lg border border-white/10 bg-black/30 text-white backdrop-blur-md sm:min-h-[450px]",
|
|
3513
4691
|
className
|
|
3514
4692
|
),
|
|
3515
4693
|
...props,
|
|
3516
4694
|
children: [
|
|
3517
|
-
/* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-start justify-between
|
|
3518
|
-
/* @__PURE__ */ jsxs("div", { children: [
|
|
4695
|
+
/* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-col gap-4 px-4 pb-2 pt-5 md:flex-row md:items-start md:justify-between md:px-6 md:pt-6", children: [
|
|
4696
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col gap-3 md:w-auto", children: [
|
|
3519
4697
|
/* @__PURE__ */ jsx(CardTitle, { className: "m-0 text-[1.1rem] font-semibold text-white", children: title }),
|
|
3520
|
-
/* @__PURE__ */ jsx("div", { className: "
|
|
4698
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: ranges.map((r2) => {
|
|
3521
4699
|
const active = r2 === selectedRange;
|
|
3522
4700
|
const hovered = hoveredRange === r2;
|
|
3523
4701
|
const style = {
|
|
@@ -3542,16 +4720,43 @@ var PriceChart = o.forwardRef(
|
|
|
3542
4720
|
);
|
|
3543
4721
|
}) })
|
|
3544
4722
|
] }),
|
|
3545
|
-
/* @__PURE__ */ jsxs("div", {
|
|
3546
|
-
resolvedPrice == null ? null : /* @__PURE__ */ jsx(
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3551
|
-
|
|
4723
|
+
resolvedPrice == null && inferredChangePercent == null ? null : /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
4724
|
+
resolvedPrice == null ? null : /* @__PURE__ */ jsx(
|
|
4725
|
+
"div",
|
|
4726
|
+
{
|
|
4727
|
+
className: cn("text-xl font-semibold tabular-nums", changeClass),
|
|
4728
|
+
style: { marginRight: "1rem" },
|
|
4729
|
+
children: formatPrice(resolvedPrice, currencySymbol)
|
|
4730
|
+
}
|
|
4731
|
+
),
|
|
4732
|
+
dollarChange != null ? /* @__PURE__ */ jsxs(
|
|
4733
|
+
"span",
|
|
4734
|
+
{
|
|
4735
|
+
className: cn("text-base font-medium tabular-nums", changeClass),
|
|
4736
|
+
style: { marginRight: "0.5rem" },
|
|
4737
|
+
children: [
|
|
4738
|
+
dollarChange >= 0 ? "+" : "",
|
|
4739
|
+
dollarChange.toFixed(2)
|
|
4740
|
+
]
|
|
4741
|
+
}
|
|
4742
|
+
) : null,
|
|
4743
|
+
inferredChangePercent == null ? null : /* @__PURE__ */ jsxs(
|
|
4744
|
+
"div",
|
|
4745
|
+
{
|
|
4746
|
+
className: cn(
|
|
4747
|
+
"rounded-md px-2 py-1 text-xs font-semibold tabular-nums",
|
|
4748
|
+
badgeClass
|
|
4749
|
+
),
|
|
4750
|
+
children: [
|
|
4751
|
+
sign,
|
|
4752
|
+
inferredChangePercent?.toFixed(2),
|
|
4753
|
+
"%"
|
|
4754
|
+
]
|
|
4755
|
+
}
|
|
4756
|
+
)
|
|
3552
4757
|
] })
|
|
3553
4758
|
] }),
|
|
3554
|
-
/* @__PURE__ */ jsx("div", { className: "px-
|
|
4759
|
+
/* @__PURE__ */ jsx("div", { className: "px-4 pb-5 pt-2 md:px-6 md:pb-6", children: /* @__PURE__ */ jsx(
|
|
3555
4760
|
"div",
|
|
3556
4761
|
{
|
|
3557
4762
|
ref: containerRef,
|
|
@@ -3594,195 +4799,369 @@ var PropertyHeroHeader = o.forwardRef(
|
|
|
3594
4799
|
const tradeHoverColor = "#f5dd9a";
|
|
3595
4800
|
const [isTradeInteracting, setIsTradeInteracting] = o.useState(false);
|
|
3596
4801
|
const [isOfferInteracting, setIsOfferInteracting] = o.useState(false);
|
|
4802
|
+
const hasAmenities = beds != null || baths != null || cars != null || propertyTypeLabel != null;
|
|
3597
4803
|
const headingStyle = {
|
|
3598
|
-
fontSize: "2.5rem",
|
|
4804
|
+
fontSize: "clamp(1.6rem, 4vw, 2.5rem)",
|
|
3599
4805
|
marginBottom: "0.5rem",
|
|
3600
4806
|
color: "#ffffff",
|
|
3601
4807
|
textShadow: "0 2px 4px rgba(0, 0, 0, 0.3)",
|
|
3602
4808
|
fontWeight: 600,
|
|
3603
4809
|
lineHeight: 1.2
|
|
3604
4810
|
};
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
alignItems: "center"
|
|
3614
|
-
};
|
|
3615
|
-
const locationStyle = {
|
|
3616
|
-
fontSize: "1.25rem",
|
|
3617
|
-
color: "rgba(255, 255, 255, 0.9)",
|
|
3618
|
-
marginBottom: "0.75rem",
|
|
3619
|
-
display: "flex",
|
|
3620
|
-
alignItems: "center"
|
|
3621
|
-
};
|
|
3622
|
-
return /* @__PURE__ */ jsxs(
|
|
3623
|
-
"div",
|
|
3624
|
-
{
|
|
3625
|
-
ref,
|
|
3626
|
-
className: cn(
|
|
3627
|
-
"relative w-[1200px] h-[500px] overflow-hidden bg-black rounded-[12px]",
|
|
3628
|
-
className
|
|
4811
|
+
return /* @__PURE__ */ jsxs(OuterWrapper, { ref, className: cn(className), ...props, children: [
|
|
4812
|
+
/* @__PURE__ */ jsxs(HeroContainer, { children: [
|
|
4813
|
+
/* @__PURE__ */ jsx(
|
|
4814
|
+
HeroImage,
|
|
4815
|
+
{
|
|
4816
|
+
src: imageUrl,
|
|
4817
|
+
alt: imageAlt ?? name
|
|
4818
|
+
}
|
|
3629
4819
|
),
|
|
3630
|
-
|
|
3631
|
-
children: [
|
|
3632
|
-
/* @__PURE__ */
|
|
3633
|
-
"
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
4820
|
+
/* @__PURE__ */ jsx(HeroGradient, { "aria-hidden": "true" }),
|
|
4821
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute bottom-0 left-0 right-0 z-10 flex w-full flex-wrap items-end justify-between gap-4 p-8 max-[768px]:gap-4 max-[640px]:gap-3 max-[768px]:p-6 max-[480px]:p-4", children: [
|
|
4822
|
+
/* @__PURE__ */ jsxs(InfoCard, { children: [
|
|
4823
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 space-y-2", children: [
|
|
4824
|
+
/* @__PURE__ */ jsx("h1", { style: headingStyle, className: "break-words", children: name }),
|
|
4825
|
+
/* @__PURE__ */ jsxs(InfoRow, { className: "mb-3 max-[768px]:mb-[0.6rem] max-[480px]:mb-[0.5rem]", children: [
|
|
4826
|
+
/* @__PURE__ */ jsx(LocationText, { children: location }),
|
|
4827
|
+
price == null ? null : /* @__PURE__ */ jsxs(PriceBlock2, { children: [
|
|
4828
|
+
formatPrice2(price, currencySymbol),
|
|
4829
|
+
changePercent == null ? null : /* @__PURE__ */ jsxs(
|
|
4830
|
+
"span",
|
|
4831
|
+
{
|
|
4832
|
+
className: cn(
|
|
4833
|
+
"ml-2 flex items-center text-[0.875rem] font-medium",
|
|
4834
|
+
isPositive ? "text-[#0ecb81]" : "text-[#f6465d]"
|
|
4835
|
+
),
|
|
4836
|
+
children: [
|
|
4837
|
+
/* @__PURE__ */ jsx(
|
|
4838
|
+
"svg",
|
|
4839
|
+
{
|
|
4840
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4841
|
+
width: "12",
|
|
4842
|
+
height: "12",
|
|
4843
|
+
viewBox: "0 0 24 24",
|
|
4844
|
+
fill: "currentColor",
|
|
4845
|
+
className: "mr-[0.15rem]",
|
|
4846
|
+
children: /* @__PURE__ */ jsx("path", { d: isPositive ? "M7 14l5-5 5 5H7z" : "M7 10l5 5 5-5H7z" })
|
|
4847
|
+
}
|
|
3655
4848
|
),
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
width: "12",
|
|
3662
|
-
height: "12",
|
|
3663
|
-
viewBox: "0 0 24 24",
|
|
3664
|
-
fill: "currentColor",
|
|
3665
|
-
className: "mr-[0.15rem]",
|
|
3666
|
-
children: /* @__PURE__ */ jsx("path", { d: isPositive ? "M7 14l5-5 5 5H7z" : "M7 10l5 5 5-5H7z" })
|
|
3667
|
-
}
|
|
3668
|
-
),
|
|
3669
|
-
Math.abs(changePercent).toFixed(2),
|
|
3670
|
-
"%"
|
|
3671
|
-
]
|
|
3672
|
-
}
|
|
3673
|
-
)
|
|
3674
|
-
] })
|
|
4849
|
+
Math.abs(changePercent).toFixed(2),
|
|
4850
|
+
"%"
|
|
4851
|
+
]
|
|
4852
|
+
}
|
|
4853
|
+
)
|
|
3675
4854
|
] })
|
|
3676
|
-
] }),
|
|
3677
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6 text-[0.95rem] text-white/90 max-[768px]:hidden", children: [
|
|
3678
|
-
beds == null ? null : /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
3679
|
-
/* @__PURE__ */ jsx(BedDouble, { className: "mr-2 h-[18px] w-[18px]" }),
|
|
3680
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
3681
|
-
beds,
|
|
3682
|
-
" Beds"
|
|
3683
|
-
] })
|
|
3684
|
-
] }),
|
|
3685
|
-
baths == null ? null : /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
3686
|
-
/* @__PURE__ */ jsx(Bath, { className: "mr-2 h-[18px] w-[18px]" }),
|
|
3687
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
3688
|
-
baths,
|
|
3689
|
-
" Baths"
|
|
3690
|
-
] })
|
|
3691
|
-
] }),
|
|
3692
|
-
cars == null ? null : /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
3693
|
-
/* @__PURE__ */ jsx(CarFront, { className: "mr-2 h-[18px] w-[18px]" }),
|
|
3694
|
-
/* @__PURE__ */ jsxs("span", { children: [
|
|
3695
|
-
cars,
|
|
3696
|
-
" Cars"
|
|
3697
|
-
] })
|
|
3698
|
-
] }),
|
|
3699
|
-
propertyTypeLabel == null ? null : /* @__PURE__ */ jsx("div", { children: propertyTypeLabel })
|
|
3700
4855
|
] })
|
|
3701
4856
|
] }),
|
|
3702
|
-
/* @__PURE__ */ jsxs("div", { className: "flex
|
|
3703
|
-
/* @__PURE__ */
|
|
3704
|
-
"
|
|
3705
|
-
{
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
onTouchEnd: () => setIsTradeInteracting(false),
|
|
3726
|
-
children: "Trade"
|
|
3727
|
-
}
|
|
3728
|
-
),
|
|
3729
|
-
/* @__PURE__ */ jsx(
|
|
3730
|
-
"button",
|
|
3731
|
-
{
|
|
3732
|
-
type: "button",
|
|
3733
|
-
onClick: onMakeOffer,
|
|
3734
|
-
className: "flex items-center justify-center rounded border font-semibold transition-all duration-200 hover:-translate-y-0.5 hover:shadow-[0_4px_8px_rgba(0,0,0,0.2)] active:translate-y-0 active:shadow-[0_2px_4px_rgba(0,0,0,0.1)] text-[0.95rem] max-[480px]:text-[0.9rem]",
|
|
3735
|
-
style: {
|
|
3736
|
-
backgroundColor: isOfferInteracting ? accentColor : "transparent",
|
|
3737
|
-
borderColor: accentColor,
|
|
3738
|
-
color: isOfferInteracting ? "black" : accentColor,
|
|
3739
|
-
width: "127.14px",
|
|
3740
|
-
height: "43px",
|
|
3741
|
-
minWidth: "127.14px",
|
|
3742
|
-
boxShadow: isOfferInteracting ? `0 0 0 2px rgba(0,0,0,0.4), 0 0 0 4px ${accentColor}` : "none"
|
|
3743
|
-
},
|
|
3744
|
-
onMouseEnter: () => setIsOfferInteracting(true),
|
|
3745
|
-
onMouseLeave: () => setIsOfferInteracting(false),
|
|
3746
|
-
onMouseDown: () => setIsOfferInteracting(true),
|
|
3747
|
-
onMouseUp: () => setIsOfferInteracting(false),
|
|
3748
|
-
onFocus: () => setIsOfferInteracting(true),
|
|
3749
|
-
onBlur: () => setIsOfferInteracting(false),
|
|
3750
|
-
onTouchStart: () => setIsOfferInteracting(true),
|
|
3751
|
-
onTouchEnd: () => setIsOfferInteracting(false),
|
|
3752
|
-
children: "Make Offer"
|
|
3753
|
-
}
|
|
3754
|
-
)
|
|
4857
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6 text-[0.95rem] text-white/90 max-[768px]:hidden", children: [
|
|
4858
|
+
beds == null ? null : /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
4859
|
+
/* @__PURE__ */ jsx(BedDouble, { className: "mr-2 h-[18px] w-[18px]" }),
|
|
4860
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
4861
|
+
beds,
|
|
4862
|
+
" Beds"
|
|
4863
|
+
] })
|
|
4864
|
+
] }),
|
|
4865
|
+
baths == null ? null : /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
4866
|
+
/* @__PURE__ */ jsx(Bath, { className: "mr-2 h-[18px] w-[18px]" }),
|
|
4867
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
4868
|
+
baths,
|
|
4869
|
+
" Baths"
|
|
4870
|
+
] })
|
|
4871
|
+
] }),
|
|
4872
|
+
cars == null ? null : /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
|
|
4873
|
+
/* @__PURE__ */ jsx(CarFront, { className: "mr-2 h-[18px] w-[18px]" }),
|
|
4874
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
4875
|
+
cars,
|
|
4876
|
+
" Cars"
|
|
4877
|
+
] })
|
|
4878
|
+
] }),
|
|
4879
|
+
propertyTypeLabel == null ? null : /* @__PURE__ */ jsx("div", { children: propertyTypeLabel })
|
|
3755
4880
|
] })
|
|
4881
|
+
] }),
|
|
4882
|
+
/* @__PURE__ */ jsxs(ActionButtons, { children: [
|
|
4883
|
+
/* @__PURE__ */ jsx(
|
|
4884
|
+
"button",
|
|
4885
|
+
{
|
|
4886
|
+
type: "button",
|
|
4887
|
+
onClick: onTrade,
|
|
4888
|
+
className: "flex items-center justify-center rounded border font-semibold transition-all duration-200 hover:-translate-y-0.5 hover:shadow-[0_4px_8px_rgba(0,0,0,0.2)] active:translate-y-0 active:shadow-[0_2px_4px_rgba(0,0,0,0.1)] text-[0.95rem] max-[480px]:text-[0.9rem]",
|
|
4889
|
+
style: {
|
|
4890
|
+
backgroundColor: isTradeInteracting ? tradeHoverColor : accentColor,
|
|
4891
|
+
color: "black",
|
|
4892
|
+
width: "88.06px",
|
|
4893
|
+
height: "43px",
|
|
4894
|
+
minWidth: "88.06px",
|
|
4895
|
+
borderColor: isTradeInteracting ? accentColor : "transparent",
|
|
4896
|
+
boxShadow: isTradeInteracting ? `0 0 0 2px rgba(0,0,0,0.4), 0 0 0 4px ${accentColor}` : "none"
|
|
4897
|
+
},
|
|
4898
|
+
onMouseEnter: () => setIsTradeInteracting(true),
|
|
4899
|
+
onMouseLeave: () => setIsTradeInteracting(false),
|
|
4900
|
+
onMouseDown: () => setIsTradeInteracting(true),
|
|
4901
|
+
onMouseUp: () => setIsTradeInteracting(false),
|
|
4902
|
+
onFocus: () => setIsTradeInteracting(true),
|
|
4903
|
+
onBlur: () => setIsTradeInteracting(false),
|
|
4904
|
+
onTouchStart: () => setIsTradeInteracting(true),
|
|
4905
|
+
onTouchEnd: () => setIsTradeInteracting(false),
|
|
4906
|
+
children: "Trade"
|
|
4907
|
+
}
|
|
4908
|
+
),
|
|
4909
|
+
/* @__PURE__ */ jsx(
|
|
4910
|
+
"button",
|
|
4911
|
+
{
|
|
4912
|
+
type: "button",
|
|
4913
|
+
onClick: onMakeOffer,
|
|
4914
|
+
className: "flex items-center justify-center rounded border font-semibold transition-all duration-200 hover:-translate-y-0.5 hover:shadow-[0_4px_8px_rgba(0,0,0,0.2)] active:translate-y-0 active:shadow-[0_2px_4px_rgba(0,0,0,0.1)] text-[0.95rem] max-[480px]:text-[0.9rem]",
|
|
4915
|
+
style: {
|
|
4916
|
+
backgroundColor: isOfferInteracting ? accentColor : "transparent",
|
|
4917
|
+
borderColor: accentColor,
|
|
4918
|
+
color: isOfferInteracting ? "black" : accentColor,
|
|
4919
|
+
width: "127.14px",
|
|
4920
|
+
height: "43px",
|
|
4921
|
+
minWidth: "127.14px",
|
|
4922
|
+
boxShadow: isOfferInteracting ? `0 0 0 2px rgba(0,0,0,0.4), 0 0 0 4px ${accentColor}` : "none"
|
|
4923
|
+
},
|
|
4924
|
+
onMouseEnter: () => setIsOfferInteracting(true),
|
|
4925
|
+
onMouseLeave: () => setIsOfferInteracting(false),
|
|
4926
|
+
onMouseDown: () => setIsOfferInteracting(true),
|
|
4927
|
+
onMouseUp: () => setIsOfferInteracting(false),
|
|
4928
|
+
onFocus: () => setIsOfferInteracting(true),
|
|
4929
|
+
onBlur: () => setIsOfferInteracting(false),
|
|
4930
|
+
onTouchStart: () => setIsOfferInteracting(true),
|
|
4931
|
+
onTouchEnd: () => setIsOfferInteracting(false),
|
|
4932
|
+
children: "Make Offer"
|
|
4933
|
+
}
|
|
4934
|
+
)
|
|
3756
4935
|
] })
|
|
3757
|
-
]
|
|
3758
|
-
}
|
|
3759
|
-
|
|
4936
|
+
] })
|
|
4937
|
+
] }),
|
|
4938
|
+
hasAmenities ? /* @__PURE__ */ jsxs(MobileAmenities, { children: [
|
|
4939
|
+
beds == null ? null : /* @__PURE__ */ jsxs(MobileAmenity, { children: [
|
|
4940
|
+
/* @__PURE__ */ jsx(BedDouble, { className: "h-4 w-4" }),
|
|
4941
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
4942
|
+
beds,
|
|
4943
|
+
" Beds"
|
|
4944
|
+
] })
|
|
4945
|
+
] }),
|
|
4946
|
+
baths == null ? null : /* @__PURE__ */ jsxs(MobileAmenity, { children: [
|
|
4947
|
+
/* @__PURE__ */ jsx(Bath, { className: "h-4 w-4" }),
|
|
4948
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
4949
|
+
baths,
|
|
4950
|
+
" Baths"
|
|
4951
|
+
] })
|
|
4952
|
+
] }),
|
|
4953
|
+
cars == null ? null : /* @__PURE__ */ jsxs(MobileAmenity, { children: [
|
|
4954
|
+
/* @__PURE__ */ jsx(CarFront, { className: "h-4 w-4" }),
|
|
4955
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
4956
|
+
cars,
|
|
4957
|
+
" Cars"
|
|
4958
|
+
] })
|
|
4959
|
+
] }),
|
|
4960
|
+
propertyTypeLabel == null ? null : /* @__PURE__ */ jsx(MobileAmenity, { children: propertyTypeLabel })
|
|
4961
|
+
] }) : null
|
|
4962
|
+
] });
|
|
3760
4963
|
}
|
|
3761
4964
|
);
|
|
3762
4965
|
PropertyHeroHeader.displayName = "PropertyHeroHeader";
|
|
4966
|
+
var OuterWrapper = at.div`
|
|
4967
|
+
width: 100%;
|
|
4968
|
+
max-width: 1200px;
|
|
4969
|
+
margin: 0 auto;
|
|
4970
|
+
display: flex;
|
|
4971
|
+
flex-direction: column;
|
|
4972
|
+
gap: 0.5rem;
|
|
4973
|
+
`;
|
|
4974
|
+
var HeroContainer = at.div`
|
|
4975
|
+
position: relative;
|
|
4976
|
+
width: 100%;
|
|
4977
|
+
height: 500px;
|
|
4978
|
+
border-radius: 12px;
|
|
4979
|
+
overflow: hidden;
|
|
4980
|
+
background-color: #000;
|
|
4981
|
+
|
|
4982
|
+
@media (max-width: 1024px) {
|
|
4983
|
+
height: 420px;
|
|
4984
|
+
}
|
|
4985
|
+
|
|
4986
|
+
@media (max-width: 768px) {
|
|
4987
|
+
height: 320px;
|
|
4988
|
+
}
|
|
4989
|
+
|
|
4990
|
+
@media (max-width: 640px) {
|
|
4991
|
+
height: 280px;
|
|
4992
|
+
}
|
|
4993
|
+
|
|
4994
|
+
@media (max-width: 540px) {
|
|
4995
|
+
height: 250px;
|
|
4996
|
+
}
|
|
4997
|
+
|
|
4998
|
+
@media (max-width: 420px) {
|
|
4999
|
+
height: 220px;
|
|
5000
|
+
}
|
|
5001
|
+
|
|
5002
|
+
@media (max-width: 360px) {
|
|
5003
|
+
height: 200px;
|
|
5004
|
+
}
|
|
5005
|
+
`;
|
|
5006
|
+
var MobileAmenities = at.div`
|
|
5007
|
+
display: none;
|
|
5008
|
+
align-items: center;
|
|
5009
|
+
justify-content: space-between;
|
|
5010
|
+
gap: 0.5rem;
|
|
5011
|
+
padding: 0.5rem 0.75rem;
|
|
5012
|
+
background: rgba(8, 8, 12, 0.85);
|
|
5013
|
+
border-radius: 12px;
|
|
5014
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
5015
|
+
color: rgba(255, 255, 255, 0.85);
|
|
5016
|
+
font-size: 0.85rem;
|
|
5017
|
+
|
|
5018
|
+
@media (max-width: 768px) {
|
|
5019
|
+
display: flex;
|
|
5020
|
+
flex-wrap: wrap;
|
|
5021
|
+
}
|
|
5022
|
+
`;
|
|
5023
|
+
var MobileAmenity = at.span`
|
|
5024
|
+
display: inline-flex;
|
|
5025
|
+
align-items: center;
|
|
5026
|
+
gap: 0.35rem;
|
|
5027
|
+
padding: 0.35rem 0.5rem;
|
|
5028
|
+
border-radius: 999px;
|
|
5029
|
+
background: rgba(255, 255, 255, 0.08);
|
|
5030
|
+
font-weight: 500;
|
|
5031
|
+
`;
|
|
5032
|
+
var HeroImage = at.img`
|
|
5033
|
+
position: absolute;
|
|
5034
|
+
inset: 0;
|
|
5035
|
+
width: 100%;
|
|
5036
|
+
height: 100%;
|
|
5037
|
+
object-fit: cover;
|
|
5038
|
+
object-position: center;
|
|
5039
|
+
transform: scale(1.15);
|
|
5040
|
+
transform-origin: center;
|
|
5041
|
+
min-width: 110%;
|
|
5042
|
+
transition: transform 0.5s ease-out;
|
|
5043
|
+
`;
|
|
5044
|
+
var HeroGradient = at.div`
|
|
5045
|
+
position: absolute;
|
|
5046
|
+
inset: 0;
|
|
5047
|
+
z-index: 1;
|
|
5048
|
+
background: linear-gradient(180deg, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.25) 45%, rgba(0, 0, 0, 0.75) 100%);
|
|
5049
|
+
`;
|
|
5050
|
+
var ActionButtons = at.div`
|
|
5051
|
+
display: flex;
|
|
5052
|
+
flex-wrap: wrap;
|
|
5053
|
+
align-items: center;
|
|
5054
|
+
gap: 0.75rem;
|
|
5055
|
+
justify-content: flex-start;
|
|
5056
|
+
|
|
5057
|
+
@media (max-width: 768px) {
|
|
5058
|
+
gap: 0.5rem;
|
|
5059
|
+
}
|
|
5060
|
+
|
|
5061
|
+
@media (max-width: 640px) {
|
|
5062
|
+
display: none;
|
|
5063
|
+
}
|
|
5064
|
+
`;
|
|
5065
|
+
var InfoCard = at.div`
|
|
5066
|
+
display: inline-block;
|
|
5067
|
+
width: fit-content;
|
|
5068
|
+
max-width: 70%;
|
|
5069
|
+
border-radius: 12px;
|
|
5070
|
+
background: rgba(0, 0, 0, 0.12);
|
|
5071
|
+
padding: 0.75rem 1rem;
|
|
5072
|
+
color: #fff;
|
|
5073
|
+
backdrop-filter: blur(6px);
|
|
5074
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
|
|
5075
|
+
border: 1px solid rgba(255, 255, 255, 0.12);
|
|
5076
|
+
min-width: 0;
|
|
5077
|
+
|
|
5078
|
+
@media (max-width: 768px) {
|
|
5079
|
+
max-width: 85%;
|
|
5080
|
+
}
|
|
5081
|
+
|
|
5082
|
+
@media (max-width: 640px) {
|
|
5083
|
+
max-width: 92%;
|
|
5084
|
+
}
|
|
5085
|
+
|
|
5086
|
+
@media (max-width: 480px) {
|
|
5087
|
+
max-width: 95%;
|
|
5088
|
+
}
|
|
5089
|
+
`;
|
|
5090
|
+
var InfoRow = at.div`
|
|
5091
|
+
display: grid;
|
|
5092
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
5093
|
+
align-items: center;
|
|
5094
|
+
gap: 0.75rem;
|
|
5095
|
+
width: 100%;
|
|
5096
|
+
|
|
5097
|
+
@media (max-width: 640px) {
|
|
5098
|
+
gap: 0.5rem;
|
|
5099
|
+
}
|
|
5100
|
+
`;
|
|
5101
|
+
var LocationText = at.span`
|
|
5102
|
+
font-size: clamp(1rem, 2.6vw, 1.25rem);
|
|
5103
|
+
color: rgba(255, 255, 255, 0.9);
|
|
5104
|
+
font-weight: 500;
|
|
5105
|
+
overflow: hidden;
|
|
5106
|
+
text-overflow: ellipsis;
|
|
5107
|
+
white-space: nowrap;
|
|
5108
|
+
`;
|
|
5109
|
+
var PriceBlock2 = at.span`
|
|
5110
|
+
display: flex;
|
|
5111
|
+
align-items: center;
|
|
5112
|
+
font-size: clamp(1rem, 2.2vw, 1.25rem);
|
|
5113
|
+
font-weight: 600;
|
|
5114
|
+
color: var(--color-accent, #f0b90b);
|
|
5115
|
+
padding-left: 1rem;
|
|
5116
|
+
border-left: 1px solid rgba(255, 255, 255, 0.25);
|
|
5117
|
+
min-height: 1.5rem;
|
|
5118
|
+
`;
|
|
3763
5119
|
var PropertySubheader = o.forwardRef(
|
|
3764
5120
|
({ className, tabs, activeTabId, onTabChange, actions, ...props }, ref) => {
|
|
5121
|
+
const tabsContainerRef = o.useRef(null);
|
|
5122
|
+
o.useEffect(() => {
|
|
5123
|
+
const container = tabsContainerRef.current;
|
|
5124
|
+
if (!container) return;
|
|
5125
|
+
const isMobile = window.innerWidth <= 768;
|
|
5126
|
+
if (!isMobile) return;
|
|
5127
|
+
const forceScrollbar = () => {
|
|
5128
|
+
if (container.scrollWidth > container.clientWidth) {
|
|
5129
|
+
container.scrollTop = 1;
|
|
5130
|
+
container.scrollTop = 0;
|
|
5131
|
+
container.scrollLeft = 1;
|
|
5132
|
+
container.scrollLeft = 0;
|
|
5133
|
+
}
|
|
5134
|
+
};
|
|
5135
|
+
setTimeout(forceScrollbar, 100);
|
|
5136
|
+
window.addEventListener("resize", forceScrollbar);
|
|
5137
|
+
return () => window.removeEventListener("resize", forceScrollbar);
|
|
5138
|
+
}, [tabs]);
|
|
3765
5139
|
return /* @__PURE__ */ jsxs(
|
|
3766
5140
|
"div",
|
|
3767
5141
|
{
|
|
3768
5142
|
ref,
|
|
3769
|
-
className: cn(
|
|
5143
|
+
className: cn(
|
|
5144
|
+
"w-full font-normal",
|
|
5145
|
+
"flex flex-col-reverse gap-3",
|
|
5146
|
+
"md:flex-row md:items-center md:justify-between",
|
|
5147
|
+
className
|
|
5148
|
+
),
|
|
3770
5149
|
...props,
|
|
3771
5150
|
children: [
|
|
3772
5151
|
/* @__PURE__ */ jsx(
|
|
3773
5152
|
"div",
|
|
3774
5153
|
{
|
|
5154
|
+
ref: tabsContainerRef,
|
|
3775
5155
|
className: cn(
|
|
3776
5156
|
"flex items-center border-b border-white/10",
|
|
3777
5157
|
"overflow-x-auto md:overflow-visible",
|
|
3778
5158
|
"[-webkit-overflow-scrolling:touch]",
|
|
3779
|
-
"[scrollbar-width:none]",
|
|
3780
5159
|
"[scroll-behavior:smooth]",
|
|
3781
5160
|
"[touch-action:pan-x]",
|
|
3782
5161
|
"md:border-b-0"
|
|
3783
5162
|
),
|
|
3784
5163
|
style: { WebkitTapHighlightColor: "transparent" },
|
|
3785
|
-
children: /* @__PURE__ */ jsx("div", { className: "flex min-w-max
|
|
5164
|
+
children: /* @__PURE__ */ jsx("div", { className: "flex min-w-max", children: tabs.map((tab) => {
|
|
3786
5165
|
const active = tab.id === activeTabId;
|
|
3787
5166
|
return /* @__PURE__ */ jsxs(
|
|
3788
5167
|
"button",
|
|
@@ -3791,13 +5170,12 @@ var PropertySubheader = o.forwardRef(
|
|
|
3791
5170
|
onClick: () => onTabChange?.(tab.id),
|
|
3792
5171
|
className: cn(
|
|
3793
5172
|
"relative whitespace-nowrap",
|
|
3794
|
-
"px-
|
|
3795
|
-
"
|
|
3796
|
-
"font-medium",
|
|
5173
|
+
"px-6 py-4",
|
|
5174
|
+
"font-normal",
|
|
3797
5175
|
"transition-colors",
|
|
3798
5176
|
"max-[768px]:px-[1.2rem] max-[768px]:py-[0.8rem]",
|
|
3799
|
-
"max-[480px]:px-4 max-[480px]:py-[0.7rem]",
|
|
3800
|
-
active ? "font-semibold text-[var(--color-accent,#e6c87e)]
|
|
5177
|
+
"max-[480px]:px-4 max-[480px]:py-[0.7rem] max-[480px]:text-[0.9rem]",
|
|
5178
|
+
active ? "font-semibold text-[var(--color-accent,#e6c87e)]" : "text-white/60 hover:text-white"
|
|
3801
5179
|
),
|
|
3802
5180
|
style: {
|
|
3803
5181
|
borderBottom: active ? "2px solid var(--color-accent, #e6c87e)" : "2px solid transparent",
|
|
@@ -3840,10 +5218,10 @@ var PropertySubheader = o.forwardRef(
|
|
|
3840
5218
|
onClick: action.onClick,
|
|
3841
5219
|
className: cn(
|
|
3842
5220
|
"flex shrink-0 items-center gap-[5px] whitespace-nowrap",
|
|
3843
|
-
"rounded
|
|
3844
|
-
"border border-white/
|
|
5221
|
+
"rounded",
|
|
5222
|
+
"border border-white/10",
|
|
3845
5223
|
"bg-transparent",
|
|
3846
|
-
"px-3
|
|
5224
|
+
"px-3 py-1.5 text-[14px] font-normal",
|
|
3847
5225
|
"transition-all",
|
|
3848
5226
|
"max-[768px]:px-2.5 max-[768px]:py-[5px] max-[768px]:text-[13px]",
|
|
3849
5227
|
"hover:bg-white/5 hover:border-[var(--color-accent,#e6c87e)] hover:text-[var(--color-accent,#e6c87e)]"
|
|
@@ -3863,7 +5241,66 @@ var PropertySubheader = o.forwardRef(
|
|
|
3863
5241
|
}
|
|
3864
5242
|
);
|
|
3865
5243
|
PropertySubheader.displayName = "PropertySubheader";
|
|
5244
|
+
var MobileToggleContainer = at.div`
|
|
5245
|
+
display: none;
|
|
5246
|
+
|
|
5247
|
+
@media (max-width: 1024px) {
|
|
5248
|
+
display: flex;
|
|
5249
|
+
gap: 0.5rem;
|
|
5250
|
+
position: fixed;
|
|
5251
|
+
bottom: 0;
|
|
5252
|
+
left: 0;
|
|
5253
|
+
right: 0;
|
|
5254
|
+
background-color: var(--color-card-darker, #111);
|
|
5255
|
+
padding: 0.75rem 1rem;
|
|
5256
|
+
padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
|
|
5257
|
+
border-top: 1px solid var(--color-border);
|
|
5258
|
+
z-index: 100;
|
|
5259
|
+
box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
|
|
5260
|
+
}
|
|
5261
|
+
`;
|
|
5262
|
+
var MobileToggleButton = at.button`
|
|
5263
|
+
flex: 1;
|
|
5264
|
+
padding: 0.75rem;
|
|
5265
|
+
background-color: ${(props) => props.active ? "var(--color-accent)" : "transparent"};
|
|
5266
|
+
color: ${(props) => props.active ? "#000" : "var(--color-text-secondary)"};
|
|
5267
|
+
border: ${(props) => props.active ? "1px solid var(--color-accent)" : "1px solid rgba(255, 255, 255, 0.2)"};
|
|
5268
|
+
border-radius: 6px;
|
|
5269
|
+
font-size: 0.9rem;
|
|
5270
|
+
font-weight: 600;
|
|
5271
|
+
cursor: pointer;
|
|
5272
|
+
transition: all 0.2s ease;
|
|
5273
|
+
white-space: nowrap;
|
|
5274
|
+
|
|
5275
|
+
&:hover {
|
|
5276
|
+
background-color: ${(props) => props.active ? "var(--color-accent-hover)" : "rgba(255, 255, 255, 0.05)"};
|
|
5277
|
+
border-color: ${(props) => props.active ? "var(--color-accent)" : "rgba(255, 255, 255, 0.3)"};
|
|
5278
|
+
}
|
|
5279
|
+
|
|
5280
|
+
@media (max-width: 480px) {
|
|
5281
|
+
font-size: 0.85rem;
|
|
5282
|
+
padding: 0.6rem 0.5rem;
|
|
5283
|
+
}
|
|
5284
|
+
`;
|
|
5285
|
+
var MobileTradeNav = o.forwardRef(
|
|
5286
|
+
({ className, items, activeId, onChange, ...props }, ref) => {
|
|
5287
|
+
return /* @__PURE__ */ jsx(MobileToggleContainer, { ref, className: cn(className), ...props, children: items.map((item) => /* @__PURE__ */ jsxs(
|
|
5288
|
+
MobileToggleButton,
|
|
5289
|
+
{
|
|
5290
|
+
type: "button",
|
|
5291
|
+
active: item.id === activeId,
|
|
5292
|
+
onClick: () => onChange?.(item.id),
|
|
5293
|
+
children: [
|
|
5294
|
+
item.icon,
|
|
5295
|
+
item.label
|
|
5296
|
+
]
|
|
5297
|
+
},
|
|
5298
|
+
item.id
|
|
5299
|
+
)) });
|
|
5300
|
+
}
|
|
5301
|
+
);
|
|
5302
|
+
MobileTradeNav.displayName = "MobileTradeNav";
|
|
3866
5303
|
|
|
3867
|
-
export { Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, HousePositionSlider, LoafLiquidityBadge, Orderbook, PortfolioSummary, PriceChart, PropertyCompareBar, PropertyHeroHeader, PropertyNewsUpdates, PropertySubheader, PropertyTour, YourOrders, badgeVariants, buttonVariants };
|
|
5304
|
+
export { Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, HousePositionSlider, HousePositionSliderMobile, LoafLiquidityBadge, MobileTradeNav, Orderbook, PortfolioSummary, PriceChart, PropertyCompareBar, PropertyHeroHeader, PropertyNewsUpdates, PropertySubheader, PropertyTour, YourOrders, badgeVariants, buttonVariants };
|
|
3868
5305
|
//# sourceMappingURL=index.mjs.map
|
|
3869
5306
|
//# sourceMappingURL=index.mjs.map
|