mirror of
https://github.com/luxfi/explore.git
synced 2026-07-27 03:13:50 +00:00
bring ts-reset
This commit is contained in:
@@ -6,7 +6,7 @@ import type { ChainIndicatorId } from 'ui/home/indicators/types';
|
||||
const getEnvValue = (env: string | undefined) => env?.replaceAll('\'', '"');
|
||||
const parseEnvJson = <DataType>(env: string | undefined): DataType | null => {
|
||||
try {
|
||||
return JSON.parse(env || 'null');
|
||||
return JSON.parse(env || 'null') as DataType | null;
|
||||
} catch (error) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export default function getFilterValue<FilterType>(filterValues: ReadonlyArray<FilterType>, val: string | Array<string> | undefined) {
|
||||
if (typeof val === 'string' && filterValues.includes(val as unknown as FilterType)) {
|
||||
return val as unknown as FilterType;
|
||||
export default function getFilterValue<FilterType>(filterValues: ReadonlyArray<FilterType>, val: string | Array<string> | undefined): FilterType | undefined {
|
||||
if (typeof val === 'string' && filterValues.includes(val as FilterType)) {
|
||||
return val as FilterType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import React from 'react';
|
||||
|
||||
import type { Address } from 'types/api/address';
|
||||
|
||||
import notEmpty from 'lib/notEmpty';
|
||||
import ContractCode from 'ui/address/contract/ContractCode';
|
||||
import ContractRead from 'ui/address/contract/ContractRead';
|
||||
import ContractWrite from 'ui/address/contract/ContractWrite';
|
||||
@@ -33,6 +32,6 @@ export default function useContractTabs(data: Address | undefined) {
|
||||
data?.has_custom_methods_write ?
|
||||
{ id: 'write_custom_methods', title: 'Write custom', component: <ContractWrite addressHash={ data?.hash } isCustomAbi/> } :
|
||||
undefined,
|
||||
].filter(notEmpty);
|
||||
].filter(Boolean);
|
||||
}, [ data ]);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import transactionsIcon from 'icons/transactions.svg';
|
||||
import verifiedIcon from 'icons/verified.svg';
|
||||
import watchlistIcon from 'icons/watchlist.svg';
|
||||
// import { rightLineArrow } from 'lib/html-entities';
|
||||
import notEmpty from 'lib/notEmpty';
|
||||
|
||||
export interface NavItem {
|
||||
text: string;
|
||||
@@ -106,7 +105,7 @@ export default function useNavItems(): ReturnType {
|
||||
} : null,
|
||||
// FIXME: need icon for this item
|
||||
{ text: 'GraphQL', nextRoute: { pathname: '/graphiql' as const }, icon: topAccountsIcon, isActive: false, isNewUi: false },
|
||||
].filter(notEmpty);
|
||||
].filter(Boolean);
|
||||
|
||||
const mainNavItems = [
|
||||
{
|
||||
@@ -125,7 +124,7 @@ export default function useNavItems(): ReturnType {
|
||||
// at this stage custom menu items is under development, we will implement it later
|
||||
otherNavItems.length > 0 ?
|
||||
{ text: 'Other', icon: gearIcon, isActive: otherNavItems.some(item => item.isActive), subItems: otherNavItems } : null,
|
||||
].filter(notEmpty) as Array<NavItem | NavGroupItem>;
|
||||
].filter(Boolean);
|
||||
|
||||
const accountNavItems = [
|
||||
{
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
export default function notEmpty<TValue>(value: TValue | null | undefined): value is TValue {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
import type { Channel } from 'phoenix';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
|
||||
import notEmpty from 'lib/notEmpty';
|
||||
|
||||
import { useSocket } from './context';
|
||||
|
||||
const CHANNEL_REGISTRY: Record<string, Channel> = {};
|
||||
@@ -27,7 +25,7 @@ export default function useSocketChannel({ topic, params, isDisabled, onJoin, on
|
||||
|
||||
useEffect(() => {
|
||||
const cleanUpRefs = () => {
|
||||
const refs = [ onCloseRef.current, onErrorRef.current ].filter(notEmpty);
|
||||
const refs = [ onCloseRef.current, onErrorRef.current ].filter(Boolean);
|
||||
refs.length > 0 && socket?.off(refs);
|
||||
};
|
||||
|
||||
|
||||
+2
-1
@@ -78,6 +78,7 @@
|
||||
"@playwright/experimental-ct-react": "1.31.0",
|
||||
"@svgr/webpack": "^6.5.1",
|
||||
"@testing-library/react": "^13.4.0",
|
||||
"@total-typescript/ts-reset": "^0.3.7",
|
||||
"@types/d3": "^7.4.0",
|
||||
"@types/dom-to-image": "^2.6.4",
|
||||
"@types/jest": "^29.2.0",
|
||||
@@ -87,8 +88,8 @@
|
||||
"@types/qrcode": "^1.5.0",
|
||||
"@types/react": "18.0.9",
|
||||
"@types/react-dom": "18.0.5",
|
||||
"@types/swagger-ui-react": "^4.11.0",
|
||||
"@types/react-google-recaptcha": "^2.1.5",
|
||||
"@types/swagger-ui-react": "^4.11.0",
|
||||
"@types/ws": "^8.5.3",
|
||||
"@typescript-eslint/eslint-plugin": "^5.27.0",
|
||||
"dotenv-cli": "^6.0.0",
|
||||
|
||||
@@ -35,7 +35,7 @@ export const joinChannel = async(socket: WebSocket, channelName: string) => {
|
||||
return new Promise<[string, string, string]>((resolve, reject) => {
|
||||
socket.on('message', (msg) => {
|
||||
try {
|
||||
const payload: Array<string> = JSON.parse(msg.toString());
|
||||
const payload = JSON.parse(msg.toString()) as Array<string>;
|
||||
|
||||
if (channelName === payload[2] && payload[3] === 'phx_join') {
|
||||
socket.send(JSON.stringify([
|
||||
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
import '@total-typescript/ts-reset';
|
||||
+1
-2
@@ -7,7 +7,6 @@ import type { AppItemPreview } from 'types/client/apps';
|
||||
import northEastIcon from 'icons/arrows/north-east.svg';
|
||||
import starFilledIcon from 'icons/star_filled.svg';
|
||||
import starOutlineIcon from 'icons/star_outline.svg';
|
||||
import notEmpty from 'lib/notEmpty';
|
||||
|
||||
import AppCardLink from './AppCardLink';
|
||||
import { APP_CATEGORIES } from './constants';
|
||||
@@ -30,7 +29,7 @@ const AppCard = ({
|
||||
isFavorite,
|
||||
onFavoriteClick,
|
||||
}: Props) => {
|
||||
const categoriesLabel = categories.map(c => APP_CATEGORIES[c]).filter(notEmpty).join(', ');
|
||||
const categoriesLabel = categories.map(c => APP_CATEGORIES[c]).filter(Boolean).join(', ');
|
||||
|
||||
const handleInfoClick = useCallback((event: MouseEvent) => {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -15,7 +15,6 @@ import starFilledIcon from 'icons/star_filled.svg';
|
||||
import starOutlineIcon from 'icons/star_outline.svg';
|
||||
import useIsMobile from 'lib/hooks/useIsMobile';
|
||||
import { nbsp } from 'lib/html-entities';
|
||||
import notEmpty from 'lib/notEmpty';
|
||||
|
||||
import AppModalLink from './AppModalLink';
|
||||
import { APP_CATEGORIES } from './constants';
|
||||
@@ -60,7 +59,7 @@ const AppModal = ({
|
||||
icon: ghIcon,
|
||||
url: github,
|
||||
} : null,
|
||||
].filter(notEmpty);
|
||||
].filter(Boolean);
|
||||
|
||||
const handleFavoriteClick = useCallback(() => {
|
||||
onFavoriteClick(id, isFavorite);
|
||||
|
||||
@@ -9,7 +9,7 @@ const favoriteAppsLocalStorageKey = 'favoriteApps';
|
||||
|
||||
function getFavoriteApps() {
|
||||
try {
|
||||
return JSON.parse(localStorage.getItem(favoriteAppsLocalStorageKey) || '[]');
|
||||
return JSON.parse(localStorage.getItem(favoriteAppsLocalStorageKey) || '[]') as Array<string>;
|
||||
} catch (e) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ export const DEFAULT_VALUES = {
|
||||
};
|
||||
|
||||
export function isValidVerificationMethod(method?: string): method is SmartContractVerificationMethod {
|
||||
return method && SUPPORTED_VERIFICATION_METHODS.includes(method as SmartContractVerificationMethod) ? true : false;
|
||||
return method && SUPPORTED_VERIFICATION_METHODS.includes(method) ? true : false;
|
||||
}
|
||||
|
||||
export function sortVerificationMethods(methodA: SmartContractVerificationMethod, methodB: SmartContractVerificationMethod) {
|
||||
|
||||
@@ -9,7 +9,6 @@ import iconSuccess from 'icons/status/success.svg';
|
||||
import useApiQuery from 'lib/api/useApiQuery';
|
||||
import { useAppContext } from 'lib/appContext';
|
||||
import useContractTabs from 'lib/hooks/useContractTabs';
|
||||
import notEmpty from 'lib/notEmpty';
|
||||
import getQueryParamString from 'lib/router/getQueryParamString';
|
||||
import AddressBlocksValidated from 'ui/address/AddressBlocksValidated';
|
||||
import AddressCoinBalance from 'ui/address/AddressCoinBalance';
|
||||
@@ -57,7 +56,7 @@ const AddressPageContent = () => {
|
||||
...(addressQuery.data?.public_tags || []),
|
||||
...(addressQuery.data?.watchlist_names || []),
|
||||
]
|
||||
.filter(notEmpty)
|
||||
.filter(Boolean)
|
||||
.map((tag) => <Tag key={ tag.label }>{ tag.display_name }</Tag>);
|
||||
|
||||
const contractTabs = useContractTabs(addressQuery.data);
|
||||
@@ -92,7 +91,7 @@ const AddressPageContent = () => {
|
||||
component: <AddressContract tabs={ contractTabs } addressHash={ hash }/>,
|
||||
subTabs: contractTabs.map(tab => tab.id),
|
||||
} : undefined,
|
||||
].filter(notEmpty);
|
||||
].filter(Boolean);
|
||||
}, [ addressQuery.data, contractTabs, hash ]);
|
||||
|
||||
const tagsNode = tags.length > 0 ? <Flex columnGap={ 2 }>{ tags }</Flex> : null;
|
||||
|
||||
+1
-2
@@ -10,7 +10,6 @@ import { useAppContext } from 'lib/appContext';
|
||||
import useContractTabs from 'lib/hooks/useContractTabs';
|
||||
import useIsMobile from 'lib/hooks/useIsMobile';
|
||||
import useQueryWithPages from 'lib/hooks/useQueryWithPages';
|
||||
import notEmpty from 'lib/notEmpty';
|
||||
import trimTokenSymbol from 'lib/token/trimTokenSymbol';
|
||||
import AddressContract from 'ui/address/AddressContract';
|
||||
import TextAd from 'ui/shared/ad/TextAd';
|
||||
@@ -118,7 +117,7 @@ const TokenPageContent = () => {
|
||||
component: <AddressContract tabs={ contractTabs } addressHash={ hashString }/>,
|
||||
subTabs: contractTabs.map(tab => tab.id),
|
||||
} : undefined,
|
||||
].filter(notEmpty);
|
||||
].filter(Boolean);
|
||||
|
||||
let hasPagination;
|
||||
let pagination;
|
||||
|
||||
@@ -31,7 +31,8 @@ const CoinzillaTextAd = ({ className }: {className?: string}) => {
|
||||
useEffect(() => {
|
||||
fetch('https://request-global.czilladx.com/serve/native.php?z=19260bf627546ab7242')
|
||||
.then(res => res.status === 200 ? res.json() : null)
|
||||
.then((data) => {
|
||||
.then((_data) => {
|
||||
const data = _data as AdData;
|
||||
setAdData(data);
|
||||
if (data?.ad?.impressionUrl) {
|
||||
fetch(data.ad.impressionUrl);
|
||||
|
||||
@@ -6,7 +6,6 @@ import type { Log } from 'types/api/log';
|
||||
|
||||
// import searchIcon from 'icons/search.svg';
|
||||
import { space } from 'lib/html-entities';
|
||||
import notEmpty from 'lib/notEmpty';
|
||||
import Address from 'ui/shared/address/Address';
|
||||
import AddressIcon from 'ui/shared/address/AddressIcon';
|
||||
import AddressLink from 'ui/shared/address/AddressLink';
|
||||
@@ -83,7 +82,7 @@ const LogItem = ({ address, index, topics, data, decoded, type, tx_hash: txHash
|
||||
) }
|
||||
<RowHeader>Topics</RowHeader>
|
||||
<GridItem>
|
||||
{ topics.filter(notEmpty).map((item, index) => (
|
||||
{ topics.filter(Boolean).map((item, index) => (
|
||||
<LogTopic
|
||||
key={ index }
|
||||
hex={ item }
|
||||
|
||||
@@ -3807,6 +3807,11 @@
|
||||
resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf"
|
||||
integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==
|
||||
|
||||
"@total-typescript/ts-reset@^0.3.7":
|
||||
version "0.3.7"
|
||||
resolved "https://registry.yarnpkg.com/@total-typescript/ts-reset/-/ts-reset-0.3.7.tgz#66d0d9d3a9d8055b876640b7d0231809e01351b7"
|
||||
integrity sha512-yXt2BRRVCJVvzWaxac5n0nCXzIrQEBE/MeYlNQ8/Iq7UeelNmm/AdnUAu18ilSS893mbEQ4u6whPt/HvOPc4rw==
|
||||
|
||||
"@trysound/sax@0.2.0":
|
||||
version "0.2.0"
|
||||
resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad"
|
||||
@@ -4289,6 +4294,13 @@
|
||||
dependencies:
|
||||
"@types/react" "*"
|
||||
|
||||
"@types/react-google-recaptcha@^2.1.5":
|
||||
version "2.1.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/react-google-recaptcha/-/react-google-recaptcha-2.1.5.tgz#af157dc2e4bde3355f9b815a64f90e85cfa9df8b"
|
||||
integrity sha512-iWTjmVttlNgp0teyh7eBXqNOQzVq2RWNiFROWjraOptRnb1OcHJehQnji0sjqIRAk9K0z8stjyhU+OLpPb0N6w==
|
||||
dependencies:
|
||||
"@types/react" "*"
|
||||
|
||||
"@types/react-redux@^7.1.20":
|
||||
version "7.1.25"
|
||||
resolved "https://registry.yarnpkg.com/@types/react-redux/-/react-redux-7.1.25.tgz#de841631205b24f9dfb4967dd4a7901e048f9a88"
|
||||
@@ -4299,13 +4311,6 @@
|
||||
hoist-non-react-statics "^3.3.0"
|
||||
redux "^4.0.0"
|
||||
|
||||
"@types/react-google-recaptcha@^2.1.5":
|
||||
version "2.1.5"
|
||||
resolved "https://registry.yarnpkg.com/@types/react-google-recaptcha/-/react-google-recaptcha-2.1.5.tgz#af157dc2e4bde3355f9b815a64f90e85cfa9df8b"
|
||||
integrity sha512-iWTjmVttlNgp0teyh7eBXqNOQzVq2RWNiFROWjraOptRnb1OcHJehQnji0sjqIRAk9K0z8stjyhU+OLpPb0N6w==
|
||||
dependencies:
|
||||
"@types/react" "*"
|
||||
|
||||
"@types/react-scroll@^1.8.4":
|
||||
version "1.8.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/react-scroll/-/react-scroll-1.8.4.tgz#2b6258fb34104d3fcc7a22e8eceaadc669ba3ad1"
|
||||
@@ -9009,6 +9014,11 @@ json5@^2.2.1:
|
||||
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c"
|
||||
integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==
|
||||
|
||||
json5@^2.2.2:
|
||||
version "2.2.3"
|
||||
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
|
||||
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
|
||||
|
||||
jsonfile@^6.0.1:
|
||||
version "6.1.0"
|
||||
resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"
|
||||
@@ -9018,11 +9028,6 @@ jsonfile@^6.0.1:
|
||||
optionalDependencies:
|
||||
graceful-fs "^4.1.6"
|
||||
|
||||
json5@^2.2.2:
|
||||
version "2.2.3"
|
||||
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
|
||||
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
|
||||
|
||||
jsonify@^0.0.1:
|
||||
version "0.0.1"
|
||||
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.1.tgz#2aa3111dae3d34a0f151c63f3a45d995d9420978"
|
||||
|
||||
Reference in New Issue
Block a user