@kodiak-finance/orderly-ui-scaffold 2.8.19-rc.0 → 2.8.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +9 -792
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -794
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -10
package/dist/index.js
CHANGED
|
@@ -12,9 +12,9 @@ var orderlyUiConnector = require('@kodiak-finance/orderly-ui-connector');
|
|
|
12
12
|
var orderlyUtils = require('@kodiak-finance/orderly-utils');
|
|
13
13
|
var jsQR = require('jsqr');
|
|
14
14
|
var qr = require('@akamfoad/qr');
|
|
15
|
-
var
|
|
15
|
+
var orderlyUiNotification = require('@kodiak-finance/orderly-ui-notification');
|
|
16
16
|
var dateFns = require('date-fns');
|
|
17
|
-
var
|
|
17
|
+
var utc = require('@date-fns/utc');
|
|
18
18
|
|
|
19
19
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
20
|
|
|
@@ -3644,790 +3644,7 @@ var ScaffoldContext = React6.createContext(
|
|
|
3644
3644
|
var useScaffoldContext = () => {
|
|
3645
3645
|
return React6.useContext(ScaffoldContext);
|
|
3646
3646
|
};
|
|
3647
|
-
var BattleIcon = (props) => {
|
|
3648
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Icon, { size: 18, viewBox: "0 0 18 18", ...props, children: [
|
|
3649
|
-
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3650
|
-
"linearGradient",
|
|
3651
|
-
{
|
|
3652
|
-
id: "paint0_linear_555_7374",
|
|
3653
|
-
x1: "17.0157",
|
|
3654
|
-
y1: "9.26513",
|
|
3655
|
-
x2: "0.969849",
|
|
3656
|
-
y2: "9.26513",
|
|
3657
|
-
gradientUnits: "userSpaceOnUse",
|
|
3658
|
-
children: [
|
|
3659
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "rgb(var(--oui-gradient-brand-end))" }),
|
|
3660
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "rgb(var(--oui-gradient-brand-start))" })
|
|
3661
|
-
]
|
|
3662
|
-
}
|
|
3663
|
-
) }),
|
|
3664
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3665
|
-
"path",
|
|
3666
|
-
{
|
|
3667
|
-
fill: "url(#paint0_linear_555_7374)",
|
|
3668
|
-
fillOpacity: 1,
|
|
3669
|
-
d: "m1.5 1.5.75 3 4.843 4.56-1.808 1.919-.63-.633-1.06 1.06.665.665-1.88 1.996-.35-.346-1.06 1.06 2.25 2.25 1.06-1.06-.348-.349 1.998-1.878.665.662 1.06-1.06-.63-.63L9 10.852l1.969 1.854-.639.639 1.06 1.06.672-.67 1.998 1.877-.358.358 1.064 1.06 2.25-2.25-1.06-1.06-.34.34-1.881-1.998.656-.657-1.06-1.06-.625.624-1.799-1.91.003-.003L9 7.03 4.5 2.25zm15 0-3 .75-3.636 3.861 2.022 2.025L15.75 4.5z"
|
|
3670
|
-
}
|
|
3671
|
-
)
|
|
3672
|
-
] });
|
|
3673
|
-
};
|
|
3674
|
-
var CampaignIcon = (props) => {
|
|
3675
|
-
return /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Icon, { size: 18, viewBox: "0 0 18 18", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3676
|
-
"path",
|
|
3677
|
-
{
|
|
3678
|
-
fill: "currentcolor",
|
|
3679
|
-
fillOpacity: 1,
|
|
3680
|
-
d: "m1.5 1.5.75 3 4.843 4.56-1.808 1.919-.63-.633-1.06 1.06.665.665-1.88 1.996-.35-.346-1.06 1.06 2.25 2.25 1.06-1.06-.348-.349 1.998-1.878.665.662 1.06-1.06-.63-.63L9 10.852l1.969 1.854-.639.639 1.06 1.06.672-.67 1.998 1.877-.358.358 1.064 1.06 2.25-2.25-1.06-1.06-.34.34-1.881-1.998.656-.657-1.06-1.06-.625.624-1.799-1.91.003-.003L9 7.03 4.5 2.25zm15 0-3 .75-3.636 3.861 2.022 2.025L15.75 4.5z"
|
|
3681
|
-
}
|
|
3682
|
-
) });
|
|
3683
|
-
};
|
|
3684
|
-
var ArrowRightShortIcon = (props) => {
|
|
3685
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Icon, { size: 18, viewBox: "0 0 18 18", ...props, children: [
|
|
3686
|
-
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3687
|
-
"linearGradient",
|
|
3688
|
-
{
|
|
3689
|
-
id: "paint0_linear_555_7374",
|
|
3690
|
-
x1: "17.0157",
|
|
3691
|
-
y1: "9.26513",
|
|
3692
|
-
x2: "0.969849",
|
|
3693
|
-
y2: "9.26513",
|
|
3694
|
-
gradientUnits: "userSpaceOnUse",
|
|
3695
|
-
children: [
|
|
3696
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { stopColor: "rgb(var(--oui-gradient-brand-end))" }),
|
|
3697
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", { offset: "1", stopColor: "rgb(var(--oui-gradient-brand-start))" })
|
|
3698
|
-
]
|
|
3699
|
-
}
|
|
3700
|
-
) }),
|
|
3701
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3702
|
-
"path",
|
|
3703
|
-
{
|
|
3704
|
-
fill: "url(#paint0_linear_555_7374)",
|
|
3705
|
-
fillOpacity: 1,
|
|
3706
|
-
d: "M4.509 8.995a.75.75 0 0 1 .75-.75h5.666L8.7 5.998l1.054-1.054 3.535 3.512c.147.146.22.343.22.54a.76.76 0 0 1-.22.537l-3.535 3.512L8.7 11.992l2.225-2.248H5.258a.75.75 0 0 1-.749-.75"
|
|
3707
|
-
}
|
|
3708
|
-
)
|
|
3709
|
-
] });
|
|
3710
|
-
};
|
|
3711
|
-
var FundIcon = (props) => {
|
|
3712
|
-
return /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Icon, { size: 18, viewBox: "0 0 18 18", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3713
|
-
"path",
|
|
3714
|
-
{
|
|
3715
|
-
fill: "currentcolor",
|
|
3716
|
-
fillOpacity: 0.8,
|
|
3717
|
-
d: "M15.694 7.087c-.788-.393-1.857-.618-2.925-.618-1.125 0-2.138.225-2.925.618-.056 0-.113.057-.113.057V3.769c0-.9-.731-1.575-1.462-1.913-.788-.394-1.857-.619-2.925-.619-1.069 0-2.25.225-3.038.62C1.575 2.193.844 2.868.844 3.768v10.519c0 .9.731 1.575 1.462 1.912.788.394 1.856.619 2.925.619s2.138-.225 2.925-.619c.281-.169.563-.337.788-.562.225.225.506.393.787.562.788.394 1.857.619 2.925.619 1.125 0 2.138-.225 2.925-.619.732-.394 1.463-1.012 1.463-1.912V9c.112-.9-.619-1.519-1.35-1.913m-7.369 7.144c0 .113-.112.45-.731.732-.563.28-1.407.506-2.363.506s-1.8-.169-2.362-.506c-.619-.282-.731-.62-.731-.732V13.5c.056 0 .112 0 .168.056.788.394 1.856.619 2.925.619s2.138-.225 2.925-.619c.056 0 .113-.056.113-.056v.731zm0-2.587c0 .112-.112.45-.731.731-.563.281-1.407.506-2.363.506s-1.8-.168-2.362-.506c-.619-.281-.731-.619-.731-.731v-.788c.056 0 .112.056.112.056.788.394 1.856.62 2.925.62s2.138-.226 2.925-.62c.056 0 .113-.056.113-.056v.788zm0-2.644c0 .112-.112.45-.731.731-.563.281-1.407.507-2.363.507s-1.8-.17-2.362-.507C2.25 9.45 2.138 9.112 2.138 9v-.788c.056 0 .112.057.112.057.788.393 1.856.618 2.925.618S7.313 8.662 8.1 8.27c.056 0 .113-.057.113-.057V9zm0-2.644c0 .113-.112.45-.731.731-.563.282-1.407.507-2.363.507s-1.8-.169-2.362-.507c-.619-.28-.731-.618-.731-.73v-.732c.056 0 .112 0 .168.056.788.394 1.856.619 2.925.619s2.138-.225 2.925-.619c.056 0 .113-.056.113-.056v.731zM7.594 4.5c-.563.281-1.407.506-2.363.506S3.488 4.781 2.925 4.5c-.619-.338-.731-.619-.731-.731 0-.113.112-.45.731-.732.563-.28 1.406-.506 2.363-.506.956 0 1.8.169 2.362.506.619.282.731.62.731.732-.056.112-.168.393-.787.731m8.212 9.731c0 .113-.112.45-.731.732-.562.28-1.406.506-2.362.506s-1.8-.169-2.363-.506c-.619-.282-.731-.62-.731-.732V13.5c.056 0 .112.056.112.056.788.394 1.857.619 2.925.619 1.125 0 2.138-.225 2.925-.619.056 0 .113-.056.113-.056v.731zm0-2.587c0 .112-.112.45-.731.731-.562.281-1.406.506-2.362.506s-1.8-.168-2.363-.506c-.619-.281-.731-.619-.731-.731v-.788c.056 0 .112.056.112.056.788.394 1.857.62 2.925.62 1.125 0 2.138-.226 2.925-.62.056 0 .113-.056.113-.056v.788zm-.675-1.913c-.562.281-1.406.507-2.362.507s-1.8-.17-2.363-.507c-.619-.281-.731-.619-.731-.731 0-.113.112-.45.731-.731.563-.282 1.406-.507 2.363-.507.956 0 1.8.17 2.362.507.619.281.732.618.732.731-.057.112-.17.45-.732.731"
|
|
3718
|
-
}
|
|
3719
|
-
) });
|
|
3720
|
-
};
|
|
3721
|
-
var AnnouncementIcon = (props) => {
|
|
3722
|
-
return /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Icon, { size: 18, viewBox: "0 0 18 18", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3723
|
-
"path",
|
|
3724
|
-
{
|
|
3725
|
-
fill: "currentcolor",
|
|
3726
|
-
fillOpacity: 0.8,
|
|
3727
|
-
d: "M11.53 2.255a.745.745 0 0 0-.82.165c-.525.524-1.188.959-1.947 1.284-.77.33-2.353.757-3.508.75-2.248-.015-3.756 1.259-3.756 3.726 0 2.163 1.228 3.42 2.994 3.703l.006 1.565a2.25 2.25 0 0 0 2.25 2.247c1.142 0 2.083-.883 2.228-1.988.007-.053.022-.26.022-1.01.674.315 1.232.812 1.711 1.29.473.472 1.29.13 1.29-.538 0-.678-.004-1.906-.004-3.13.884-.327 1.503-1.165 1.503-2.115s-.585-1.81-1.496-2.129c0-1.225-.004-2.439-.004-3.117a.76.76 0 0 0-.469-.703m1.805 1.335a.73.73 0 0 0-.445.351.75.75 0 0 0 .258 1.03 3.74 3.74 0 0 1 1.851 3.233 3.74 3.74 0 0 1-1.851 3.231.76.76 0 0 0-.282 1.03.754.754 0 0 0 1.032.258 5.24 5.24 0 0 0 2.601-4.52 5.24 5.24 0 0 0-2.601-4.519.74.74 0 0 0-.563-.094m-2.832.884c0 .694-.004 1.417-.004 2.231v2.997c0 .815.003 1.508.003 2.202-1.52-.896-3.085-1.294-4.501-1.421 0-1.144-.004-3.406-.004-4.584.147-.007.318-.026.565-.06a11.2 11.2 0 0 0 2.812-.773c.43-.184.75-.35 1.129-.592m-6.005 1.55-.001 4.34c-.976-.27-1.498-.959-1.498-2.184 0-1.21.47-1.928 1.499-2.155M6 11.998c.238.008 1.098.161 1.493.261l.007 1.19a.75.75 0 0 1-1.5 0z"
|
|
3728
|
-
}
|
|
3729
|
-
) });
|
|
3730
|
-
};
|
|
3731
|
-
var SecurityIcon = (props) => {
|
|
3732
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Icon, { size: 18, viewBox: "0 0 18 18", ...props, children: [
|
|
3733
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3734
|
-
"path",
|
|
3735
|
-
{
|
|
3736
|
-
d: "M6.563 7.678V6.603c0-1.153 1.09-2.088 2.437-2.088s2.438.935 2.438 2.088v1.075c.448 0 .812.311.812.696v3.479c0 .384-.364.696-.812.696H6.563c-.449 0-.813-.312-.813-.696v-3.48c0-.384.364-.695.813-.695m1.187-.006 1.431.006h1.07V6.564c0-.64-.504-1.104-1.25-1.104-.748 0-1.25.465-1.25 1.104zm1.956 2.14c0-.335-.317-.605-.706-.605-.39 0-.706.27-.706.604v.77c0 .335.316.605.706.605s.706-.27.706-.604z",
|
|
3737
|
-
fill: "currentcolor",
|
|
3738
|
-
fillOpacity: ".8"
|
|
3739
|
-
}
|
|
3740
|
-
),
|
|
3741
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3742
|
-
"path",
|
|
3743
|
-
{
|
|
3744
|
-
d: "M2 3.607c.003 5.606.146 11.651 6.879 13.378.078.02.164.02.242 0C15.854 15.258 15.997 9.213 16 3.607c0-.217-.14-.41-.345-.477L9.31 1.05a1 1 0 0 0-.62 0L2.345 3.13A.5.5 0 0 0 2 3.607m2.326 7.63c-.707-1.954-.81-4.33-.824-6.902L9 2.532l5.498 1.803c-.014 2.573-.117 4.948-.824 6.901-.697 1.93-1.987 3.463-4.674 4.222-2.687-.759-3.977-2.293-4.674-4.222",
|
|
3745
|
-
fill: "currentcolor",
|
|
3746
|
-
fillOpacity: ".8"
|
|
3747
|
-
}
|
|
3748
|
-
)
|
|
3749
|
-
] });
|
|
3750
|
-
};
|
|
3751
|
-
var AnnouncementItem = (props) => {
|
|
3752
|
-
const { t } = orderlyI18n.useTranslation();
|
|
3753
|
-
const Icon2 = React6.useMemo(() => {
|
|
3754
|
-
switch (props.type) {
|
|
3755
|
-
case orderlyTypes.AnnouncementType.Campaign:
|
|
3756
|
-
return CampaignIcon;
|
|
3757
|
-
case orderlyTypes.AnnouncementType.Listing:
|
|
3758
|
-
return FundIcon;
|
|
3759
|
-
case orderlyTypes.AnnouncementType.Maintenance:
|
|
3760
|
-
return SecurityIcon;
|
|
3761
|
-
case orderlyTypes.AnnouncementType.Delisting:
|
|
3762
|
-
default:
|
|
3763
|
-
return AnnouncementIcon;
|
|
3764
|
-
}
|
|
3765
|
-
}, [props.type]);
|
|
3766
|
-
const title = React6.useMemo(() => {
|
|
3767
|
-
switch (props.type) {
|
|
3768
|
-
case orderlyTypes.AnnouncementType.Campaign:
|
|
3769
|
-
return t("notification.campaign");
|
|
3770
|
-
case orderlyTypes.AnnouncementType.Delisting:
|
|
3771
|
-
return t("notification.delisting");
|
|
3772
|
-
case orderlyTypes.AnnouncementType.Listing:
|
|
3773
|
-
return t("notification.listing");
|
|
3774
|
-
case orderlyTypes.AnnouncementType.Maintenance:
|
|
3775
|
-
return t("notification.maintenance");
|
|
3776
|
-
default:
|
|
3777
|
-
return t("notification.general");
|
|
3778
|
-
}
|
|
3779
|
-
}, [props.type, t]);
|
|
3780
|
-
const action = React6.useMemo(() => {
|
|
3781
|
-
if (props.type === orderlyTypes.AnnouncementType.Campaign && typeof props.url === "string" && props.url !== "" && typeof props.onItemClick === "function") {
|
|
3782
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3783
|
-
orderlyUi.Flex,
|
|
3784
|
-
{
|
|
3785
|
-
gap: 1,
|
|
3786
|
-
itemAlign: "center",
|
|
3787
|
-
className: "oui-cursor-pointer",
|
|
3788
|
-
onClick: (event) => {
|
|
3789
|
-
event.stopPropagation();
|
|
3790
|
-
props.onItemClick(props.url);
|
|
3791
|
-
},
|
|
3792
|
-
children: [
|
|
3793
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3794
|
-
orderlyUi.Text,
|
|
3795
|
-
{
|
|
3796
|
-
size: "xs",
|
|
3797
|
-
color: "buy",
|
|
3798
|
-
className: "oui-bg-clip-text oui-text-transparent oui-gradient-brand",
|
|
3799
|
-
children: t("notification.joinNow")
|
|
3800
|
-
}
|
|
3801
|
-
),
|
|
3802
|
-
/* @__PURE__ */ jsxRuntime.jsx(ArrowRightShortIcon, { size: 18 })
|
|
3803
|
-
]
|
|
3804
|
-
}
|
|
3805
|
-
);
|
|
3806
|
-
}
|
|
3807
|
-
return null;
|
|
3808
|
-
}, [props.type, props.url, t]);
|
|
3809
|
-
const updateTime = React6.useMemo(() => {
|
|
3810
|
-
if (props.type === orderlyTypes.AnnouncementType.Maintenance) {
|
|
3811
|
-
return /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "2xs", intensity: 36, children: t("notification.recentlyUpdated") });
|
|
3812
|
-
}
|
|
3813
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3814
|
-
orderlyUi.Text.formatted,
|
|
3815
|
-
{
|
|
3816
|
-
size: "2xs",
|
|
3817
|
-
intensity: 36,
|
|
3818
|
-
rule: "date",
|
|
3819
|
-
formatString: "yyyy-MM-dd HH:mm:ss",
|
|
3820
|
-
children: props.updatedTime
|
|
3821
|
-
}
|
|
3822
|
-
);
|
|
3823
|
-
}, [props.updatedTime, props.type, t]);
|
|
3824
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3825
|
-
orderlyUi.Flex,
|
|
3826
|
-
{
|
|
3827
|
-
gap: 2,
|
|
3828
|
-
itemAlign: "start",
|
|
3829
|
-
className: orderlyUi.cn(
|
|
3830
|
-
"oui-px-2 oui-py-[6px] oui-text-base-contrast-80",
|
|
3831
|
-
!props.showDivider && "oui-rounded-md hover:oui-bg-base-6",
|
|
3832
|
-
!props.showDivider && props.expanded && "oui-bg-base-6",
|
|
3833
|
-
props.className
|
|
3834
|
-
),
|
|
3835
|
-
onClick: () => {
|
|
3836
|
-
props.onExpandToggle?.();
|
|
3837
|
-
},
|
|
3838
|
-
children: [
|
|
3839
|
-
/* @__PURE__ */ jsxRuntime.jsx(Icon2, { color: "white", className: "oui-mt-3 oui-shrink-0" }),
|
|
3840
|
-
/* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { direction: "column", itemAlign: "start", grow: true, children: [
|
|
3841
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 80, weight: "bold", children: title }),
|
|
3842
|
-
updateTime,
|
|
3843
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3844
|
-
"div",
|
|
3845
|
-
{
|
|
3846
|
-
className: "oui-grid oui-transition-all oui-duration-300 oui-ease-in-out",
|
|
3847
|
-
style: {
|
|
3848
|
-
gridTemplateRows: props.expanded ? "1fr" : "0fr"
|
|
3849
|
-
},
|
|
3850
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-flex-col oui-gap-2 oui-overflow-hidden", children: [
|
|
3851
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "2xs", intensity: 80, as: "div", className: "oui-pt-2", children: props.message }),
|
|
3852
|
-
action
|
|
3853
|
-
] })
|
|
3854
|
-
}
|
|
3855
|
-
)
|
|
3856
|
-
] }),
|
|
3857
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-pt-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3858
|
-
orderlyUi.ChevronDownIcon,
|
|
3859
|
-
{
|
|
3860
|
-
color: "white",
|
|
3861
|
-
size: 18,
|
|
3862
|
-
className: `oui-transition-transform oui-duration-300 oui-ease-in-out ${props.expanded ? "oui-rotate-180" : "oui-rotate-0"}`
|
|
3863
|
-
}
|
|
3864
|
-
) })
|
|
3865
|
-
]
|
|
3866
|
-
}
|
|
3867
|
-
);
|
|
3868
|
-
};
|
|
3869
|
-
var AnnouncementContent = (props) => {
|
|
3870
|
-
const { dataSource, current, onExpandToggle, onItemClick } = props;
|
|
3871
|
-
const { t } = orderlyI18n.useTranslation();
|
|
3872
|
-
if (!Array.isArray(dataSource) || dataSource.length === 0) {
|
|
3873
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-flex oui-h-[160px] oui-items-center oui-justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3874
|
-
orderlyUi.ExtensionSlot,
|
|
3875
|
-
{
|
|
3876
|
-
position: orderlyUi.ExtensionPositionEnum.EmptyDataIdentifier,
|
|
3877
|
-
title: t("notification.empty")
|
|
3878
|
-
}
|
|
3879
|
-
) });
|
|
3880
|
-
}
|
|
3881
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3882
|
-
"div",
|
|
3883
|
-
{
|
|
3884
|
-
className: orderlyUi.cn(
|
|
3885
|
-
"oui-flex oui-flex-col oui-space-y-1",
|
|
3886
|
-
props.showDivider && "[&>*:not(:first-child)]:oui-border-t [&>*:not(:first-child)]:oui-border-line-12 [&>*:not(:first-child)]:oui-pt-1"
|
|
3887
|
-
),
|
|
3888
|
-
children: dataSource.map((item) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3889
|
-
AnnouncementItem,
|
|
3890
|
-
{
|
|
3891
|
-
url: item.url,
|
|
3892
|
-
onItemClick,
|
|
3893
|
-
message: item.message,
|
|
3894
|
-
updatedTime: item.updated_time ?? 0,
|
|
3895
|
-
expanded: current === item.announcement_id,
|
|
3896
|
-
type: item.type,
|
|
3897
|
-
showDivider: props.showDivider,
|
|
3898
|
-
onExpandToggle: () => {
|
|
3899
|
-
if (current === item.announcement_id) {
|
|
3900
|
-
onExpandToggle(null);
|
|
3901
|
-
} else {
|
|
3902
|
-
onExpandToggle(item.announcement_id);
|
|
3903
|
-
}
|
|
3904
|
-
}
|
|
3905
|
-
},
|
|
3906
|
-
item.announcement_id
|
|
3907
|
-
))
|
|
3908
|
-
}
|
|
3909
|
-
);
|
|
3910
|
-
};
|
|
3911
|
-
var AnnouncementCenterUI = (props) => {
|
|
3912
|
-
const { t } = orderlyI18n.useTranslation();
|
|
3913
|
-
const [expanded, setExpanded] = React6.useState(null);
|
|
3914
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3915
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-px-5 oui-pt-4", children: /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { intensity: 80, weight: "bold", children: t("notification.title") }) }),
|
|
3916
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.ScrollArea, { className: "oui-flex oui-h-[300px] oui-flex-col oui-space-y-1 oui-p-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3917
|
-
AnnouncementContent,
|
|
3918
|
-
{
|
|
3919
|
-
dataSource: props.dataSource,
|
|
3920
|
-
current: expanded,
|
|
3921
|
-
onExpandToggle: setExpanded,
|
|
3922
|
-
onItemClick: props.onItemClick
|
|
3923
|
-
}
|
|
3924
|
-
) })
|
|
3925
|
-
] });
|
|
3926
|
-
};
|
|
3927
|
-
var CampaignContentCard = ({ message, coverImage, url, onItemClick }) => {
|
|
3928
|
-
const { t } = orderlyI18n.useTranslation();
|
|
3929
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-flex-col oui-gap-5", children: [
|
|
3930
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "sm", weight: "bold", children: message }),
|
|
3931
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3932
|
-
"div",
|
|
3933
|
-
{
|
|
3934
|
-
className: "oui-rounded-xl oui-bg-base-9 oui-bg-cover oui-bg-center oui-bg-no-repeat",
|
|
3935
|
-
style: {
|
|
3936
|
-
backgroundImage: `url(${coverImage})`,
|
|
3937
|
-
height: "100px"
|
|
3938
|
-
}
|
|
3939
|
-
}
|
|
3940
|
-
),
|
|
3941
|
-
typeof url === "string" && url !== "" && typeof onItemClick === "function" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3942
|
-
"button",
|
|
3943
|
-
{
|
|
3944
|
-
className: "oui-flex oui-items-center oui-gap-1",
|
|
3945
|
-
onClick: () => onItemClick(url),
|
|
3946
|
-
children: [
|
|
3947
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3948
|
-
orderlyUi.Text,
|
|
3949
|
-
{
|
|
3950
|
-
size: "xs",
|
|
3951
|
-
color: "buy",
|
|
3952
|
-
className: "oui-bg-clip-text oui-text-transparent oui-gradient-brand",
|
|
3953
|
-
children: t("notification.joinNow")
|
|
3954
|
-
}
|
|
3955
|
-
),
|
|
3956
|
-
/* @__PURE__ */ jsxRuntime.jsx(ArrowRightShortIcon, { size: 18, color: "success" })
|
|
3957
|
-
]
|
|
3958
|
-
}
|
|
3959
|
-
)
|
|
3960
|
-
] });
|
|
3961
|
-
};
|
|
3962
|
-
var MaintenanceContentCard = ({ message, startTime, endTime }) => {
|
|
3963
|
-
const { t } = orderlyI18n.useTranslation();
|
|
3964
|
-
const formattedMessage = React6.useMemo(() => {
|
|
3965
|
-
const hours = dateFns.differenceInHours(endTime, startTime);
|
|
3966
|
-
const minutes = dateFns.differenceInMinutes(endTime, startTime) - hours * 60;
|
|
3967
|
-
const startUtc = new utc.UTCDate(startTime);
|
|
3968
|
-
const endUtc = new utc.UTCDate(endTime);
|
|
3969
|
-
const startTimeFormatted = dateFns.format(startUtc, "HH:mm");
|
|
3970
|
-
const endTimeFormatted = dateFns.format(endUtc, "hh:mm a");
|
|
3971
|
-
if (hours > 0) {
|
|
3972
|
-
return t("notification.maintenanceDuration.hours", {
|
|
3973
|
-
hours: minutes > 0 ? (hours + minutes / 60).toFixed(1) : hours,
|
|
3974
|
-
startTimeFormatted,
|
|
3975
|
-
endTimeFormatted
|
|
3976
|
-
});
|
|
3977
|
-
}
|
|
3978
|
-
return t("notification.maintenanceDuration.minutes", {
|
|
3979
|
-
minutes,
|
|
3980
|
-
startTimeFormatted,
|
|
3981
|
-
endTimeFormatted
|
|
3982
|
-
});
|
|
3983
|
-
}, [startTime, endTime, t]);
|
|
3984
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-flex-col oui-gap-1", children: [
|
|
3985
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", intensity: 54, children: t("notification.recentlyUpdated") }),
|
|
3986
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Flex, { itemAlign: "center", children: /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", weight: "bold", children: formattedMessage }) }),
|
|
3987
|
-
message && /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "2xs", intensity: 80, as: "div", className: "oui-mt-2", children: message })
|
|
3988
|
-
] });
|
|
3989
|
-
};
|
|
3990
|
-
var DelistingContentCard = ({ message, updateTime }) => {
|
|
3991
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-flex-col oui-gap-1", children: [
|
|
3992
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3993
|
-
orderlyUi.Text.formatted,
|
|
3994
|
-
{
|
|
3995
|
-
rule: "date",
|
|
3996
|
-
intensity: 54,
|
|
3997
|
-
formatString: "yyyy-MM-dd HH:mm:ss",
|
|
3998
|
-
size: "xs",
|
|
3999
|
-
children: updateTime
|
|
4000
|
-
}
|
|
4001
|
-
),
|
|
4002
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "sm", weight: "bold", children: message })
|
|
4003
|
-
] });
|
|
4004
|
-
};
|
|
4005
|
-
var ListingContentCard = ({ message, updateTime }) => {
|
|
4006
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "oui-flex oui-flex-col oui-gap-1", children: [
|
|
4007
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4008
|
-
orderlyUi.Text.formatted,
|
|
4009
|
-
{
|
|
4010
|
-
rule: "date",
|
|
4011
|
-
intensity: 54,
|
|
4012
|
-
formatString: "yyyy-MM-dd HH:mm:ss",
|
|
4013
|
-
size: "xs",
|
|
4014
|
-
children: updateTime
|
|
4015
|
-
}
|
|
4016
|
-
),
|
|
4017
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "sm", weight: "bold", children: message })
|
|
4018
|
-
] });
|
|
4019
|
-
};
|
|
4020
|
-
var NotificationHeader = (props) => {
|
|
4021
|
-
const { t } = orderlyI18n.useTranslation();
|
|
4022
|
-
const { expanded } = props;
|
|
4023
|
-
const { type } = props.dataSource[props.current];
|
|
4024
|
-
const title = React6.useMemo(() => {
|
|
4025
|
-
switch (type) {
|
|
4026
|
-
case orderlyTypes.AnnouncementType.Campaign:
|
|
4027
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4028
|
-
orderlyUi.Text,
|
|
4029
|
-
{
|
|
4030
|
-
size: "sm",
|
|
4031
|
-
className: "oui-text-transparent oui-bg-clip-text oui-gradient-brand",
|
|
4032
|
-
children: t("notification.campaign")
|
|
4033
|
-
}
|
|
4034
|
-
);
|
|
4035
|
-
case orderlyTypes.AnnouncementType.Delisting:
|
|
4036
|
-
return /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "sm", children: t("notification.delistingTitle") });
|
|
4037
|
-
case orderlyTypes.AnnouncementType.Listing:
|
|
4038
|
-
return /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "sm", color: "buy", children: t("notification.listing") });
|
|
4039
|
-
case orderlyTypes.AnnouncementType.Maintenance:
|
|
4040
|
-
return /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "sm", color: "warning", children: t("notification.maintenanceTitle") });
|
|
4041
|
-
default:
|
|
4042
|
-
return /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "sm", color: "inherit", children: t("notification.generalTitle") });
|
|
4043
|
-
}
|
|
4044
|
-
}, [type, t]);
|
|
4045
|
-
const icon = React6.useMemo(() => {
|
|
4046
|
-
switch (type) {
|
|
4047
|
-
case orderlyTypes.AnnouncementType.Campaign:
|
|
4048
|
-
return /* @__PURE__ */ jsxRuntime.jsx(BattleIcon, { color: "white" });
|
|
4049
|
-
case orderlyTypes.AnnouncementType.Listing:
|
|
4050
|
-
return /* @__PURE__ */ jsxRuntime.jsx(FundIcon, { color: "success" });
|
|
4051
|
-
case orderlyTypes.AnnouncementType.Maintenance:
|
|
4052
|
-
return /* @__PURE__ */ jsxRuntime.jsx(SecurityIcon, { color: "warning" });
|
|
4053
|
-
case orderlyTypes.AnnouncementType.Delisting:
|
|
4054
|
-
default:
|
|
4055
|
-
return /* @__PURE__ */ jsxRuntime.jsx(AnnouncementIcon, { color: "white" });
|
|
4056
|
-
}
|
|
4057
|
-
}, [type]);
|
|
4058
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { itemAlign: "center", justify: "between", className: "oui-px-4 oui-py-3", children: [
|
|
4059
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "orderly-notification-header oui-flex oui-items-center oui-gap-2", children: [
|
|
4060
|
-
icon,
|
|
4061
|
-
title
|
|
4062
|
-
] }),
|
|
4063
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4064
|
-
"button",
|
|
4065
|
-
{
|
|
4066
|
-
onClick: props.onExpandToggle,
|
|
4067
|
-
className: "oui-transition-transform oui-duration-300",
|
|
4068
|
-
style: {
|
|
4069
|
-
transform: !expanded ? "rotate(180deg)" : "rotate(0deg)"
|
|
4070
|
-
},
|
|
4071
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.ChevronDownIcon, { size: 18, color: "white" })
|
|
4072
|
-
}
|
|
4073
|
-
)
|
|
4074
|
-
] });
|
|
4075
|
-
};
|
|
4076
|
-
var NotificationFooter = (props) => {
|
|
4077
|
-
const { total, current, onCloseAll, onPrev, onNext } = props;
|
|
4078
|
-
const { t } = orderlyI18n.useTranslation();
|
|
4079
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4080
|
-
orderlyUi.Flex,
|
|
4081
|
-
{
|
|
4082
|
-
className: "orderly-notification-footer oui-px-4 oui-py-2",
|
|
4083
|
-
itemAlign: "center",
|
|
4084
|
-
justify: "between",
|
|
4085
|
-
children: [
|
|
4086
|
-
/* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Flex, { gap: 2, children: [
|
|
4087
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4088
|
-
"button",
|
|
4089
|
-
{
|
|
4090
|
-
disabled: current - 1 < 0,
|
|
4091
|
-
onClick: onPrev,
|
|
4092
|
-
className: "oui-flex oui-size-[18px] oui-items-center oui-justify-center oui-rounded-full oui-bg-base-6 hover:oui-bg-base-5 disabled:oui-opacity-50",
|
|
4093
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.ChevronLeftIcon, { size: 14, color: "white" })
|
|
4094
|
-
}
|
|
4095
|
-
),
|
|
4096
|
-
/* @__PURE__ */ jsxRuntime.jsxs(orderlyUi.Text, { intensity: 54, size: "sm", children: [
|
|
4097
|
-
current + 1,
|
|
4098
|
-
"/",
|
|
4099
|
-
total
|
|
4100
|
-
] }),
|
|
4101
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4102
|
-
"button",
|
|
4103
|
-
{
|
|
4104
|
-
disabled: current + 1 >= total,
|
|
4105
|
-
onClick: onNext,
|
|
4106
|
-
className: "oui-flex oui-size-[18px] oui-items-center oui-justify-center oui-rounded-full oui-bg-base-6 hover:oui-bg-base-5 disabled:oui-opacity-50",
|
|
4107
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.ChevronRightIcon, { size: 14, color: "white" })
|
|
4108
|
-
}
|
|
4109
|
-
)
|
|
4110
|
-
] }),
|
|
4111
|
-
/* @__PURE__ */ jsxRuntime.jsx("button", { onClick: onCloseAll, children: /* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Text, { size: "xs", color: "primary", children: t("notification.closeAll", { total }) }) })
|
|
4112
|
-
]
|
|
4113
|
-
}
|
|
4114
|
-
);
|
|
4115
|
-
};
|
|
4116
|
-
var NotificationContent = (props) => {
|
|
4117
|
-
const elements = React6.useMemo(() => {
|
|
4118
|
-
return props.dataSource.map((message) => {
|
|
4119
|
-
const { type } = message;
|
|
4120
|
-
switch (type) {
|
|
4121
|
-
case orderlyTypes.AnnouncementType.Campaign:
|
|
4122
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4123
|
-
CampaignContentCard,
|
|
4124
|
-
{
|
|
4125
|
-
message: message.message,
|
|
4126
|
-
coverImage: message.coverImage ?? "",
|
|
4127
|
-
updateTime: message.updated_time ?? 0,
|
|
4128
|
-
url: message.url ?? "",
|
|
4129
|
-
onItemClick: props.onItemClick
|
|
4130
|
-
}
|
|
4131
|
-
);
|
|
4132
|
-
case orderlyTypes.AnnouncementType.Maintenance:
|
|
4133
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4134
|
-
MaintenanceContentCard,
|
|
4135
|
-
{
|
|
4136
|
-
message: message.message,
|
|
4137
|
-
startTime: message.startTime ?? 0,
|
|
4138
|
-
endTime: message.endTime ?? 0
|
|
4139
|
-
}
|
|
4140
|
-
);
|
|
4141
|
-
case orderlyTypes.AnnouncementType.Delisting:
|
|
4142
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4143
|
-
DelistingContentCard,
|
|
4144
|
-
{
|
|
4145
|
-
message: message.message,
|
|
4146
|
-
updateTime: message.updated_time ?? 0
|
|
4147
|
-
}
|
|
4148
|
-
);
|
|
4149
|
-
default:
|
|
4150
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4151
|
-
ListingContentCard,
|
|
4152
|
-
{
|
|
4153
|
-
message: message.message,
|
|
4154
|
-
updateTime: message.updated_time ?? 0
|
|
4155
|
-
}
|
|
4156
|
-
);
|
|
4157
|
-
}
|
|
4158
|
-
});
|
|
4159
|
-
}, [props.dataSource]);
|
|
4160
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: elements[props.current] });
|
|
4161
|
-
};
|
|
4162
3647
|
var NotificationUI = (props) => {
|
|
4163
|
-
const [expanded, setExpanded] = React6.useState(true);
|
|
4164
|
-
const [current, setCurrent] = React6.useState(0);
|
|
4165
|
-
const len = React6.useMemo(() => props.dataSource?.length ?? 0, [props.dataSource]);
|
|
4166
|
-
if (len === 0) {
|
|
4167
|
-
return null;
|
|
4168
|
-
}
|
|
4169
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "orderly-notification oui-w-full ", children: [
|
|
4170
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4171
|
-
NotificationHeader,
|
|
4172
|
-
{
|
|
4173
|
-
dataSource: props.dataSource ?? [],
|
|
4174
|
-
current,
|
|
4175
|
-
expanded,
|
|
4176
|
-
onExpandToggle: () => {
|
|
4177
|
-
setExpanded(!expanded);
|
|
4178
|
-
}
|
|
4179
|
-
}
|
|
4180
|
-
),
|
|
4181
|
-
/* @__PURE__ */ jsxRuntime.jsx(orderlyUi.Divider, { className: "oui-mx-4" }),
|
|
4182
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4183
|
-
"div",
|
|
4184
|
-
{
|
|
4185
|
-
className: "oui-grid oui-transition-all oui-duration-300 oui-ease-in-out",
|
|
4186
|
-
style: {
|
|
4187
|
-
gridTemplateRows: expanded ? "1fr" : "0fr"
|
|
4188
|
-
},
|
|
4189
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-min-h-0 oui-overflow-hidden ", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "oui-px-4 oui-py-3", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4190
|
-
NotificationContent,
|
|
4191
|
-
{
|
|
4192
|
-
dataSource: props.dataSource ?? [],
|
|
4193
|
-
current,
|
|
4194
|
-
onItemClick: props.onItemClick
|
|
4195
|
-
}
|
|
4196
|
-
) }) })
|
|
4197
|
-
}
|
|
4198
|
-
),
|
|
4199
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4200
|
-
NotificationFooter,
|
|
4201
|
-
{
|
|
4202
|
-
total: len,
|
|
4203
|
-
current,
|
|
4204
|
-
onCloseAll: props.onClose ?? (() => {
|
|
4205
|
-
}),
|
|
4206
|
-
onPrev: () => {
|
|
4207
|
-
if (current - 1 < 0) {
|
|
4208
|
-
return;
|
|
4209
|
-
}
|
|
4210
|
-
setCurrent(current - 1);
|
|
4211
|
-
},
|
|
4212
|
-
onNext: () => {
|
|
4213
|
-
if (current + 1 >= len) {
|
|
4214
|
-
return;
|
|
4215
|
-
}
|
|
4216
|
-
setCurrent(current + 1);
|
|
4217
|
-
}
|
|
4218
|
-
}
|
|
4219
|
-
)
|
|
4220
|
-
] });
|
|
4221
|
-
};
|
|
4222
|
-
var maintentanceId = "-1";
|
|
4223
|
-
var ORDERLY_ANNOUNCEMENT_KEY = "orderly_announcement";
|
|
4224
|
-
var getTimeString = (timestamp) => {
|
|
4225
|
-
const date = dateFns.format(new utc.UTCDateMini(timestamp), "MMM dd");
|
|
4226
|
-
const time = dateFns.format(new utc.UTCDateMini(timestamp), "h:mm aa");
|
|
4227
|
-
return `${time} (UTC) on ${date}`;
|
|
4228
|
-
};
|
|
4229
|
-
var sortDataByUpdatedTime = (ori) => {
|
|
4230
|
-
return immer.produce(ori, (draft) => {
|
|
4231
|
-
if (Array.isArray(draft.rows)) {
|
|
4232
|
-
draft.rows.sort((a, b) => {
|
|
4233
|
-
if (a.updated_time && b.updated_time) {
|
|
4234
|
-
return b.updated_time - a.updated_time;
|
|
4235
|
-
}
|
|
4236
|
-
return 0;
|
|
4237
|
-
});
|
|
4238
|
-
}
|
|
4239
|
-
});
|
|
4240
|
-
};
|
|
4241
|
-
var useAnnouncementData = () => {
|
|
4242
|
-
const ws = orderlyHooks.useWS();
|
|
4243
|
-
const [announcementStore, setStore] = orderlyHooks.useLocalStorage(
|
|
4244
|
-
ORDERLY_ANNOUNCEMENT_KEY,
|
|
4245
|
-
{}
|
|
4246
|
-
);
|
|
4247
|
-
const [tips, setTips] = React6.useState({});
|
|
4248
|
-
const [maintenanceDialogInfo, setMaintenanceDialogInfo] = React6.useState();
|
|
4249
|
-
const { startTime, endTime, status, brokerName } = orderlyHooks.useMaintenanceStatus();
|
|
4250
|
-
const { t } = orderlyI18n.useTranslation();
|
|
4251
|
-
const { data: announcements } = orderlyHooks.useQuery(
|
|
4252
|
-
`/v2/public/announcement`,
|
|
4253
|
-
{
|
|
4254
|
-
revalidateOnFocus: false,
|
|
4255
|
-
refreshInterval: 60 * 60 * 1e3,
|
|
4256
|
-
// refresh every 1 hour
|
|
4257
|
-
formatter: (data) => data
|
|
4258
|
-
}
|
|
4259
|
-
);
|
|
4260
|
-
const getMaintentTipsContent = (brokerName2, startDate, endDate) => t("maintenance.tips.description", { brokerName: brokerName2, startDate, endDate });
|
|
4261
|
-
const getMaintentDialogContent = (brokerName2, endDate) => t("maintenance.dialog.description", { brokerName: brokerName2, endDate });
|
|
4262
|
-
React6.useEffect(() => {
|
|
4263
|
-
const unsubscribe = ws.subscribe("announcement", {
|
|
4264
|
-
onMessage(message) {
|
|
4265
|
-
if (message) {
|
|
4266
|
-
setTips((prev) => {
|
|
4267
|
-
return immer.produce(prev, (draft) => {
|
|
4268
|
-
if (!Array.isArray(draft.rows)) {
|
|
4269
|
-
draft.rows = [];
|
|
4270
|
-
}
|
|
4271
|
-
const idx = draft.rows.findIndex(
|
|
4272
|
-
(tip) => tip.announcement_id === message.announcement_id
|
|
4273
|
-
);
|
|
4274
|
-
if (idx !== -1) {
|
|
4275
|
-
draft.rows.splice(idx, 1);
|
|
4276
|
-
}
|
|
4277
|
-
draft.rows.push({
|
|
4278
|
-
announcement_id: message.announcement_id,
|
|
4279
|
-
message: message.message,
|
|
4280
|
-
url: message.url,
|
|
4281
|
-
i18n: message.i18n,
|
|
4282
|
-
type: message.type,
|
|
4283
|
-
updated_time: message.updated_time
|
|
4284
|
-
});
|
|
4285
|
-
});
|
|
4286
|
-
});
|
|
4287
|
-
setStore((prev) => ({ ...prev, show: true }));
|
|
4288
|
-
}
|
|
4289
|
-
},
|
|
4290
|
-
onError(err) {
|
|
4291
|
-
}
|
|
4292
|
-
});
|
|
4293
|
-
return () => {
|
|
4294
|
-
unsubscribe?.();
|
|
4295
|
-
};
|
|
4296
|
-
}, [ws]);
|
|
4297
|
-
React6.useEffect(() => {
|
|
4298
|
-
if (!announcements?.rows) {
|
|
4299
|
-
return;
|
|
4300
|
-
}
|
|
4301
|
-
const apiTime = announcements.last_updated_time ?? 0;
|
|
4302
|
-
const cachedTime = announcementStore.lastUpdateTime ?? 0;
|
|
4303
|
-
if (cachedTime < apiTime) {
|
|
4304
|
-
setTips((prev) => ({ ...prev, rows: announcements?.rows }));
|
|
4305
|
-
setStore({ show: true, lastUpdateTime: apiTime });
|
|
4306
|
-
} else {
|
|
4307
|
-
setTips((prev) => {
|
|
4308
|
-
return immer.produce(prev, (draft) => {
|
|
4309
|
-
if (announcements?.rows?.length) {
|
|
4310
|
-
const existingIds = new Set(
|
|
4311
|
-
prev.rows?.map((tip) => tip.announcement_id)
|
|
4312
|
-
);
|
|
4313
|
-
const maintenanceTip = prev.rows?.find(
|
|
4314
|
-
(tip) => tip.announcement_id === maintentanceId
|
|
4315
|
-
);
|
|
4316
|
-
draft.rows = [];
|
|
4317
|
-
announcements.rows.forEach((item) => {
|
|
4318
|
-
if (!existingIds.has(item.announcement_id)) {
|
|
4319
|
-
draft.rows?.push(item);
|
|
4320
|
-
}
|
|
4321
|
-
});
|
|
4322
|
-
if (maintenanceTip) {
|
|
4323
|
-
draft.rows.unshift(maintenanceTip);
|
|
4324
|
-
}
|
|
4325
|
-
} else {
|
|
4326
|
-
const idx = draft.rows?.findIndex(
|
|
4327
|
-
(tip) => tip.announcement_id === maintentanceId
|
|
4328
|
-
);
|
|
4329
|
-
if (idx !== void 0 && idx !== -1) {
|
|
4330
|
-
draft.rows?.splice(idx, 1);
|
|
4331
|
-
}
|
|
4332
|
-
}
|
|
4333
|
-
});
|
|
4334
|
-
});
|
|
4335
|
-
}
|
|
4336
|
-
}, [announcements]);
|
|
4337
|
-
React6.useEffect(() => {
|
|
4338
|
-
const startDate = startTime ? getTimeString(startTime) : "-";
|
|
4339
|
-
const endDate = endTime ? getTimeString(endTime) : "-";
|
|
4340
|
-
if (status === orderlyHooks.MaintenanceStatus.Maintenance) {
|
|
4341
|
-
setMaintenanceDialogInfo(getMaintentDialogContent(brokerName, endDate));
|
|
4342
|
-
return;
|
|
4343
|
-
}
|
|
4344
|
-
setMaintenanceDialogInfo(void 0);
|
|
4345
|
-
if (startTime && endTime) {
|
|
4346
|
-
setTips(
|
|
4347
|
-
(prev) => immer.produce(prev, (draft) => {
|
|
4348
|
-
if (!Array.isArray(draft.rows)) {
|
|
4349
|
-
draft.rows = [];
|
|
4350
|
-
}
|
|
4351
|
-
draft.rows = [
|
|
4352
|
-
{
|
|
4353
|
-
announcement_id: maintentanceId,
|
|
4354
|
-
type: orderlyTypes.AnnouncementType.Maintenance,
|
|
4355
|
-
/** @ts-ignore */
|
|
4356
|
-
startTime,
|
|
4357
|
-
/** @ts-ignore */
|
|
4358
|
-
endTime,
|
|
4359
|
-
message: getMaintentTipsContent(brokerName, startDate, endDate)
|
|
4360
|
-
},
|
|
4361
|
-
...draft.rows.filter(
|
|
4362
|
-
(tip) => tip.type !== orderlyTypes.AnnouncementType.Maintenance
|
|
4363
|
-
)
|
|
4364
|
-
];
|
|
4365
|
-
})
|
|
4366
|
-
);
|
|
4367
|
-
} else {
|
|
4368
|
-
setTips((prev) => {
|
|
4369
|
-
return immer.produce(prev, (draft) => {
|
|
4370
|
-
const index = draft.rows?.findIndex(
|
|
4371
|
-
(tip) => tip.announcement_id === maintentanceId
|
|
4372
|
-
);
|
|
4373
|
-
if (index !== void 0 && index !== -1) {
|
|
4374
|
-
draft.rows?.splice(index, 1);
|
|
4375
|
-
}
|
|
4376
|
-
});
|
|
4377
|
-
});
|
|
4378
|
-
}
|
|
4379
|
-
}, [startTime, endTime, status, brokerName, t]);
|
|
4380
|
-
const { customAnnouncements } = orderlyReactApp.useAppContext();
|
|
4381
|
-
const mergedTips = React6.useMemo(() => {
|
|
4382
|
-
const tipsCopy = { ...tips };
|
|
4383
|
-
if (customAnnouncements && customAnnouncements.length > 0) {
|
|
4384
|
-
tipsCopy.rows = [...customAnnouncements, ...tips.rows || []];
|
|
4385
|
-
}
|
|
4386
|
-
return sortDataByUpdatedTime(tipsCopy);
|
|
4387
|
-
}, [tips, customAnnouncements]);
|
|
4388
|
-
return {
|
|
4389
|
-
tips: mergedTips,
|
|
4390
|
-
maintenanceDialogInfo
|
|
4391
|
-
};
|
|
4392
|
-
};
|
|
4393
|
-
var useAnnouncement = (options) => {
|
|
4394
|
-
const { showAnnouncement, setShowAnnouncement } = orderlyReactApp.useAppContext();
|
|
4395
|
-
const { dataAdapter } = orderlyHooks.useOrderlyContext();
|
|
4396
|
-
const { tips: mergedTips, maintenanceDialogInfo } = useAnnouncementData();
|
|
4397
|
-
const memoizedTips = React6.useMemo(() => {
|
|
4398
|
-
if (typeof dataAdapter?.announcementList === "function") {
|
|
4399
|
-
return dataAdapter.announcementList(
|
|
4400
|
-
mergedTips?.rows ?? orderlyTypes.EMPTY_LIST
|
|
4401
|
-
);
|
|
4402
|
-
}
|
|
4403
|
-
return mergedTips?.rows ?? orderlyTypes.EMPTY_LIST;
|
|
4404
|
-
}, [dataAdapter?.announcementList, mergedTips?.rows]);
|
|
4405
|
-
const [announcementStore, setStore] = orderlyHooks.useLocalStorage(
|
|
4406
|
-
ORDERLY_ANNOUNCEMENT_KEY,
|
|
4407
|
-
{}
|
|
4408
|
-
);
|
|
4409
|
-
const closeTips = () => {
|
|
4410
|
-
setStore((prev) => ({ ...prev, show: false }));
|
|
4411
|
-
};
|
|
4412
|
-
React6.useEffect(() => {
|
|
4413
|
-
const len = memoizedTips.length;
|
|
4414
|
-
setShowAnnouncement(
|
|
4415
|
-
Boolean(len) && announcementStore.show && true
|
|
4416
|
-
);
|
|
4417
|
-
}, [
|
|
4418
|
-
memoizedTips,
|
|
4419
|
-
announcementStore.show,
|
|
4420
|
-
options?.hideTips,
|
|
4421
|
-
setShowAnnouncement
|
|
4422
|
-
]);
|
|
4423
|
-
return {
|
|
4424
|
-
maintenanceDialogInfo,
|
|
4425
|
-
tips: memoizedTips,
|
|
4426
|
-
closeTips,
|
|
4427
|
-
showAnnouncement
|
|
4428
|
-
};
|
|
4429
|
-
};
|
|
4430
|
-
var NotificationUI2 = (props) => {
|
|
4431
3648
|
const { dataSource, showAnnouncement } = props;
|
|
4432
3649
|
const { routerAdapter } = useScaffoldContext();
|
|
4433
3650
|
const onItemClick = (url) => {
|
|
@@ -4492,7 +3709,7 @@ var NotificationUI2 = (props) => {
|
|
|
4492
3709
|
showAnnouncement ? "oui-visible" : "oui-invisible"
|
|
4493
3710
|
),
|
|
4494
3711
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4495
|
-
NotificationUI,
|
|
3712
|
+
orderlyUiNotification.NotificationUI,
|
|
4496
3713
|
{
|
|
4497
3714
|
dataSource,
|
|
4498
3715
|
onClose,
|
|
@@ -4505,7 +3722,7 @@ var NotificationUI2 = (props) => {
|
|
|
4505
3722
|
var NotificationWidget = () => {
|
|
4506
3723
|
const { announcementState } = useScaffoldContext();
|
|
4507
3724
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4508
|
-
|
|
3725
|
+
NotificationUI,
|
|
4509
3726
|
{
|
|
4510
3727
|
dataSource: announcementState.tips,
|
|
4511
3728
|
onClose: announcementState.closeTips,
|
|
@@ -5159,7 +4376,7 @@ var ScaffoldProvider = (props) => {
|
|
|
5159
4376
|
} = props;
|
|
5160
4377
|
const [chains] = orderlyHooks.useChains();
|
|
5161
4378
|
const { networkId } = React6.useContext(orderlyHooks.OrderlyContext);
|
|
5162
|
-
const announcementState = useAnnouncement();
|
|
4379
|
+
const announcementState = orderlyUiNotification.useAnnouncement();
|
|
5163
4380
|
const checkChainSupportHandle = orderlyHooks.useMemoizedFn((chainId) => {
|
|
5164
4381
|
return checkChainSupport(
|
|
5165
4382
|
chainId,
|
|
@@ -5953,7 +5170,7 @@ var MessageCenter = (props) => {
|
|
|
5953
5170
|
},
|
|
5954
5171
|
arrow: true,
|
|
5955
5172
|
content: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5956
|
-
AnnouncementCenterUI,
|
|
5173
|
+
orderlyUiNotification.AnnouncementCenterUI,
|
|
5957
5174
|
{
|
|
5958
5175
|
dataSource: messages,
|
|
5959
5176
|
onItemClick
|
|
@@ -6551,7 +5768,7 @@ var MaintenanceTipsUI = (props) => {
|
|
|
6551
5768
|
}
|
|
6552
5769
|
);
|
|
6553
5770
|
};
|
|
6554
|
-
function
|
|
5771
|
+
function getTimeString(timestamp) {
|
|
6555
5772
|
const date = dateFns.format(new utc.UTCDateMini(timestamp), "MMM dd");
|
|
6556
5773
|
const time = dateFns.format(new utc.UTCDateMini(timestamp), "h:mm aa");
|
|
6557
5774
|
return `${time} (UTC) on ${date}`;
|
|
@@ -6566,13 +5783,13 @@ var useMaintenanceScript = () => {
|
|
|
6566
5783
|
if (!startTime) {
|
|
6567
5784
|
return "-";
|
|
6568
5785
|
}
|
|
6569
|
-
return
|
|
5786
|
+
return getTimeString(startTime);
|
|
6570
5787
|
}, [startTime]);
|
|
6571
5788
|
const endDate = React6.useMemo(() => {
|
|
6572
5789
|
if (!endTime) {
|
|
6573
5790
|
return "-";
|
|
6574
5791
|
}
|
|
6575
|
-
return
|
|
5792
|
+
return getTimeString(endTime);
|
|
6576
5793
|
}, [endTime]);
|
|
6577
5794
|
const closeTips = () => {
|
|
6578
5795
|
window.localStorage.setItem(`Maintenance_${startTime}`, "1");
|