@cfxjs/sirius-next-common 0.1.38 → 0.1.39
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/chunk-3RVRAMNW.js +69 -0
- package/dist/chunk-3RVRAMNW.js.map +1 -0
- package/dist/chunk-4HTI24KG.js +3629 -0
- package/dist/chunk-4HTI24KG.js.map +1 -0
- package/dist/chunk-6AGMKWAW.js +286 -0
- package/dist/chunk-6AGMKWAW.js.map +1 -0
- package/dist/chunk-6GBDCZIP.js +414 -0
- package/dist/chunk-6GBDCZIP.js.map +1 -0
- package/dist/chunk-73IFRWHE.js +130 -0
- package/dist/chunk-73IFRWHE.js.map +1 -0
- package/dist/chunk-AAQD5VX5.js +212 -0
- package/dist/chunk-AAQD5VX5.js.map +1 -0
- package/dist/chunk-AD46ITJC.js +416 -0
- package/dist/chunk-AD46ITJC.js.map +1 -0
- package/dist/chunk-AV2OU3PU.js +108 -0
- package/dist/chunk-AV2OU3PU.js.map +1 -0
- package/dist/chunk-B5XWZ3ZE.js +150 -0
- package/dist/chunk-B5XWZ3ZE.js.map +1 -0
- package/dist/chunk-CDYRVFSO.js +150 -0
- package/dist/chunk-CDYRVFSO.js.map +1 -0
- package/dist/chunk-EP4RVV4C.js +3629 -0
- package/dist/chunk-EP4RVV4C.js.map +1 -0
- package/dist/chunk-EVMUOMAM.js +412 -0
- package/dist/chunk-EVMUOMAM.js.map +1 -0
- package/dist/chunk-EYT54RGS.js +63 -0
- package/dist/chunk-EYT54RGS.js.map +1 -0
- package/dist/chunk-FMHO65DC.js +105 -0
- package/dist/chunk-FMHO65DC.js.map +1 -0
- package/dist/chunk-H6W3LPDS.js +2324 -0
- package/dist/chunk-H6W3LPDS.js.map +1 -0
- package/dist/chunk-HC2D4STF.js +69 -0
- package/dist/chunk-HC2D4STF.js.map +1 -0
- package/dist/chunk-IV4QQOMI.js +416 -0
- package/dist/chunk-IV4QQOMI.js.map +1 -0
- package/dist/chunk-IWECTQOD.js +212 -0
- package/dist/chunk-IWECTQOD.js.map +1 -0
- package/dist/chunk-JQUV4NMR.js +416 -0
- package/dist/chunk-JQUV4NMR.js.map +1 -0
- package/dist/chunk-KAGEJPGK.js +416 -0
- package/dist/chunk-KAGEJPGK.js.map +1 -0
- package/dist/chunk-KCPSCEXG.js +69 -0
- package/dist/chunk-KCPSCEXG.js.map +1 -0
- package/dist/chunk-KKR2JERD.js +284 -0
- package/dist/chunk-KKR2JERD.js.map +1 -0
- package/dist/chunk-LQXAMTBE.js +69 -0
- package/dist/chunk-LQXAMTBE.js.map +1 -0
- package/dist/chunk-M43SICPO.js +63 -0
- package/dist/chunk-M43SICPO.js.map +1 -0
- package/dist/chunk-M6MXSMYM.js +284 -0
- package/dist/chunk-M6MXSMYM.js.map +1 -0
- package/dist/chunk-MIAX5LP5.js +141 -0
- package/dist/chunk-MIAX5LP5.js.map +1 -0
- package/dist/chunk-N5TMLKGL.js +141 -0
- package/dist/chunk-N5TMLKGL.js.map +1 -0
- package/dist/chunk-NIYCXPXR.js +108 -0
- package/dist/chunk-NIYCXPXR.js.map +1 -0
- package/dist/chunk-O474QMUU.js +105 -0
- package/dist/chunk-O474QMUU.js.map +1 -0
- package/dist/chunk-OF33MONA.js +69 -0
- package/dist/chunk-OF33MONA.js.map +1 -0
- package/dist/chunk-PLU4IMEZ.js +130 -0
- package/dist/chunk-PLU4IMEZ.js.map +1 -0
- package/dist/chunk-RB2U3Y7F.js +49 -0
- package/dist/chunk-RB2U3Y7F.js.map +1 -0
- package/dist/chunk-RVVVAX7C.js +796 -0
- package/dist/chunk-RVVVAX7C.js.map +1 -0
- package/dist/chunk-TAJNIINB.js +69 -0
- package/dist/chunk-TAJNIINB.js.map +1 -0
- package/dist/chunk-VLDX5EPR.js +69 -0
- package/dist/chunk-VLDX5EPR.js.map +1 -0
- package/dist/chunk-VUULJBTQ.js +796 -0
- package/dist/chunk-VUULJBTQ.js.map +1 -0
- package/dist/chunk-VY6BUAPS.js +49 -0
- package/dist/chunk-VY6BUAPS.js.map +1 -0
- package/dist/chunk-XGOIDR7R.js +416 -0
- package/dist/chunk-XGOIDR7R.js.map +1 -0
- package/dist/chunk-XMBEB34D.js +69 -0
- package/dist/chunk-XMBEB34D.js.map +1 -0
- package/dist/chunk-XMWQQ4A6.js +414 -0
- package/dist/chunk-XMWQQ4A6.js.map +1 -0
- package/dist/chunk-Z6EYKGBH.js +286 -0
- package/dist/chunk-Z6EYKGBH.js.map +1 -0
- package/dist/chunk-ZKNMJZ5R.js +2324 -0
- package/dist/chunk-ZKNMJZ5R.js.map +1 -0
- package/dist/components/AddressContainer/CoreAddressContainer.js +10 -10
- package/dist/components/AddressContainer/EVMAddressContainer.js +9 -9
- package/dist/components/AddressContainer/addressSwitcher.js +7 -7
- package/dist/components/AddressContainer/addressView.js +6 -6
- package/dist/components/AddressContainer/label.js +4 -4
- package/dist/components/Age/index.js +4 -4
- package/dist/components/Charts/ChartOptions.js +2 -2
- package/dist/components/Charts/PreviewChartTemplate.js +6 -4
- package/dist/components/Charts/PreviewChartTemplate.js.map +1 -1
- package/dist/components/Charts/StockChartTemplate.js +7 -5
- package/dist/components/Charts/StockChartTemplate.js.map +1 -1
- package/dist/components/Charts/config.d.ts +5 -4
- package/dist/components/Charts/config.js +3 -1
- package/dist/components/CopyButton/index.js +3 -3
- package/dist/components/DownloadCSV/index.js +4 -4
- package/dist/components/GasPriceDropdown/index.js +2 -2
- package/dist/components/IncreasePercent/index.js +2 -2
- package/dist/components/InfoIconWithTooltip/index.js +3 -3
- package/dist/components/Modal/index.js +3 -3
- package/dist/components/NetworkIcon/index.js +2 -2
- package/dist/components/PhishingAddressContainer/index.js +4 -4
- package/dist/components/Price/index.js +3 -3
- package/dist/components/Radio/index.js +2 -2
- package/dist/components/Select/index.js +3 -3
- package/dist/components/Select/select.js +3 -3
- package/dist/components/Text/index.js +4 -4
- package/dist/components/Tooltip/index.js +3 -3
- package/dist/components/TransactionAction/coreTransactionAction.js +10 -10
- package/dist/components/TransactionAction/evmTransactionAction.js +9 -9
- package/dist/utils/address.d.ts +1 -1
- package/dist/utils/address.js +2 -2
- package/dist/utils/contractManagerTool.js +2 -2
- package/dist/utils/hooks/useChartQueryParams.d.ts +18 -0
- package/dist/utils/hooks/useChartQueryParams.js +31 -0
- package/dist/utils/hooks/useChartQueryParams.js.map +1 -0
- package/dist/utils/hooks/useENS.js +3 -3
- package/dist/utils/index.js +2 -2
- package/dist/utils/request.d.ts +1 -1
- package/dist/utils/request.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ContractAddress,
|
|
3
|
+
ContractCreatedAddress,
|
|
4
|
+
InvalidAddress,
|
|
5
|
+
MyAddress
|
|
6
|
+
} from "./chunk-AAQD5VX5.js";
|
|
7
|
+
import {
|
|
8
|
+
RenderAddress
|
|
9
|
+
} from "./chunk-73IFRWHE.js";
|
|
10
|
+
import {
|
|
11
|
+
convertCheckSum,
|
|
12
|
+
formatAddress,
|
|
13
|
+
isEvmAddress,
|
|
14
|
+
isZeroAddress
|
|
15
|
+
} from "./chunk-KKR2JERD.js";
|
|
16
|
+
import {
|
|
17
|
+
getLabelInfo
|
|
18
|
+
} from "./chunk-RB2U3Y7F.js";
|
|
19
|
+
import {
|
|
20
|
+
getTranslations,
|
|
21
|
+
useGlobalData
|
|
22
|
+
} from "./chunk-DQGLZCIG.js";
|
|
23
|
+
|
|
24
|
+
// src/components/AddressContainer/EVMAddressContainer.tsx
|
|
25
|
+
import { memo } from "react";
|
|
26
|
+
import { withTranslation } from "react-i18next";
|
|
27
|
+
import _ from "lodash";
|
|
28
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
29
|
+
var parseProps = (props, globalData) => {
|
|
30
|
+
const { alias, t, showAddressLabel, showNametag, nametagInfo } = props;
|
|
31
|
+
const value = props.value || "";
|
|
32
|
+
const cfxAddress = formatAddress(value, "hex");
|
|
33
|
+
const translations = getTranslations();
|
|
34
|
+
let aliasLabel = alias;
|
|
35
|
+
if (!alias && isZeroAddress(cfxAddress)) {
|
|
36
|
+
aliasLabel = t(translations.general.zeroAddress);
|
|
37
|
+
}
|
|
38
|
+
let officalNametag = null;
|
|
39
|
+
let addressLabel = null;
|
|
40
|
+
if (cfxAddress && showAddressLabel) {
|
|
41
|
+
const addressLabels = globalData?.["CONFLUX_SCAN_ADDRESS_LABELS" /* addressLabel */];
|
|
42
|
+
const gAddressLabel = addressLabels?.[convertCheckSum(cfxAddress)] || addressLabels?.[cfxAddress.toLowerCase()];
|
|
43
|
+
if (gAddressLabel) {
|
|
44
|
+
const { label } = getLabelInfo(gAddressLabel, "tag");
|
|
45
|
+
addressLabel = label;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
if (cfxAddress && showNametag) {
|
|
49
|
+
const nametags = nametagInfo?.[convertCheckSum(cfxAddress)] || nametagInfo?.[cfxAddress.toLowerCase()];
|
|
50
|
+
if (nametags) {
|
|
51
|
+
const nametag = nametags?.nametag ?? "";
|
|
52
|
+
const { label } = getLabelInfo(nametag, "nametag");
|
|
53
|
+
officalNametag = label;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
alias: aliasLabel,
|
|
58
|
+
nametag: officalNametag,
|
|
59
|
+
addressLabel,
|
|
60
|
+
cfxAddress
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
var EVMAddressContainer = withTranslation()(
|
|
64
|
+
memo((props) => {
|
|
65
|
+
const { globalData } = useGlobalData();
|
|
66
|
+
if (!props.value && !props.contractCreated) {
|
|
67
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "--" });
|
|
68
|
+
}
|
|
69
|
+
const defaultProps = {
|
|
70
|
+
isFull: false,
|
|
71
|
+
isFullNameTag: false,
|
|
72
|
+
link: true,
|
|
73
|
+
isMe: false,
|
|
74
|
+
showIcon: true,
|
|
75
|
+
verify: false,
|
|
76
|
+
showAddressLabel: true,
|
|
77
|
+
showENSLabel: true,
|
|
78
|
+
showNametag: true
|
|
79
|
+
};
|
|
80
|
+
const mergeDefaultProps = _.assign({}, defaultProps, props);
|
|
81
|
+
const mergeParseProps = _.merge(
|
|
82
|
+
{},
|
|
83
|
+
mergeDefaultProps,
|
|
84
|
+
parseProps(mergeDefaultProps, globalData)
|
|
85
|
+
);
|
|
86
|
+
if (!mergeParseProps.value && mergeParseProps.contractCreated) {
|
|
87
|
+
return ContractCreatedAddress({
|
|
88
|
+
...mergeParseProps,
|
|
89
|
+
outputType: "hex"
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (!isEvmAddress(mergeParseProps.value)) {
|
|
93
|
+
return InvalidAddress(mergeParseProps);
|
|
94
|
+
}
|
|
95
|
+
if (mergeParseProps.isContract) {
|
|
96
|
+
return ContractAddress(mergeParseProps);
|
|
97
|
+
}
|
|
98
|
+
if (mergeParseProps.isMe) {
|
|
99
|
+
return MyAddress(mergeParseProps);
|
|
100
|
+
}
|
|
101
|
+
return RenderAddress(mergeParseProps);
|
|
102
|
+
})
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
EVMAddressContainer
|
|
107
|
+
};
|
|
108
|
+
//# sourceMappingURL=chunk-NIYCXPXR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/AddressContainer/EVMAddressContainer.tsx"],"sourcesContent":["import { memo } from 'react';\nimport { WithTranslation, withTranslation } from 'react-i18next';\nimport _ from 'lodash';\nimport {\n formatAddress,\n isEvmAddress,\n isZeroAddress,\n convertCheckSum,\n} from '../../utils/address';\nimport { useGlobalData, getTranslations } from '../../store';\nimport { LOCALSTORAGE_KEYS_MAP } from '../../utils/constants';\nimport { getLabelInfo } from './label';\n\nimport { RenderAddress } from './addressView';\nimport {\n ContractCreatedAddress,\n InvalidAddress,\n ContractAddress,\n MyAddress,\n} from './addressSwitcher';\nimport { GlobalDataType } from 'src/store/types';\nimport { EVMAddressContainerProps } from './types';\n\nconst parseProps = (\n props: EVMAddressContainerProps & WithTranslation,\n globalData: GlobalDataType,\n) => {\n const { alias, t, showAddressLabel, showNametag, nametagInfo } = props;\n const value: string = props.value || '';\n const cfxAddress = formatAddress(value, 'hex');\n\n const translations = getTranslations();\n\n let aliasLabel = alias;\n if (!alias && isZeroAddress(cfxAddress)) {\n aliasLabel = t(translations.general.zeroAddress);\n }\n\n // official name tag\n let officalNametag: React.ReactNode = null;\n // private name tag\n let addressLabel: React.ReactNode = null;\n\n if (cfxAddress && showAddressLabel) {\n // global private name tag\n const addressLabels = globalData?.[LOCALSTORAGE_KEYS_MAP.addressLabel];\n const gAddressLabel =\n addressLabels?.[convertCheckSum(cfxAddress)] ||\n addressLabels?.[cfxAddress.toLowerCase()];\n\n if (gAddressLabel) {\n const { label } = getLabelInfo(gAddressLabel, 'tag');\n addressLabel = label;\n }\n }\n\n if (cfxAddress && showNametag) {\n const nametags =\n nametagInfo?.[convertCheckSum(cfxAddress)] ||\n nametagInfo?.[cfxAddress.toLowerCase()];\n\n if (nametags) {\n const nametag = nametags?.nametag ?? '';\n const { label } = getLabelInfo(nametag, 'nametag');\n officalNametag = label;\n }\n }\n\n return {\n alias: aliasLabel,\n nametag: officalNametag,\n addressLabel,\n cfxAddress,\n };\n};\n\nexport const EVMAddressContainer = withTranslation()(\n memo((props: EVMAddressContainerProps & WithTranslation) => {\n const { globalData } = useGlobalData();\n\n // If a txn receipt has no 'to' address or 'contractCreated', show -- for temp\n if (!props.value && !props.contractCreated) {\n return <>--</>;\n }\n\n const defaultProps = {\n isFull: false,\n isFullNameTag: false,\n link: true,\n isMe: false,\n showIcon: true,\n verify: false,\n showAddressLabel: true,\n showENSLabel: true,\n showNametag: true,\n };\n\n const mergeDefaultProps = _.assign({}, defaultProps, props);\n\n const mergeParseProps = _.merge(\n {},\n mergeDefaultProps,\n parseProps(mergeDefaultProps, globalData),\n );\n\n if (!mergeParseProps.value && mergeParseProps.contractCreated) {\n return ContractCreatedAddress({\n ...mergeParseProps,\n outputType: 'hex',\n });\n }\n\n if (!isEvmAddress(mergeParseProps.value)) {\n return InvalidAddress(mergeParseProps);\n }\n\n if (mergeParseProps.isContract) {\n return ContractAddress(mergeParseProps);\n }\n\n if (mergeParseProps.isMe) {\n return MyAddress(mergeParseProps);\n }\n\n return RenderAddress(mergeParseProps);\n }),\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY;AACrB,SAA0B,uBAAuB;AACjD,OAAO,OAAO;AAgFD;AA3Db,IAAM,aAAa,CACjB,OACA,eACG;AACH,QAAM,EAAE,OAAO,GAAG,kBAAkB,aAAa,YAAY,IAAI;AACjE,QAAM,QAAgB,MAAM,SAAS;AACrC,QAAM,aAAa,cAAc,OAAO,KAAK;AAE7C,QAAM,eAAe,gBAAgB;AAErC,MAAI,aAAa;AACjB,MAAI,CAAC,SAAS,cAAc,UAAU,GAAG;AACvC,iBAAa,EAAE,aAAa,QAAQ,WAAW;AAAA,EACjD;AAGA,MAAI,iBAAkC;AAEtC,MAAI,eAAgC;AAEpC,MAAI,cAAc,kBAAkB;AAElC,UAAM,gBAAgB,6DAA+C;AACrE,UAAM,gBACJ,gBAAgB,gBAAgB,UAAU,CAAC,KAC3C,gBAAgB,WAAW,YAAY,CAAC;AAE1C,QAAI,eAAe;AACjB,YAAM,EAAE,MAAM,IAAI,aAAa,eAAe,KAAK;AACnD,qBAAe;AAAA,IACjB;AAAA,EACF;AAEA,MAAI,cAAc,aAAa;AAC7B,UAAM,WACJ,cAAc,gBAAgB,UAAU,CAAC,KACzC,cAAc,WAAW,YAAY,CAAC;AAExC,QAAI,UAAU;AACZ,YAAM,UAAU,UAAU,WAAW;AACrC,YAAM,EAAE,MAAM,IAAI,aAAa,SAAS,SAAS;AACjD,uBAAiB;AAAA,IACnB;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA,IACT;AAAA,IACA;AAAA,EACF;AACF;AAEO,IAAM,sBAAsB,gBAAgB;AAAA,EACjD,KAAK,CAAC,UAAsD;AAC1D,UAAM,EAAE,WAAW,IAAI,cAAc;AAGrC,QAAI,CAAC,MAAM,SAAS,CAAC,MAAM,iBAAiB;AAC1C,aAAO,gCAAE,gBAAE;AAAA,IACb;AAEA,UAAM,eAAe;AAAA,MACnB,QAAQ;AAAA,MACR,eAAe;AAAA,MACf,MAAM;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,kBAAkB;AAAA,MAClB,cAAc;AAAA,MACd,aAAa;AAAA,IACf;AAEA,UAAM,oBAAoB,EAAE,OAAO,CAAC,GAAG,cAAc,KAAK;AAE1D,UAAM,kBAAkB,EAAE;AAAA,MACxB,CAAC;AAAA,MACD;AAAA,MACA,WAAW,mBAAmB,UAAU;AAAA,IAC1C;AAEA,QAAI,CAAC,gBAAgB,SAAS,gBAAgB,iBAAiB;AAC7D,aAAO,uBAAuB;AAAA,QAC5B,GAAG;AAAA,QACH,YAAY;AAAA,MACd,CAAC;AAAA,IACH;AAEA,QAAI,CAAC,aAAa,gBAAgB,KAAK,GAAG;AACxC,aAAO,eAAe,eAAe;AAAA,IACvC;AAEA,QAAI,gBAAgB,YAAY;AAC9B,aAAO,gBAAgB,eAAe;AAAA,IACxC;AAEA,QAAI,gBAAgB,MAAM;AACxB,aAAO,UAAU,eAAe;AAAA,IAClC;AAEA,WAAO,cAAc,eAAe;AAAA,EACtC,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useBreakpoint
|
|
3
|
+
} from "./chunk-TOKKKTFG.js";
|
|
4
|
+
import {
|
|
5
|
+
Tooltip
|
|
6
|
+
} from "./chunk-H6W3LPDS.js";
|
|
7
|
+
import {
|
|
8
|
+
selectText
|
|
9
|
+
} from "./chunk-RVVVAX7C.js";
|
|
10
|
+
|
|
11
|
+
// src/components/Text/index.tsx
|
|
12
|
+
import React from "react";
|
|
13
|
+
import clsx from "clsx";
|
|
14
|
+
import { jsx } from "react/jsx-runtime";
|
|
15
|
+
var getTypeColor = (type) => {
|
|
16
|
+
const colors = {
|
|
17
|
+
default: "inherit",
|
|
18
|
+
primary: "#7cd77b",
|
|
19
|
+
secondary: "#666",
|
|
20
|
+
success: "#7cd77b",
|
|
21
|
+
warning: "#ffc438",
|
|
22
|
+
error: "#e15c56"
|
|
23
|
+
};
|
|
24
|
+
return colors[type] || colors.default;
|
|
25
|
+
};
|
|
26
|
+
var Text = React.memo(
|
|
27
|
+
({
|
|
28
|
+
className,
|
|
29
|
+
children,
|
|
30
|
+
maxWidth: _maxWidth,
|
|
31
|
+
mobileMaxWidth = _maxWidth,
|
|
32
|
+
maxCount: _maxCount,
|
|
33
|
+
mobileMaxCount = _maxCount,
|
|
34
|
+
hoverValue,
|
|
35
|
+
hoverValueMaxCount: outerHoverValueMaxCount,
|
|
36
|
+
tag = "p",
|
|
37
|
+
type = "default",
|
|
38
|
+
hideTooltip = false,
|
|
39
|
+
...props
|
|
40
|
+
}) => {
|
|
41
|
+
const Component = tag;
|
|
42
|
+
const bp = useBreakpoint();
|
|
43
|
+
let child = children;
|
|
44
|
+
const maxCount = bp === "s" ? mobileMaxCount : _maxCount;
|
|
45
|
+
const maxWidth = bp === "s" ? mobileMaxWidth : _maxWidth;
|
|
46
|
+
if (maxWidth === void 0 && maxCount && typeof children === "string" && children.length > maxCount) {
|
|
47
|
+
child = String.prototype.substr.call(children, 0, maxCount) + "...";
|
|
48
|
+
}
|
|
49
|
+
let textContent = hoverValue || children;
|
|
50
|
+
if (bp === "s" && typeof textContent === "string") {
|
|
51
|
+
const hoverValueMaxCount = outerHoverValueMaxCount || 34;
|
|
52
|
+
let textContentCopy = textContent;
|
|
53
|
+
let newTextContent = [];
|
|
54
|
+
let count = 0;
|
|
55
|
+
while (textContentCopy.length > hoverValueMaxCount) {
|
|
56
|
+
newTextContent.push(
|
|
57
|
+
/* @__PURE__ */ jsx("span", { children: textContentCopy.substr(0, hoverValueMaxCount) }, count)
|
|
58
|
+
);
|
|
59
|
+
newTextContent.push(/* @__PURE__ */ jsx("br", {}, `br${count}`));
|
|
60
|
+
textContentCopy = textContentCopy.substr(hoverValueMaxCount);
|
|
61
|
+
if (count > 3) {
|
|
62
|
+
textContentCopy = textContentCopy.substr(0, hoverValueMaxCount - 3) + "...";
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
newTextContent.push(/* @__PURE__ */ jsx("span", { children: textContentCopy }, ++count));
|
|
66
|
+
textContent = newTextContent;
|
|
67
|
+
}
|
|
68
|
+
const tooltipText = !hideTooltip && React.createElement(
|
|
69
|
+
"div",
|
|
70
|
+
{
|
|
71
|
+
onClick: (e) => {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
e.stopPropagation();
|
|
74
|
+
selectText(e.currentTarget);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
textContent
|
|
78
|
+
);
|
|
79
|
+
const p = { title: tooltipText };
|
|
80
|
+
return React.createElement(Tooltip, p, [
|
|
81
|
+
/* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(
|
|
82
|
+
Component,
|
|
83
|
+
{
|
|
84
|
+
className: clsx(
|
|
85
|
+
"sirius-text truncate vertical-bottom",
|
|
86
|
+
"all-[a]:truncate all-[a]:vertical-bottom all-[a]:cursor-pointer all-[a:hover]:text-#0626ae",
|
|
87
|
+
className
|
|
88
|
+
),
|
|
89
|
+
style: {
|
|
90
|
+
maxWidth,
|
|
91
|
+
display: maxWidth === void 0 ? "inherit" : "inline-block",
|
|
92
|
+
color: getTypeColor(type)
|
|
93
|
+
},
|
|
94
|
+
...props,
|
|
95
|
+
children: child
|
|
96
|
+
}
|
|
97
|
+
) }, "text")
|
|
98
|
+
]);
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
export {
|
|
103
|
+
Text
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=chunk-O474QMUU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Text/index.tsx"],"sourcesContent":["import React from 'react';\nimport clsx from 'clsx';\nimport { Tooltip } from '../Tooltip';\nimport { selectText } from '../../utils';\nimport { useBreakpoint } from '../../utils/media';\n\ntype NormalTypes =\n | 'default'\n | 'secondary'\n | 'success'\n | 'warning'\n | 'error'\n | 'primary';\n\ntype TextProps = {\n children?: React.ReactNode;\n maxWidth?: string;\n mobileMaxWidth?: string;\n maxCount?: number;\n mobileMaxCount?: number;\n hoverValue?: React.ReactNode;\n hoverValueMaxCount?: number;\n tag?: 'p' | 'span';\n type?: NormalTypes;\n hideTooltip?: boolean;\n};\ntype NativeAttrs = Omit<React.HTMLAttributes<any>, keyof TextProps>;\n\nconst getTypeColor = (type: NormalTypes) => {\n const colors: { [key in NormalTypes]: string } = {\n default: 'inherit',\n primary: '#7cd77b',\n secondary: '#666',\n success: '#7cd77b',\n warning: '#ffc438',\n error: '#e15c56',\n };\n\n return colors[type] || colors.default;\n};\n\n// note:\n// 1. maxWidth priority is higher than maxCount\n// 2. maxCount only apply to string\n// 3. if hoverValue is provided, use hoverValue as Tooltip text, otherwise use children\n// if text of prop tooltip is provided, use as Tooltip text\nexport const Text = React.memo(\n ({\n className,\n children,\n maxWidth: _maxWidth,\n mobileMaxWidth = _maxWidth,\n maxCount: _maxCount,\n mobileMaxCount = _maxCount,\n hoverValue,\n hoverValueMaxCount: outerHoverValueMaxCount,\n tag = 'p',\n type = 'default',\n hideTooltip = false,\n ...props\n }: NativeAttrs & TextProps) => {\n const Component = tag;\n const bp = useBreakpoint();\n let child: React.ReactNode = children;\n const maxCount = bp === 's' ? mobileMaxCount : _maxCount;\n const maxWidth = bp === 's' ? mobileMaxWidth : _maxWidth;\n if (\n maxWidth === undefined &&\n maxCount &&\n typeof children === 'string' &&\n children.length > maxCount\n ) {\n child = String.prototype.substr.call(children, 0, maxCount) + '...';\n }\n\n let textContent = hoverValue || children;\n // 控制移动端字符串类型 tooltip 的长度\n // 这里有个问题,就是截断的位置可能是一个完整的单词,暂时没有办法处理,如果为了避免这种情况,需要由外面传入前对内容进行处理,比如设置固定宽度小于 24rem\n // @todo 后续可以试下读取文本长度,动态设置容器宽度值的方式,可以避免截断位置的问题\n if (bp === 's' && typeof textContent === 'string') {\n const hoverValueMaxCount = outerHoverValueMaxCount || 34; // default text count is 36\n let textContentCopy: string = textContent;\n let newTextContent: Array<React.ReactNode> = [];\n let count = 0;\n while (textContentCopy.length > hoverValueMaxCount) {\n newTextContent.push(\n <span key={count}>\n {textContentCopy.substr(0, hoverValueMaxCount)}\n </span>,\n );\n newTextContent.push(<br key={`br${count}`} />);\n textContentCopy = textContentCopy.substr(hoverValueMaxCount);\n // 防止文本过长的情况\n if (count > 3) {\n textContentCopy =\n textContentCopy.substr(0, hoverValueMaxCount - 3) + '...';\n }\n }\n newTextContent.push(<span key={++count}>{textContentCopy}</span>);\n textContent = newTextContent;\n }\n const tooltipText =\n !hideTooltip &&\n React.createElement(\n 'div',\n {\n onClick: e => {\n e.preventDefault();\n e.stopPropagation();\n selectText(e.currentTarget);\n },\n },\n textContent,\n );\n\n const p = { title: tooltipText };\n return React.createElement(Tooltip, p, [\n <span key=\"text\">\n <Component\n className={clsx(\n 'sirius-text truncate vertical-bottom',\n 'all-[a]:truncate all-[a]:vertical-bottom all-[a]:cursor-pointer all-[a:hover]:text-#0626ae',\n className,\n )}\n style={{\n maxWidth,\n display: maxWidth === undefined ? 'inherit' : 'inline-block',\n color: getTypeColor(type),\n }}\n {...props}\n >\n {child}\n </Component>\n </span>,\n ]);\n },\n);\n"],"mappings":";;;;;;;;;;;AAAA,OAAO,WAAW;AAClB,OAAO,UAAU;AAqFP;AA1DV,IAAM,eAAe,CAAC,SAAsB;AAC1C,QAAM,SAA2C;AAAA,IAC/C,SAAS;AAAA,IACT,SAAS;AAAA,IACT,WAAW;AAAA,IACX,SAAS;AAAA,IACT,SAAS;AAAA,IACT,OAAO;AAAA,EACT;AAEA,SAAO,OAAO,IAAI,KAAK,OAAO;AAChC;AAOO,IAAM,OAAO,MAAM;AAAA,EACxB,CAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB;AAAA,IACA,oBAAoB;AAAA,IACpB,MAAM;AAAA,IACN,OAAO;AAAA,IACP,cAAc;AAAA,IACd,GAAG;AAAA,EACL,MAA+B;AAC7B,UAAM,YAAY;AAClB,UAAM,KAAK,cAAc;AACzB,QAAI,QAAyB;AAC7B,UAAM,WAAW,OAAO,MAAM,iBAAiB;AAC/C,UAAM,WAAW,OAAO,MAAM,iBAAiB;AAC/C,QACE,aAAa,UACb,YACA,OAAO,aAAa,YACpB,SAAS,SAAS,UAClB;AACA,cAAQ,OAAO,UAAU,OAAO,KAAK,UAAU,GAAG,QAAQ,IAAI;AAAA,IAChE;AAEA,QAAI,cAAc,cAAc;AAIhC,QAAI,OAAO,OAAO,OAAO,gBAAgB,UAAU;AACjD,YAAM,qBAAqB,2BAA2B;AACtD,UAAI,kBAA0B;AAC9B,UAAI,iBAAyC,CAAC;AAC9C,UAAI,QAAQ;AACZ,aAAO,gBAAgB,SAAS,oBAAoB;AAClD,uBAAe;AAAA,UACb,oBAAC,UACE,0BAAgB,OAAO,GAAG,kBAAkB,KADpC,KAEX;AAAA,QACF;AACA,uBAAe,KAAK,oBAAC,UAAQ,KAAK,OAAS,CAAE;AAC7C,0BAAkB,gBAAgB,OAAO,kBAAkB;AAE3D,YAAI,QAAQ,GAAG;AACb,4BACE,gBAAgB,OAAO,GAAG,qBAAqB,CAAC,IAAI;AAAA,QACxD;AAAA,MACF;AACA,qBAAe,KAAK,oBAAC,UAAoB,6BAAV,EAAE,KAAwB,CAAO;AAChE,oBAAc;AAAA,IAChB;AACA,UAAM,cACJ,CAAC,eACD,MAAM;AAAA,MACJ;AAAA,MACA;AAAA,QACE,SAAS,OAAK;AACZ,YAAE,eAAe;AACjB,YAAE,gBAAgB;AAClB,qBAAW,EAAE,aAAa;AAAA,QAC5B;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAEF,UAAM,IAAI,EAAE,OAAO,YAAY;AAC/B,WAAO,MAAM,cAAc,SAAS,GAAG;AAAA,MACrC,oBAAC,UACC;AAAA,QAAC;AAAA;AAAA,UACC,WAAW;AAAA,YACT;AAAA,YACA;AAAA,YACA;AAAA,UACF;AAAA,UACA,OAAO;AAAA,YACL;AAAA,YACA,SAAS,aAAa,SAAY,YAAY;AAAA,YAC9C,OAAO,aAAa,IAAI;AAAA,UAC1B;AAAA,UACC,GAAG;AAAA,UAEH;AAAA;AAAA,MACH,KAfQ,MAgBV;AAAA,IACF,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import {
|
|
2
|
+
scope
|
|
3
|
+
} from "./chunk-AD46ITJC.js";
|
|
4
|
+
import {
|
|
5
|
+
useI18n
|
|
6
|
+
} from "./chunk-DQGLZCIG.js";
|
|
7
|
+
|
|
8
|
+
// src/components/Charts/ChartOptions.tsx
|
|
9
|
+
import { useTranslation } from "react-i18next";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
var desiredOrder = ["min", "hour", "day", "week", "month", "year"];
|
|
12
|
+
var ChartOptions = ({
|
|
13
|
+
intervalScope,
|
|
14
|
+
intervalType,
|
|
15
|
+
limit,
|
|
16
|
+
onCombination
|
|
17
|
+
}) => {
|
|
18
|
+
const { t } = useTranslation();
|
|
19
|
+
const { translations } = useI18n();
|
|
20
|
+
const intervalScopeDefault = intervalScope || { day: scope.day };
|
|
21
|
+
const sortedIntervalScopeKeys = Object.keys(intervalScopeDefault).sort(
|
|
22
|
+
(a, b) => desiredOrder.indexOf(a) - desiredOrder.indexOf(b)
|
|
23
|
+
);
|
|
24
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex relative z-2 top-[10px] mb-[20px] left-[40px] gap-[10px] flex-col chartsFilter:flex-row chartsFilter:gap-0", children: [
|
|
25
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-[3px] mr-[20px]", children: [
|
|
26
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
27
|
+
t(translations.highcharts.options.time),
|
|
28
|
+
":"
|
|
29
|
+
] }),
|
|
30
|
+
sortedIntervalScopeKeys.map((e, i) => {
|
|
31
|
+
const scopeItemArray = intervalScopeDefault[e];
|
|
32
|
+
const lastScopeItem = scopeItemArray?.[scopeItemArray.length - 1];
|
|
33
|
+
const lastItemLimit = lastScopeItem?.limit;
|
|
34
|
+
return /* @__PURE__ */ jsx(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
className: `${intervalType === e ? "bg-[#E6EBF5]" : "bg-[#F7F7F7]"} w-fit px-[7px] py-[2px] rounded-[5px] text-[12px] cursor-pointer hover:bg-[#eee]`,
|
|
38
|
+
onClick: () => onCombination(e, lastItemLimit + ""),
|
|
39
|
+
children: e
|
|
40
|
+
},
|
|
41
|
+
"scopeKey" + i
|
|
42
|
+
);
|
|
43
|
+
})
|
|
44
|
+
] }),
|
|
45
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-[3px]", children: [
|
|
46
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
47
|
+
t(translations.highcharts.options.range),
|
|
48
|
+
":"
|
|
49
|
+
] }),
|
|
50
|
+
intervalScopeDefault[intervalType]?.map(
|
|
51
|
+
(e, i) => /* @__PURE__ */ jsx(
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
onClick: () => onCombination(intervalType, e.limit + ""),
|
|
55
|
+
className: `${limit === e.limit + "" ? "bg-[#E6EBF5]" : "bg-[#F7F7F7]"} w-fit px-[7px] py-[2px] rounded-[5px] text-[12px] cursor-pointer hover:bg-[#eee]`,
|
|
56
|
+
children: e.label
|
|
57
|
+
},
|
|
58
|
+
"scopeLimit" + i
|
|
59
|
+
)
|
|
60
|
+
)
|
|
61
|
+
] })
|
|
62
|
+
] });
|
|
63
|
+
};
|
|
64
|
+
var ChartOptions_default = ChartOptions;
|
|
65
|
+
|
|
66
|
+
export {
|
|
67
|
+
ChartOptions_default
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=chunk-OF33MONA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/Charts/ChartOptions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next';\nimport { useI18n } from '../../store';\nimport { ScopeItemType, ScopeType, ChartOptionsProps, scope } from './config';\n\nconst desiredOrder = ['min', 'hour', 'day', 'week', 'month', 'year'];\n\nconst ChartOptions = ({\n intervalScope,\n intervalType,\n limit,\n onCombination,\n}: ChartOptionsProps) => {\n const { t } = useTranslation();\n const { translations } = useI18n();\n const intervalScopeDefault = intervalScope || { day: scope.day };\n\n const sortedIntervalScopeKeys = Object.keys(intervalScopeDefault).sort(\n (a, b) => desiredOrder.indexOf(a) - desiredOrder.indexOf(b),\n );\n\n return (\n <div className=\"flex relative z-2 top-[10px] mb-[20px] left-[40px] gap-[10px] flex-col chartsFilter:flex-row chartsFilter:gap-0\">\n <div className=\"flex gap-[3px] mr-[20px]\">\n <div>{t(translations.highcharts.options.time)}:</div>\n {sortedIntervalScopeKeys.map((e, i) => {\n const scopeItemArray = intervalScopeDefault[e as keyof ScopeType];\n const lastScopeItem = scopeItemArray?.[scopeItemArray.length - 1];\n const lastItemLimit = lastScopeItem?.limit;\n\n return (\n <div\n className={`${intervalType === e ? 'bg-[#E6EBF5]' : 'bg-[#F7F7F7]'} w-fit px-[7px] py-[2px] rounded-[5px] text-[12px] cursor-pointer hover:bg-[#eee]`}\n key={'scopeKey' + i}\n onClick={() =>\n onCombination(e as keyof ScopeType, lastItemLimit + '')\n }\n >\n {e}\n </div>\n );\n })}\n </div>\n <div className=\"flex gap-[3px]\">\n <div>{t(translations.highcharts.options.range)}:</div>\n {intervalScopeDefault[intervalType]?.map(\n (e: ScopeItemType, i: number) => (\n <div\n key={'scopeLimit' + i}\n onClick={() => onCombination(intervalType, e.limit + '')}\n className={`${limit === e.limit + '' ? 'bg-[#E6EBF5]' : 'bg-[#F7F7F7]'} w-fit px-[7px] py-[2px] rounded-[5px] text-[12px] cursor-pointer hover:bg-[#eee]`}\n >\n {e.label}\n </div>\n ),\n )}\n </div>\n </div>\n );\n};\n\nexport default ChartOptions;\n"],"mappings":";;;;;;;;AAAA,SAAS,sBAAsB;AAuBvB,SAOI,KAPJ;AAnBR,IAAM,eAAe,CAAC,OAAO,QAAQ,OAAO,QAAQ,SAAS,MAAM;AAEnE,IAAM,eAAe,CAAC;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAyB;AACvB,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,aAAa,IAAI,QAAQ;AACjC,QAAM,uBAAuB,iBAAiB,EAAE,KAAK,MAAM,IAAI;AAE/D,QAAM,0BAA0B,OAAO,KAAK,oBAAoB,EAAE;AAAA,IAChE,CAAC,GAAG,MAAM,aAAa,QAAQ,CAAC,IAAI,aAAa,QAAQ,CAAC;AAAA,EAC5D;AAEA,SACE,qBAAC,SAAI,WAAU,mHACb;AAAA,yBAAC,SAAI,WAAU,4BACb;AAAA,2BAAC,SAAK;AAAA,UAAE,aAAa,WAAW,QAAQ,IAAI;AAAA,QAAE;AAAA,SAAC;AAAA,MAC9C,wBAAwB,IAAI,CAAC,GAAG,MAAM;AACrC,cAAM,iBAAiB,qBAAqB,CAAoB;AAChE,cAAM,gBAAgB,iBAAiB,eAAe,SAAS,CAAC;AAChE,cAAM,gBAAgB,eAAe;AAErC,eACE;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,GAAG,iBAAiB,IAAI,iBAAiB;AAAA,YAEpD,SAAS,MACP,cAAc,GAAsB,gBAAgB,EAAE;AAAA,YAGvD;AAAA;AAAA,UALI,aAAa;AAAA,QAMpB;AAAA,MAEJ,CAAC;AAAA,OACH;AAAA,IACA,qBAAC,SAAI,WAAU,kBACb;AAAA,2BAAC,SAAK;AAAA,UAAE,aAAa,WAAW,QAAQ,KAAK;AAAA,QAAE;AAAA,SAAC;AAAA,MAC/C,qBAAqB,YAAY,GAAG;AAAA,QACnC,CAAC,GAAkB,MACjB;AAAA,UAAC;AAAA;AAAA,YAEC,SAAS,MAAM,cAAc,cAAc,EAAE,QAAQ,EAAE;AAAA,YACvD,WAAW,GAAG,UAAU,EAAE,QAAQ,KAAK,iBAAiB;AAAA,YAEvD,YAAE;AAAA;AAAA,UAJE,eAAe;AAAA,QAKtB;AAAA,MAEJ;AAAA,OACF;AAAA,KACF;AAEJ;AAEA,IAAO,uBAAQ;","names":[]}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
convertCheckSum
|
|
3
|
+
} from "./chunk-M6MXSMYM.js";
|
|
4
|
+
import {
|
|
5
|
+
Text
|
|
6
|
+
} from "./chunk-O474QMUU.js";
|
|
7
|
+
import {
|
|
8
|
+
getTranslations
|
|
9
|
+
} from "./chunk-DQGLZCIG.js";
|
|
10
|
+
|
|
11
|
+
// src/components/AddressContainer/addressView.tsx
|
|
12
|
+
import { Translation } from "react-i18next";
|
|
13
|
+
import { shortenAddress } from "@cfx-kit/dapp-utils/dist/address";
|
|
14
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
var defaultPCMaxWidth = 138;
|
|
16
|
+
var renderTooltipContent = (tooltipContent) => {
|
|
17
|
+
return Object.entries(tooltipContent).map(([key, { label, value, hideLabel }]) => {
|
|
18
|
+
if (value) {
|
|
19
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
20
|
+
!hideLabel && /* @__PURE__ */ jsx("span", { children: /* @__PURE__ */ jsx(Translation, { children: (t) => t(label) }) }),
|
|
21
|
+
value
|
|
22
|
+
] }, key);
|
|
23
|
+
}
|
|
24
|
+
return null;
|
|
25
|
+
}).filter(Boolean);
|
|
26
|
+
};
|
|
27
|
+
var convertLink = ({
|
|
28
|
+
link,
|
|
29
|
+
type,
|
|
30
|
+
hrefAddress,
|
|
31
|
+
cfxAddress
|
|
32
|
+
}) => {
|
|
33
|
+
if (typeof link === "string") {
|
|
34
|
+
return link;
|
|
35
|
+
}
|
|
36
|
+
if (link === false) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
const address = hrefAddress || cfxAddress;
|
|
40
|
+
if (address && typeof address === "string") {
|
|
41
|
+
const pathname = window.location.pathname.toLowerCase();
|
|
42
|
+
const addressLower = address.toLowerCase();
|
|
43
|
+
if (pathname.includes("/address/" + addressLower)) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
if (type === "pow") {
|
|
47
|
+
return `/address/${address}`;
|
|
48
|
+
}
|
|
49
|
+
if (type === "pos") {
|
|
50
|
+
return `/pos/accounts/${address}`;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
};
|
|
55
|
+
var RenderAddress = ({
|
|
56
|
+
cfxAddress,
|
|
57
|
+
alias,
|
|
58
|
+
hoverValue,
|
|
59
|
+
hrefAddress,
|
|
60
|
+
content,
|
|
61
|
+
link = "",
|
|
62
|
+
isFull = false,
|
|
63
|
+
isFullNameTag = false,
|
|
64
|
+
style = {},
|
|
65
|
+
maxWidth,
|
|
66
|
+
prefix = null,
|
|
67
|
+
suffix = null,
|
|
68
|
+
type = "pow",
|
|
69
|
+
addressLabel = "",
|
|
70
|
+
ENSLabel = "",
|
|
71
|
+
nametag = "",
|
|
72
|
+
hideAliasPrefixInHover = false
|
|
73
|
+
}) => {
|
|
74
|
+
const translations = getTranslations();
|
|
75
|
+
const name = content || ENSLabel || nametag || addressLabel || alias;
|
|
76
|
+
const defaultStyle = {
|
|
77
|
+
maxWidth: `${name && isFullNameTag || isFull ? "auto" : (maxWidth || defaultPCMaxWidth) + "px"}`
|
|
78
|
+
};
|
|
79
|
+
const href = convertLink({ link, type, hrefAddress, cfxAddress });
|
|
80
|
+
const Wrapper = href ? "a" : "div";
|
|
81
|
+
const tooltipContent = {
|
|
82
|
+
ENSLabel: {
|
|
83
|
+
label: translations?.ens?.tip,
|
|
84
|
+
value: ENSLabel
|
|
85
|
+
},
|
|
86
|
+
nametag: {
|
|
87
|
+
label: translations?.nametag?.tip,
|
|
88
|
+
value: nametag
|
|
89
|
+
},
|
|
90
|
+
addressLabel: {
|
|
91
|
+
label: translations?.profile.address.myNameTag,
|
|
92
|
+
value: addressLabel
|
|
93
|
+
},
|
|
94
|
+
alias: {
|
|
95
|
+
label: translations?.profile.address.publicNameTag,
|
|
96
|
+
value: alias,
|
|
97
|
+
hideLabel: hideAliasPrefixInHover
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const checksumAddress = convertCheckSum(cfxAddress);
|
|
101
|
+
const cfxAddressLabel = typeof cfxAddress === "string" && !isFull ? shortenAddress(checksumAddress) : checksumAddress;
|
|
102
|
+
return /* @__PURE__ */ jsxs("div", { className: "inline-flex", children: [
|
|
103
|
+
prefix,
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
Text,
|
|
106
|
+
{
|
|
107
|
+
tag: "span",
|
|
108
|
+
hoverValue: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
109
|
+
renderTooltipContent(tooltipContent),
|
|
110
|
+
/* @__PURE__ */ jsx("div", { children: hoverValue || checksumAddress })
|
|
111
|
+
] }),
|
|
112
|
+
children: /* @__PURE__ */ jsx(
|
|
113
|
+
Wrapper,
|
|
114
|
+
{
|
|
115
|
+
className: "block relative align-bottom cursor-default truncate",
|
|
116
|
+
style: { ...defaultStyle, ...style },
|
|
117
|
+
...href ? { href: String(href) } : {},
|
|
118
|
+
children: name || cfxAddressLabel
|
|
119
|
+
}
|
|
120
|
+
)
|
|
121
|
+
}
|
|
122
|
+
),
|
|
123
|
+
suffix
|
|
124
|
+
] });
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export {
|
|
128
|
+
RenderAddress
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=chunk-PLU4IMEZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/AddressContainer/addressView.tsx"],"sourcesContent":["import { Translation } from 'react-i18next';\nimport { Text } from '../Text';\nimport { convertCheckSum } from '../../utils/address';\nimport { getTranslations } from '../../store';\nimport { TooltipContent, RenderAddressProps } from './types';\nimport { shortenAddress } from '@cfx-kit/dapp-utils/dist/address';\n\nconst defaultPCMaxWidth = 138;\n\n// common\nconst renderTooltipContent = (tooltipContent: TooltipContent) => {\n return Object.entries(tooltipContent)\n .map(([key, { label, value, hideLabel }]) => {\n if (value) {\n return (\n <div key={key}>\n {!hideLabel && (\n <span>\n <Translation>{t => t(label)}</Translation>\n </span>\n )}\n {value}\n </div>\n );\n }\n return null;\n })\n .filter(Boolean);\n};\n\n// common\nconst convertLink = ({\n link,\n type,\n hrefAddress,\n cfxAddress,\n}: RenderAddressProps) => {\n if (typeof link === 'string') {\n return link;\n }\n if (link === false) {\n return false;\n }\n\n const address = hrefAddress || cfxAddress;\n\n if (address && typeof address === 'string') {\n const pathname = window.location.pathname.toLowerCase();\n const addressLower = address.toLowerCase();\n if (pathname.includes('/address/' + addressLower)) {\n return false;\n }\n\n if (type === 'pow') {\n return `/address/${address}`;\n }\n\n if (type === 'pos') {\n return `/pos/accounts/${address}`;\n }\n }\n\n return false;\n};\n\n// common\nexport const RenderAddress = ({\n cfxAddress,\n alias,\n hoverValue,\n hrefAddress,\n content,\n link = '',\n isFull = false,\n isFullNameTag = false,\n style = {},\n maxWidth,\n prefix = null,\n suffix = null,\n type = 'pow',\n addressLabel = '',\n ENSLabel = '',\n nametag = '',\n hideAliasPrefixInHover = false,\n}: RenderAddressProps) => {\n const translations = getTranslations();\n\n const name = content || ENSLabel || nametag || addressLabel || alias;\n\n const defaultStyle = {\n maxWidth: `${(name && isFullNameTag) || isFull ? 'auto' : (maxWidth || defaultPCMaxWidth) + 'px'}`,\n };\n\n const href = convertLink({ link, type, hrefAddress, cfxAddress });\n\n const Wrapper = href ? 'a' : 'div';\n\n const tooltipContent: TooltipContent = {\n ENSLabel: {\n label: (translations as any)?.ens?.tip,\n value: ENSLabel,\n },\n nametag: {\n label: translations?.nametag?.tip,\n value: nametag,\n },\n addressLabel: {\n label: translations?.profile.address.myNameTag,\n value: addressLabel,\n },\n alias: {\n label: translations?.profile.address.publicNameTag,\n value: alias,\n hideLabel: hideAliasPrefixInHover,\n },\n };\n\n const checksumAddress = convertCheckSum(cfxAddress);\n\n const cfxAddressLabel =\n typeof cfxAddress === 'string' && !isFull\n ? shortenAddress(checksumAddress!)\n : checksumAddress;\n\n return (\n <div className=\"inline-flex\">\n {prefix}\n <Text\n tag=\"span\"\n hoverValue={\n <>\n {renderTooltipContent(tooltipContent)}\n <div>{hoverValue || checksumAddress}</div>\n </>\n }\n >\n <Wrapper\n className=\"block relative align-bottom cursor-default truncate\"\n style={{ ...defaultStyle, ...style }}\n {...(href ? { href: String(href) } : {})}\n >\n {name || cfxAddressLabel}\n </Wrapper>\n </Text>\n {suffix}\n </div>\n );\n};\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Tooltip
|
|
3
|
+
} from "./chunk-ZKNMJZ5R.js";
|
|
4
|
+
import {
|
|
5
|
+
getTranslations
|
|
6
|
+
} from "./chunk-DQGLZCIG.js";
|
|
7
|
+
|
|
8
|
+
// src/components/AddressContainer/label.tsx
|
|
9
|
+
import { Translation } from "react-i18next";
|
|
10
|
+
import { Bookmark, Hash } from "@zeit-ui/react-icons";
|
|
11
|
+
import ICON_ENS from "./logo-cns-7CXISC6I.svg";
|
|
12
|
+
import { jsx } from "react/jsx-runtime";
|
|
13
|
+
var getLabelInfo = (label, type) => {
|
|
14
|
+
const translations = getTranslations();
|
|
15
|
+
if (label) {
|
|
16
|
+
let trans = "";
|
|
17
|
+
let icon = null;
|
|
18
|
+
if (type === "tag") {
|
|
19
|
+
trans = translations.profile.tip.label;
|
|
20
|
+
icon = /* @__PURE__ */ jsx(Bookmark, { color: "var(--theme-color-gray2)", size: 16 });
|
|
21
|
+
} else if (type === "ens") {
|
|
22
|
+
trans = translations.ens.label;
|
|
23
|
+
icon = /* @__PURE__ */ jsx(
|
|
24
|
+
"img",
|
|
25
|
+
{
|
|
26
|
+
src: ICON_ENS,
|
|
27
|
+
className: "w-[16px] h-[16px] mb-[3px] mr-[2px]",
|
|
28
|
+
alt: ""
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
} else if (type === "nametag") {
|
|
32
|
+
trans = translations.nametag.label;
|
|
33
|
+
icon = /* @__PURE__ */ jsx(Hash, { color: "var(--theme-color-gray2)", size: 16 });
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
label,
|
|
37
|
+
icon: /* @__PURE__ */ jsx("span", { className: "mr-[2px]", children: /* @__PURE__ */ jsx(Tooltip, { title: /* @__PURE__ */ jsx(Translation, { children: (t) => t(trans) }), children: icon }) })
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
label: "",
|
|
42
|
+
icon: null
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
getLabelInfo
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=chunk-RB2U3Y7F.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/AddressContainer/label.tsx"],"sourcesContent":["import { Translation } from 'react-i18next';\nimport { Bookmark, Hash } from '@zeit-ui/react-icons';\nimport { Tooltip } from '../Tooltip';\nimport { getTranslations } from '../../store';\nimport ICON_ENS from '../../images/logo-cns.svg';\n\nexport const getLabelInfo = (label: string, type: string) => {\n const translations = getTranslations();\n if (label) {\n let trans: string = '';\n let icon: React.ReactNode = null;\n\n if (type === 'tag') {\n trans = translations.profile.tip.label;\n icon = <Bookmark color=\"var(--theme-color-gray2)\" size={16} />;\n } else if (type === 'ens') {\n trans = (translations as any).ens.label;\n icon = (\n <img\n src={ICON_ENS}\n className=\"w-[16px] h-[16px] mb-[3px] mr-[2px]\"\n alt=\"\"\n />\n );\n // nametag from official operational staff\n } else if (type === 'nametag') {\n trans = translations.nametag.label;\n icon = <Hash color=\"var(--theme-color-gray2)\" size={16} />;\n }\n\n return {\n label,\n icon: (\n <span className=\"mr-[2px]\">\n <Tooltip title={<Translation>{t => t(trans)}</Translation>}>\n {icon}\n </Tooltip>\n </span>\n ),\n };\n }\n\n return {\n label: '',\n icon: null,\n };\n};\n"],"mappings":";;;;;;;;AAAA,SAAS,mBAAmB;AAC5B,SAAS,UAAU,YAAY;AAG/B,OAAO,cAAc;AAUR;AARN,IAAM,eAAe,CAAC,OAAe,SAAiB;AAC3D,QAAM,eAAe,gBAAgB;AACrC,MAAI,OAAO;AACT,QAAI,QAAgB;AACpB,QAAI,OAAwB;AAE5B,QAAI,SAAS,OAAO;AAClB,cAAQ,aAAa,QAAQ,IAAI;AACjC,aAAO,oBAAC,YAAS,OAAM,4BAA2B,MAAM,IAAI;AAAA,IAC9D,WAAW,SAAS,OAAO;AACzB,cAAS,aAAqB,IAAI;AAClC,aACE;AAAA,QAAC;AAAA;AAAA,UACC,KAAK;AAAA,UACL,WAAU;AAAA,UACV,KAAI;AAAA;AAAA,MACN;AAAA,IAGJ,WAAW,SAAS,WAAW;AAC7B,cAAQ,aAAa,QAAQ;AAC7B,aAAO,oBAAC,QAAK,OAAM,4BAA2B,MAAM,IAAI;AAAA,IAC1D;AAEA,WAAO;AAAA,MACL;AAAA,MACA,MACE,oBAAC,UAAK,WAAU,YACd,8BAAC,WAAQ,OAAO,oBAAC,eAAa,iBAAK,EAAE,KAAK,GAAE,GACzC,gBACH,GACF;AAAA,IAEJ;AAAA,EACF;AAEA,SAAO;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AACF;","names":[]}
|