@rabbitio/ui-kit 1.0.0-beta.83 → 1.0.0-beta.84
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/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +15674 -0
- package/coverage/coverage-final.json +112 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +986 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/rabbit-ui-kit/index.html +116 -0
- package/coverage/rabbit-ui-kit/index.js.html +88 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/googleAnalyticsAdapter.js.html +148 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/analyticsAdapters/mixpanelAdapter.js.html +199 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/axiosAdapter.js.html +190 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common-apis/adapters/qrUtils.js.html +139 -0
- package/coverage/rabbit-ui-kit/src/common-apis/amountUtils.js.html +1162 -0
- package/coverage/rabbit-ui-kit/src/common-apis/errorUtils.js.html +211 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/apiGroups.js.html +250 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common-apis/external-apis/ipAddressProviders.js.html +352 -0
- package/coverage/rabbit-ui-kit/src/common-apis/fiatCurrenciesService.js.html +544 -0
- package/coverage/rabbit-ui-kit/src/common-apis/globalConstants.jsx.html +94 -0
- package/coverage/rabbit-ui-kit/src/common-apis/index.html +161 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/blockchain.js.html +115 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/coin.js.html +544 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/common-apis/models/protocol.js.html +100 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/cache.js.html +811 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/emailAPI.js.html +133 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/index.html +161 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/index.html +131 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/logger.js.html +208 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/logging/logsStorage.js.html +268 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/postponeExecution.js.html +118 -0
- package/coverage/rabbit-ui-kit/src/common-apis/utils/safeStringify.js.html +235 -0
- package/coverage/rabbit-ui-kit/src/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/index.js.html +358 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cacheAndConcurrentRequestsResolver.js.html +1570 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cachedRobustExternalApiCallerService.js.html +526 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/cancelProcessing.js.html +172 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/concurrentCalculationsMetadataHolder.js.html +310 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/externalApiProvider.js.html +553 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/externalServicesStatsCollector.js.html +319 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/index.html +206 -0
- package/coverage/rabbit-ui-kit/src/robust-api-caller/robustExternalAPICallerService.js.html +997 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/letsExchangeSwapProvider.js.html +1543 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapProvider.js.html +1705 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/external-apis/swapspaceSwapProvider.js.html +1801 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/baseSwapCreationInfo.js.html +223 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwap.js.html +304 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/existingSwapWithFiatData.js.html +469 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/index.html +176 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/partner.js.html +106 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/models/swapProviderCoinInfo.js.html +193 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/services/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/services/publicSwapService.js.html +2161 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/utils/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/swaps-lib/utils/swapUtils.js.html +670 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowIcon.jsx.html +124 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowTosca.jsx.html +127 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/arrowWhite.jsx.html +127 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/darkRectangle.jsx.html +106 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/determinedError.jsx.html +439 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/failedValidationIcon.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/index.html +281 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/infoIcon.jsx.html +133 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/messageIcon.jsx.html +346 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/noticeQuestionIcon.jsx.html +247 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/successfulValidationIcon.jsx.html +163 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx.html +268 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/assets/wrappedImages/walletIcon.jsx.html +151 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/AssetIcon.jsx.html +256 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/AssetSelection.jsx.html +289 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/AssetSelection/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/BackgroundTitle.jsx.html +187 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/BackgroundTitle/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/InformationMessage.jsx.html +238 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/InformationMessage/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/Input.jsx.html +634 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Input/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/LoadingDots.jsx.html +196 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/LoadingDots/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/NoticeIcon.jsx.html +277 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/NoticeIcon/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/QrCode.jsx.html +217 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/QrCode/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx.html +175 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/RateSelector/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/SupportChat.jsx.html +217 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/SupportChat/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/Textarea.jsx.html +529 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Textarea/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/TitleBox.jsx.html +508 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TitleBox/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/Tooltip.jsx.html +316 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Tooltip/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/LinesOfText.jsx.html +313 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/TwoLinesOfText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/Validation.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/Validation/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/Button.jsx.html +712 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Button/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/Close.jsx.html +259 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/Close/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/LinkButton.jsx.html +421 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/LinkButton/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/RadioButtonWithText.jsx.html +415 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/atoms/buttons/RadioButtonWithText/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx.html +1087 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/AmountInput/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx.html +1474 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/CoinPicker/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx.html +211 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/ColoredNotice/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/LineWithIconLink.jsx.html +190 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx.html +196 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/LogoCarousel/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx.html +496 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/SearchableCoinsList/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/TitledLineWithIconLink.jsx.html +181 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/molecules/TitledLineWithIconLink/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/CoinPickerDialogStep.jsx.html +283 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/CoinPickerDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/Dialog.jsx.html +1567 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx.html +481 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx.html +1747 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/Dialog/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx.html +4168 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/SwapForm/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx.html +559 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/organisms/WaitlistSubscription/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/DeterminedErrorDialogStep.jsx.html +316 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/components/templates/DeterminedErrorDialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/index.html +146 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useCallHandlingErrors.js.html +151 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useIsHydrated.js.html +121 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/hooks/useReferredState.js.html +157 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/index.html +161 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/inputValueProviders.js.html +235 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/textUtils.js.html +139 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/uiUtils.js.html +121 -0
- package/coverage/rabbit-ui-kit/src/ui-kit/utils/urlQueryUtils.js.html +271 -0
- package/coverage/rabbit-ui-kit/stories/atoms/BackgroundTitle.stories.jsx.html +202 -0
- package/coverage/rabbit-ui-kit/stories/atoms/LinesOfText.stories.jsx.html +283 -0
- package/coverage/rabbit-ui-kit/stories/atoms/LoadingDots.stories.jsx.html +226 -0
- package/coverage/rabbit-ui-kit/stories/atoms/QrCode.stories.jsx.html +175 -0
- package/coverage/rabbit-ui-kit/stories/atoms/RateSelector.stories.jsx.html +136 -0
- package/coverage/rabbit-ui-kit/stories/atoms/Validation.stories.jsx.html +178 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/Button.stories.jsx.html +883 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/Close.stories.jsx.html +211 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/LinkButton.stories.jsx.html +301 -0
- package/coverage/rabbit-ui-kit/stories/atoms/buttons/index.html +146 -0
- package/coverage/rabbit-ui-kit/stories/atoms/index.html +191 -0
- package/coverage/rabbit-ui-kit/stories/molecules/CoinPicker.stories.jsx.html +271 -0
- package/coverage/rabbit-ui-kit/stories/molecules/ColoredNotice.stories.jsx.html +178 -0
- package/coverage/rabbit-ui-kit/stories/molecules/LineWithIconLink.stories.jsx.html +154 -0
- package/coverage/rabbit-ui-kit/stories/molecules/LogoCarousel.stories.jsx.html +160 -0
- package/coverage/rabbit-ui-kit/stories/molecules/TitledLineWithIconLink.stories.jsx.html +160 -0
- package/coverage/rabbit-ui-kit/stories/molecules/index.html +176 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/Dialog.stories.jsx.html +523 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/DialogButtons.stories.jsx.html +328 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogButtons/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/DialogStep.stories.jsx.html +337 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/DialogStep/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/Dialog/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/organisms/WaitlistSubscription.stories.jsx.html +151 -0
- package/coverage/rabbit-ui-kit/stories/organisms/index.html +116 -0
- package/coverage/rabbit-ui-kit/stories/stubs/coins.jsx.html +6880 -0
- package/coverage/rabbit-ui-kit/stories/stubs/exampleContent.jsx.html +145 -0
- package/coverage/rabbit-ui-kit/stories/stubs/index.html +131 -0
- package/coverage/rabbit-ui-kit/stories/templates/DeterminedErrorDialogStep.stories.jsx.html +190 -0
- package/coverage/rabbit-ui-kit/stories/templates/index.html +116 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +196 -0
- package/dist/global.css.map +1 -1
- package/dist/index.cjs +1107 -494
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +93 -0
- package/dist/index.css.map +1 -1
- package/dist/index.modern.js +926 -418
- package/dist/index.modern.js.map +1 -1
- package/dist/index.module.js +1104 -495
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +1107 -494
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/index.js +4 -0
- package/src/swaps-lib/external-apis/letsExchangeSwapProvider.js +11 -0
- package/src/swaps-lib/external-apis/swapProvider.js +8 -0
- package/src/swaps-lib/external-apis/swapspaceSwapProvider.js +20 -1
- package/src/swaps-lib/models/partner.js +7 -0
- package/src/swaps-lib/services/publicSwapService.js +17 -0
- package/src/ui-kit/assets/styles/global.scss +4 -7
- package/src/ui-kit/assets/wrappedImages/messageIcon.jsx +87 -0
- package/src/ui-kit/assets/wrappedImages/supportDialogImage.jsx +61 -0
- package/src/ui-kit/components/atoms/RateSelector/RateSelector.jsx +2 -2
- package/src/ui-kit/components/atoms/Validation/Validation.jsx +7 -9
- package/src/ui-kit/components/atoms/Validation/validation.module.scss +4 -0
- package/src/ui-kit/components/molecules/AmountInput/AmountInput.jsx +57 -48
- package/src/ui-kit/components/molecules/AmountInput/amount-input.module.scss +33 -0
- package/src/ui-kit/components/molecules/CoinPicker/CoinPicker.jsx +84 -132
- package/src/ui-kit/components/molecules/ColoredNotice/ColoredNotice.jsx +42 -0
- package/src/ui-kit/components/molecules/ColoredNotice/colored-notice.module.scss +20 -0
- package/src/ui-kit/components/molecules/LogoCarousel/LogoCarousel.jsx +37 -0
- package/src/ui-kit/components/molecules/LogoCarousel/logo-carousel.module.scss +64 -0
- package/src/ui-kit/components/molecules/SearchableCoinsList/SearchableCoinsList.jsx +137 -0
- package/src/ui-kit/components/organisms/Dialog/DialogButtons/DialogButtons.jsx +10 -0
- package/src/ui-kit/components/organisms/Dialog/DialogStep/DialogStep.jsx +16 -0
- package/src/ui-kit/components/organisms/SwapForm/SwapForm.jsx +35 -12
- package/src/ui-kit/components/organisms/WaitlistSubscription/WaitlistSubscription.jsx +158 -0
|
@@ -15,6 +15,7 @@ import { FALLBACK_ASSET_ICON_URL } from "../../../../common-apis/globalConstants
|
|
|
15
15
|
import { AssetIcon } from "../../atoms/AssetIcon/AssetIcon.jsx";
|
|
16
16
|
import { Button } from "../../atoms/buttons/Button/Button.jsx";
|
|
17
17
|
import { LoadingDots } from "../../atoms/LoadingDots/LoadingDots.jsx";
|
|
18
|
+
import { SearchableCoinsList } from "../SearchableCoinsList/SearchableCoinsList.jsx";
|
|
18
19
|
|
|
19
20
|
export const COIN_PICKER_MODES = {
|
|
20
21
|
BUTTON: "BUTTON",
|
|
@@ -92,7 +93,6 @@ export const CoinPicker = ({
|
|
|
92
93
|
const handleError = useCallHandlingErrors();
|
|
93
94
|
|
|
94
95
|
const [coins, setCoins] = useState(null);
|
|
95
|
-
const [filteredCoins, setFilteredCoins] = useState([]);
|
|
96
96
|
const [initiallyEnabledCoins, setInitiallyEnabledCoins] = useReferredState({});
|
|
97
97
|
const [currentlyEnabledCoins, setCurrentlyEnabledCoins] = useReferredState({});
|
|
98
98
|
const [searchFieldValue, setSearchFieldValue] = useState("");
|
|
@@ -102,9 +102,9 @@ export const CoinPicker = ({
|
|
|
102
102
|
const [coinsContent, setCoinsContent] = useState(null);
|
|
103
103
|
const [isCoinsDataReloadable, setIsCoinsDataReloadable] = useState(false);
|
|
104
104
|
|
|
105
|
-
const [limitedCoinsNumber, setLimitedCoinsNumber] = useState(0);
|
|
106
|
-
const [displayedCoins, setDisplayedCoins] = useState([]);
|
|
107
105
|
const [isListFull, setIsListFull] = useState(true);
|
|
106
|
+
const [isSearchResultEmpty, setIsSearchResultEmpty] = useState(false);
|
|
107
|
+
const [triggerLoadMoreCoins, setTriggerLoadMoreCoins] = useState(0);
|
|
108
108
|
|
|
109
109
|
const searchRef = useRef();
|
|
110
110
|
const scrollContainerRef = useRef();
|
|
@@ -158,58 +158,11 @@ export const CoinPicker = ({
|
|
|
158
158
|
handleClick(coin.ticker);
|
|
159
159
|
};
|
|
160
160
|
|
|
161
|
-
const handleSearchAsset = value => {
|
|
162
|
-
// TODO: [refactoring, high] use unified search function. task_id=be0475316f374dd4a926c948d969e704
|
|
163
|
-
setSearchFieldValue(value); // Trim the input to handle leading/trailing spaces
|
|
164
|
-
const searchTerm = value.trim().toLowerCase();
|
|
165
|
-
if (searchTerm !== "") {
|
|
166
|
-
const searchWords = searchTerm.split(/\s+/); // Split search terms on whitespace
|
|
167
|
-
|
|
168
|
-
const filteredAndSortedCoins = coins
|
|
169
|
-
.filter(coin => {
|
|
170
|
-
// Check if all search words are found in any of the given properties
|
|
171
|
-
return searchWords.every(
|
|
172
|
-
word =>
|
|
173
|
-
coin?.latinName?.toLowerCase().includes(word) ||
|
|
174
|
-
coin?.ticker?.toLowerCase().includes(word) ||
|
|
175
|
-
coin?.tickerPrintable?.toLowerCase().includes(word)
|
|
176
|
-
);
|
|
177
|
-
})
|
|
178
|
-
.sort((a, b) => {
|
|
179
|
-
// Check for exact matches
|
|
180
|
-
const aMatch =
|
|
181
|
-
a.latinName.toLowerCase() === searchTerm ||
|
|
182
|
-
a.ticker.toLowerCase() === searchTerm ||
|
|
183
|
-
a.tickerPrintable.toLowerCase() === searchTerm
|
|
184
|
-
? 1
|
|
185
|
-
: 0;
|
|
186
|
-
const bMatch =
|
|
187
|
-
b.latinName.toLowerCase() === searchTerm ||
|
|
188
|
-
b.ticker.toLowerCase() === searchTerm ||
|
|
189
|
-
b.tickerPrintable.toLowerCase() === searchTerm
|
|
190
|
-
? 1
|
|
191
|
-
: 0;
|
|
192
|
-
if (bMatch - aMatch !== 0) {
|
|
193
|
-
// Prioritize exact matches to the top
|
|
194
|
-
return bMatch - aMatch;
|
|
195
|
-
} else {
|
|
196
|
-
// Sort remaining items alphabetically by latinName
|
|
197
|
-
return a.latinName.toLowerCase().localeCompare(b.latinName.toLowerCase());
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
setFilteredCoins(filteredAndSortedCoins);
|
|
202
|
-
} else {
|
|
203
|
-
setFilteredCoins(coins); // Reset to original list if search term is empty
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
|
|
207
161
|
const loadCoinsAndSaveToState = () => {
|
|
208
162
|
(async () => {
|
|
209
163
|
try {
|
|
210
164
|
const data = loadCoinsAndContent ? await loadCoinsAndContent() : await defaultLoadCoinsAndContent();
|
|
211
165
|
setCoins(data.coins);
|
|
212
|
-
setFilteredCoins(data.coins);
|
|
213
166
|
setCoinsContent(data.content);
|
|
214
167
|
setIsCoinsDataReloadable(!!data.isCoinsDataReloadable);
|
|
215
168
|
} catch (e) {
|
|
@@ -256,30 +209,6 @@ export const CoinPicker = ({
|
|
|
256
209
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
257
210
|
}, [search, searchAdaptive, coins]);
|
|
258
211
|
|
|
259
|
-
useEffect(() => {
|
|
260
|
-
if (filteredCoins?.length > partialLoadingIncrement && partialLoadingEnabled) {
|
|
261
|
-
setLimitedCoinsNumber(partialLoadingIncrement);
|
|
262
|
-
} else {
|
|
263
|
-
setLimitedCoinsNumber(0);
|
|
264
|
-
setDisplayedCoins(filteredCoins);
|
|
265
|
-
setIsListFull(true);
|
|
266
|
-
}
|
|
267
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
268
|
-
}, [filteredCoins]);
|
|
269
|
-
|
|
270
|
-
useEffect(() => {
|
|
271
|
-
if (limitedCoinsNumber > 0) {
|
|
272
|
-
const coinsToDisplay = filteredCoins.slice(0, limitedCoinsNumber);
|
|
273
|
-
setDisplayedCoins(coinsToDisplay);
|
|
274
|
-
setIsListFull(coinsToDisplay.length === filteredCoins.length);
|
|
275
|
-
}
|
|
276
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
277
|
-
}, [limitedCoinsNumber]);
|
|
278
|
-
|
|
279
|
-
const displayMoreCoins = () => {
|
|
280
|
-
setLimitedCoinsNumber(prev => prev + partialLoadingIncrement);
|
|
281
|
-
};
|
|
282
|
-
|
|
283
212
|
const skeleton = () => {
|
|
284
213
|
let skeletonItems = [];
|
|
285
214
|
for (let i = 0; i < skeletonItemsCount; i++) {
|
|
@@ -317,11 +246,10 @@ export const CoinPicker = ({
|
|
|
317
246
|
setScrollWrapperClass(s["reached-bottom"]);
|
|
318
247
|
};
|
|
319
248
|
|
|
320
|
-
|
|
321
|
-
useEffect(handleScroll, []);
|
|
249
|
+
const displayMoreCoins = () => setTriggerLoadMoreCoins(prev => prev + 1);
|
|
322
250
|
|
|
323
251
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
324
|
-
useEffect(handleScroll, [
|
|
252
|
+
useEffect(handleScroll, []);
|
|
325
253
|
|
|
326
254
|
const shouldShowSkeleton = coins == null;
|
|
327
255
|
|
|
@@ -332,7 +260,10 @@ export const CoinPicker = ({
|
|
|
332
260
|
<div className={s["coin-picker-search"]}>
|
|
333
261
|
<Input
|
|
334
262
|
value={searchFieldValue}
|
|
335
|
-
onChange={e =>
|
|
263
|
+
onChange={e => {
|
|
264
|
+
setSearchFieldValue(e.target.value);
|
|
265
|
+
handleScroll();
|
|
266
|
+
}}
|
|
336
267
|
placeholder={texts.searchPlaceholder}
|
|
337
268
|
isSmallHeight={true}
|
|
338
269
|
clearButton
|
|
@@ -357,61 +288,82 @@ export const CoinPicker = ({
|
|
|
357
288
|
onScroll={handleScroll}
|
|
358
289
|
>
|
|
359
290
|
<div className={s["coin-picker-wrapper-content-assets"]}>
|
|
360
|
-
{shouldShowSkeleton
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
291
|
+
{shouldShowSkeleton ? (
|
|
292
|
+
skeleton()
|
|
293
|
+
) : (
|
|
294
|
+
<SearchableCoinsList
|
|
295
|
+
searchQuery={searchFieldValue}
|
|
296
|
+
onListUpdated={() => handleScroll()}
|
|
297
|
+
setIsListFull={setIsListFull}
|
|
298
|
+
setIsSearchResultEmpty={setIsSearchResultEmpty}
|
|
299
|
+
triggerLoadMoreCoins={triggerLoadMoreCoins}
|
|
300
|
+
coinsList={allCoins}
|
|
301
|
+
coinsBundle={allCoins.map((coin, index) => {
|
|
302
|
+
return {
|
|
303
|
+
coin: coin,
|
|
304
|
+
component: () => {
|
|
305
|
+
const { assetIconSrc, assetIconProtocolSrc } = coinToIconPaths(coin);
|
|
306
|
+
|
|
307
|
+
return (
|
|
308
|
+
<div
|
|
309
|
+
className={s["item"]}
|
|
310
|
+
key={`picker-${coin.ticker}-${index}`}
|
|
311
|
+
onClick={e => handleError(() => handleCoinClick(coin), e)}
|
|
312
|
+
>
|
|
313
|
+
<div
|
|
314
|
+
className={
|
|
315
|
+
s["link"] +
|
|
316
|
+
(currentlyEnabledCoins.current[coin.ticker] !==
|
|
317
|
+
initiallyEnabledCoins.current[coin.ticker]
|
|
318
|
+
? " " + s["outline"]
|
|
319
|
+
: "")
|
|
320
|
+
}
|
|
321
|
+
>
|
|
322
|
+
<AssetIcon
|
|
323
|
+
assetIconSrc={assetIconSrc}
|
|
324
|
+
assetIconProtocolSrc={assetIconProtocolSrc}
|
|
325
|
+
fallbackSrc={FALLBACK_ASSET_ICON_URL}
|
|
326
|
+
/>
|
|
327
|
+
<div className={s["content"]} key={coin.ticker}>
|
|
328
|
+
<p className={s["name"]}>{coin.latinName}</p>
|
|
329
|
+
<p className={s["amount"]}>
|
|
330
|
+
{coinsContent?.find(i => i.coin === coin)
|
|
331
|
+
?.subtitle ?? ""}
|
|
332
|
+
</p>
|
|
333
|
+
</div>
|
|
334
|
+
{mode === COIN_PICKER_MODES.BUTTON ? (
|
|
335
|
+
<div className={s["arrow"]}>
|
|
336
|
+
<ArrowIcon />
|
|
337
|
+
</div>
|
|
338
|
+
) : mode === COIN_PICKER_MODES.CHECKBOX ? (
|
|
339
|
+
<div className={s["toggle-container"]}>
|
|
340
|
+
<RadioButtonWithText
|
|
341
|
+
onStateChange={resetButtonLoader =>
|
|
342
|
+
handleToggleClick(
|
|
343
|
+
coin.ticker,
|
|
344
|
+
resetButtonLoader
|
|
345
|
+
)
|
|
346
|
+
}
|
|
347
|
+
isSwitchedOn={
|
|
348
|
+
currentlyEnabledCoins.current[coin.ticker]
|
|
349
|
+
}
|
|
350
|
+
id={index}
|
|
351
|
+
/>
|
|
352
|
+
</div>
|
|
353
|
+
) : (
|
|
354
|
+
""
|
|
355
|
+
)}
|
|
356
|
+
</div>
|
|
357
|
+
</div>
|
|
358
|
+
);
|
|
359
|
+
},
|
|
360
|
+
};
|
|
361
|
+
})}
|
|
362
|
+
/>
|
|
363
|
+
)}
|
|
412
364
|
</div>
|
|
413
365
|
|
|
414
|
-
{
|
|
366
|
+
{isSearchResultEmpty ? (
|
|
415
367
|
<div className={s["coin-picker-wrapper-content-asset-not-found"]}>
|
|
416
368
|
<h6>{texts.noAssetsMessage}</h6>
|
|
417
369
|
</div>
|
|
@@ -425,7 +377,7 @@ export const CoinPicker = ({
|
|
|
425
377
|
size="sm"
|
|
426
378
|
loader={false}
|
|
427
379
|
content={texts.loadMoreButton}
|
|
428
|
-
onClick={displayMoreCoins}
|
|
380
|
+
onClick={() => displayMoreCoins()}
|
|
429
381
|
handleError={handleError}
|
|
430
382
|
/>
|
|
431
383
|
</div>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import s from "./colored-notice.module.scss";
|
|
5
|
+
|
|
6
|
+
import { Button } from "../../atoms/buttons/Button/Button";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ColoredNotice component displays a notice with optional text and a button.
|
|
10
|
+
*
|
|
11
|
+
* @component
|
|
12
|
+
* @param {Object} props - The component props.
|
|
13
|
+
* @param {string} [props.text] - The text to be displayed in the notice.
|
|
14
|
+
* @param {string} [props.buttonTitle] - The title of the button.
|
|
15
|
+
* @param {function} [props.onButtonClick] - Callback function to be called when the button is clicked.
|
|
16
|
+
* @returns {JSX.Element} The ColoredNotice component.
|
|
17
|
+
*/
|
|
18
|
+
export const ColoredNotice = ({
|
|
19
|
+
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor.",
|
|
20
|
+
buttonTitle,
|
|
21
|
+
onButtonClick = () => {},
|
|
22
|
+
}) => {
|
|
23
|
+
return (
|
|
24
|
+
<div className={s["colored-notice"]}>
|
|
25
|
+
<p className={s["colored-notice-text"]}>{text}</p>
|
|
26
|
+
{buttonTitle ? (
|
|
27
|
+
<Button mode="primary" size="sm" content={buttonTitle} loader={false} onClick={onButtonClick} />
|
|
28
|
+
) : null}
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
ColoredNotice.propTypes = {
|
|
34
|
+
text: PropTypes.string,
|
|
35
|
+
buttonTitle: PropTypes.string,
|
|
36
|
+
onButtonClick: PropTypes.func,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
ColoredNotice.defaultProps = {
|
|
40
|
+
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor.",
|
|
41
|
+
onButtonClick: () => {},
|
|
42
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
@use "../../../assets/styles/index" as *;
|
|
2
|
+
|
|
3
|
+
.colored-notice {
|
|
4
|
+
display: flex;
|
|
5
|
+
align-items: flex-start;
|
|
6
|
+
flex-direction: column;
|
|
7
|
+
gap: Margin("3");
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
padding: Padding("5");
|
|
10
|
+
border-radius: $borderRadius;
|
|
11
|
+
background-color: LightColor(army-20);
|
|
12
|
+
width: 100%;
|
|
13
|
+
box-shadow: 0px 0px 0px 1px rgba(SolidColor("army"), 0.1) inset;
|
|
14
|
+
|
|
15
|
+
&-text {
|
|
16
|
+
color: SolidColor("tosca");
|
|
17
|
+
margin: 0;
|
|
18
|
+
text-align: left;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import PropTypes from "prop-types";
|
|
3
|
+
|
|
4
|
+
import s from "./logo-carousel.module.scss";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* LogoCarousel component renders a set of logos in a sliding carousel.
|
|
8
|
+
*
|
|
9
|
+
* @component
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} props - The props object for this component.
|
|
12
|
+
* @param {Array<{logo: string, url: string}>} props.logos - Array of objects representing logos and their corresponding URLs.
|
|
13
|
+
*/
|
|
14
|
+
export const LogoCarousel = ({ logos }) => {
|
|
15
|
+
return (
|
|
16
|
+
<div className={s["logo-carousel"]}>
|
|
17
|
+
{[...Array(2)].map((z, i) => (
|
|
18
|
+
<div className={s["logo-carousel-slide"]} key={"logo-carousel-slide-" + i}>
|
|
19
|
+
{logos.map((item, index) => (
|
|
20
|
+
<a key={"logo-carousel-slide-" + i + "-" + index} href={item.url} target="_blank">
|
|
21
|
+
<img src={item.logo} alt="logo" />
|
|
22
|
+
</a>
|
|
23
|
+
))}
|
|
24
|
+
</div>
|
|
25
|
+
))}
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
LogoCarousel.propTypes = {
|
|
31
|
+
logos: PropTypes.arrayOf(
|
|
32
|
+
PropTypes.shape({
|
|
33
|
+
logo: PropTypes.string.isRequired,
|
|
34
|
+
url: PropTypes.string.isRequired,
|
|
35
|
+
})
|
|
36
|
+
).isRequired,
|
|
37
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
@use "../../../assets/styles/index" as *;
|
|
2
|
+
|
|
3
|
+
@keyframes slide {
|
|
4
|
+
from {
|
|
5
|
+
transform: translateX(0);
|
|
6
|
+
}
|
|
7
|
+
to {
|
|
8
|
+
transform: translateX(-100%);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.logo-carousel {
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
white-space: nowrap;
|
|
15
|
+
position: relative;
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
justify-content: flex-start;
|
|
19
|
+
width: 100%;
|
|
20
|
+
gap: clamp(30px, 5vw, 40px);
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
mask-image: linear-gradient(
|
|
23
|
+
90deg,
|
|
24
|
+
rgba(0, 0, 0, 0) 0%,
|
|
25
|
+
rgba(0, 0, 0, 1) 60px,
|
|
26
|
+
rgba(0, 0, 0, 1) calc(100% - 60px),
|
|
27
|
+
rgba(0, 0, 0, 0) 100%
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
&:hover &-slide {
|
|
31
|
+
animation-play-state: paused;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&-slide {
|
|
35
|
+
display: inline-block;
|
|
36
|
+
animation: 25s slide infinite linear;
|
|
37
|
+
display: inherit;
|
|
38
|
+
align-items: inherit;
|
|
39
|
+
justify-content: inherit;
|
|
40
|
+
gap: inherit;
|
|
41
|
+
|
|
42
|
+
a {
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
transition: 0.1s $transitionEaseOut;
|
|
46
|
+
transform: scale(1);
|
|
47
|
+
|
|
48
|
+
@media (hover: hover) {
|
|
49
|
+
&:hover {
|
|
50
|
+
transform: scale(1.02);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
&:active {
|
|
55
|
+
transition: 0.02s $transitionEaseOut;
|
|
56
|
+
transform: scale(0.99);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
img {
|
|
60
|
+
height: clamp(30px, 5vw, 35px);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
import { useReferredState } from "../../../hooks/useReferredState";
|
|
3
|
+
import PropTypes from "prop-types";
|
|
4
|
+
import { Coin } from "../../../../common-apis/models/coin";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A component that displays a list of coins that can be searched and filtered.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object} props - The properties object.
|
|
10
|
+
* @param {Coin[]} props.coinsList - The list of all available coins.
|
|
11
|
+
* @param {Array<{coin: Coin, component: React.Component}>} props.coinsBundle - The bundle of coin components to be displayed.
|
|
12
|
+
* @param {string} props.searchQuery - The search query to filter coins.
|
|
13
|
+
* @param {boolean} props.partialLoadingEnabled - Determines if partial loading is enabled.
|
|
14
|
+
* @param {number} props.partialLoadingIncrement - The increment of coins to load when loading more.
|
|
15
|
+
* @param {Function} props.onListUpdated - Callback when the list of displayed coins is updated.
|
|
16
|
+
* @param {Function} props.setIsListFull - Callback to set if the list is fully displayed.
|
|
17
|
+
* @param {Function} props.setIsSearchResultEmpty - Callback to set if the search result is empty.
|
|
18
|
+
* @param {number} props.triggerLoadMoreCoins - Triggers loading more coins.
|
|
19
|
+
*/
|
|
20
|
+
export const SearchableCoinsList = ({
|
|
21
|
+
coinsList,
|
|
22
|
+
coinsBundle,
|
|
23
|
+
searchQuery,
|
|
24
|
+
partialLoadingEnabled = true,
|
|
25
|
+
partialLoadingIncrement = 100,
|
|
26
|
+
onListUpdated = () => {},
|
|
27
|
+
setIsListFull = () => {},
|
|
28
|
+
setIsSearchResultEmpty = () => {},
|
|
29
|
+
triggerLoadMoreCoins,
|
|
30
|
+
}) => {
|
|
31
|
+
const [filteredCoins, setFilteredCoins] = useState([]);
|
|
32
|
+
const [limitedCoinsNumber, setLimitedCoinsNumber] = useReferredState(0);
|
|
33
|
+
const [displayedCoins, setDisplayedCoins] = useState([]);
|
|
34
|
+
|
|
35
|
+
const handleSearchAsset = value => {
|
|
36
|
+
const searchTerm = value.trim().toLowerCase();
|
|
37
|
+
if (searchTerm !== "") {
|
|
38
|
+
const searchWords = searchTerm.split(/\s+/); // Split search terms on whitespace
|
|
39
|
+
|
|
40
|
+
const filteredAndSortedCoins = coinsList
|
|
41
|
+
.filter(coin => {
|
|
42
|
+
// Check if all search words are found in any of the given properties
|
|
43
|
+
return searchWords.every(
|
|
44
|
+
word =>
|
|
45
|
+
coin?.latinName?.toLowerCase().includes(word) ||
|
|
46
|
+
coin?.ticker?.toLowerCase().includes(word) ||
|
|
47
|
+
coin?.tickerPrintable?.toLowerCase().includes(word)
|
|
48
|
+
);
|
|
49
|
+
})
|
|
50
|
+
.sort((a, b) => {
|
|
51
|
+
// Check for exact matches
|
|
52
|
+
const aMatch =
|
|
53
|
+
a.latinName.toLowerCase() === searchTerm ||
|
|
54
|
+
a.ticker.toLowerCase() === searchTerm ||
|
|
55
|
+
a.tickerPrintable.toLowerCase() === searchTerm
|
|
56
|
+
? 1
|
|
57
|
+
: 0;
|
|
58
|
+
const bMatch =
|
|
59
|
+
b.latinName.toLowerCase() === searchTerm ||
|
|
60
|
+
b.ticker.toLowerCase() === searchTerm ||
|
|
61
|
+
b.tickerPrintable.toLowerCase() === searchTerm
|
|
62
|
+
? 1
|
|
63
|
+
: 0;
|
|
64
|
+
if (bMatch - aMatch !== 0) {
|
|
65
|
+
// Prioritize exact matches to the top
|
|
66
|
+
return bMatch - aMatch;
|
|
67
|
+
} else {
|
|
68
|
+
// Sort remaining items alphabetically by latinName
|
|
69
|
+
return a.latinName.toLowerCase().localeCompare(b.latinName.toLowerCase());
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
setFilteredCoins(filteredAndSortedCoins);
|
|
74
|
+
} else {
|
|
75
|
+
setFilteredCoins(coinsList); // Reset to original list if search term is empty
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const updateDisplayedCoins = () => {
|
|
80
|
+
const fullList = limitedCoinsNumber.current >= filteredCoins.length;
|
|
81
|
+
setDisplayedCoins(fullList ? filteredCoins : filteredCoins.slice(0, limitedCoinsNumber.current));
|
|
82
|
+
setIsListFull(fullList);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const displayMoreCoins = () => {
|
|
86
|
+
setLimitedCoinsNumber(prev => prev + partialLoadingIncrement);
|
|
87
|
+
updateDisplayedCoins();
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
91
|
+
useEffect(() => onListUpdated(), [displayedCoins]);
|
|
92
|
+
|
|
93
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
94
|
+
useEffect(() => displayMoreCoins(), [triggerLoadMoreCoins]);
|
|
95
|
+
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (filteredCoins?.length > partialLoadingIncrement && partialLoadingEnabled) {
|
|
98
|
+
setLimitedCoinsNumber(partialLoadingIncrement);
|
|
99
|
+
updateDisplayedCoins();
|
|
100
|
+
} else {
|
|
101
|
+
setLimitedCoinsNumber(0);
|
|
102
|
+
setDisplayedCoins(filteredCoins);
|
|
103
|
+
setIsListFull(true);
|
|
104
|
+
}
|
|
105
|
+
setIsSearchResultEmpty(filteredCoins?.length === 0 && searchQuery !== "");
|
|
106
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
107
|
+
}, [filteredCoins]);
|
|
108
|
+
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
if (coinsBundle != null) handleSearchAsset(searchQuery);
|
|
111
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
112
|
+
}, [coinsList, searchQuery]);
|
|
113
|
+
|
|
114
|
+
return displayedCoins
|
|
115
|
+
.map(coin => coinsBundle.find(bundleItem => bundleItem.coin.ticker === coin.ticker).component)
|
|
116
|
+
.map(Item => <Item />);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
SearchableCoinsList.propTypes = {
|
|
120
|
+
coinsList: PropTypes.array.isRequired,
|
|
121
|
+
coinsBundle: PropTypes.array.isRequired,
|
|
122
|
+
searchQuery: PropTypes.string.isRequired,
|
|
123
|
+
partialLoadingEnabled: PropTypes.bool,
|
|
124
|
+
partialLoadingIncrement: PropTypes.number,
|
|
125
|
+
onListUpdated: PropTypes.func,
|
|
126
|
+
setIsListFull: PropTypes.func,
|
|
127
|
+
setIsSearchResultEmpty: PropTypes.func,
|
|
128
|
+
triggerLoadMoreCoins: PropTypes.number,
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
SearchableCoinsList.defaultProps = {
|
|
132
|
+
partialLoadingEnabled: true,
|
|
133
|
+
partialLoadingIncrement: 100,
|
|
134
|
+
onListUpdated: () => {},
|
|
135
|
+
setIsListFull: () => {},
|
|
136
|
+
setIsSearchResultEmpty: () => {},
|
|
137
|
+
};
|
|
@@ -16,11 +16,13 @@ import { Button } from "../../../atoms/buttons/Button/Button.jsx";
|
|
|
16
16
|
* @param {Object} props - Props for configuring the DialogButtons.
|
|
17
17
|
* @param {string} [props.primaryButtonTitle] - The text to display on the primary button.
|
|
18
18
|
* @param {Function} props.primaryButtonOnClick - Function to call when the primary button is clicked.
|
|
19
|
+
* @param {boolean} props.primaryButtonEnabled - Determines whether the secondary button is enabled.
|
|
19
20
|
* @param {boolean} [props.primaryButtonLoader=false] - Whether to show a loader on the primary button.
|
|
20
21
|
* @param {string} [props.primaryButtonTo] - The URL or route the primary button should navigate to.
|
|
21
22
|
* @param {Function} [props.primaryButtonSetClickTrigger] - Additional click handling logic for the primary button.
|
|
22
23
|
* @param {string} [props.secondaryButtonTitle] - The text to display on the secondary button.
|
|
23
24
|
* @param {Function} props.secondaryButtonOnClick - Function to call when the secondary button is clicked.
|
|
25
|
+
* @param {boolean} props.secondaryButtonEnabled - Determines whether the primary button is enabled.
|
|
24
26
|
* @param {string} [props.secondaryButtonTo] - The URL or route the secondary button should navigate to.
|
|
25
27
|
* @param {boolean} [props.secondaryButtonBig=false] - Makes the secondary button larger for visual emphasis.
|
|
26
28
|
* @param {boolean} [props.withBackgroundImage=false] - Indicates if the button should adjust its styling for background images.
|
|
@@ -30,11 +32,13 @@ import { Button } from "../../../atoms/buttons/Button/Button.jsx";
|
|
|
30
32
|
export const DialogButtons = ({
|
|
31
33
|
primaryButtonTitle,
|
|
32
34
|
primaryButtonOnClick,
|
|
35
|
+
primaryButtonEnabled,
|
|
33
36
|
primaryButtonLoader = false,
|
|
34
37
|
primaryButtonTo,
|
|
35
38
|
primaryButtonSetClickTrigger,
|
|
36
39
|
secondaryButtonTitle,
|
|
37
40
|
secondaryButtonOnClick,
|
|
41
|
+
secondaryButtonEnabled,
|
|
38
42
|
secondaryButtonTo,
|
|
39
43
|
secondaryButtonBig = false,
|
|
40
44
|
withBackgroundImage = false,
|
|
@@ -62,6 +66,7 @@ export const DialogButtons = ({
|
|
|
62
66
|
content={secondaryButtonTitle}
|
|
63
67
|
onClick={secondaryButtonOnClick}
|
|
64
68
|
handleError={callHandlingErrors}
|
|
69
|
+
isDisabled={!secondaryButtonEnabled}
|
|
65
70
|
/>
|
|
66
71
|
) : secondaryButtonBig ? (
|
|
67
72
|
<Button
|
|
@@ -72,12 +77,14 @@ export const DialogButtons = ({
|
|
|
72
77
|
content={secondaryButtonTitle}
|
|
73
78
|
onClick={secondaryButtonOnClick}
|
|
74
79
|
handleError={callHandlingErrors}
|
|
80
|
+
isDisabled={!secondaryButtonEnabled}
|
|
75
81
|
/>
|
|
76
82
|
) : (
|
|
77
83
|
<LinkButton
|
|
78
84
|
onClick={secondaryButtonOnClick}
|
|
79
85
|
content={secondaryButtonTitle}
|
|
80
86
|
isColored={!withBackgroundImage}
|
|
87
|
+
isDisabled={!secondaryButtonEnabled}
|
|
81
88
|
/>
|
|
82
89
|
)
|
|
83
90
|
) : null}
|
|
@@ -93,6 +100,7 @@ export const DialogButtons = ({
|
|
|
93
100
|
content={primaryButtonTitle}
|
|
94
101
|
setClickTrigger={primaryButtonSetClickTrigger}
|
|
95
102
|
handleError={callHandlingErrors}
|
|
103
|
+
isDisabled={!primaryButtonEnabled}
|
|
96
104
|
/>
|
|
97
105
|
) : null}
|
|
98
106
|
</div>
|
|
@@ -103,11 +111,13 @@ export const DialogButtons = ({
|
|
|
103
111
|
DialogButtons.propTypes = {
|
|
104
112
|
primaryButtonTitle: PropTypes.string,
|
|
105
113
|
primaryButtonOnClick: PropTypes.func,
|
|
114
|
+
primaryButtonEnabled: PropTypes.bool,
|
|
106
115
|
primaryButtonLoader: PropTypes.bool,
|
|
107
116
|
primaryButtonTo: PropTypes.string,
|
|
108
117
|
primaryButtonSetClickTrigger: PropTypes.func,
|
|
109
118
|
secondaryButtonTitle: PropTypes.string,
|
|
110
119
|
secondaryButtonOnClick: PropTypes.func,
|
|
120
|
+
secondaryButtonEnabled: PropTypes.bool,
|
|
111
121
|
secondaryButtonTo: PropTypes.string,
|
|
112
122
|
secondaryButtonBig: PropTypes.bool,
|
|
113
123
|
withBackgroundImage: PropTypes.bool,
|