V2.0.0 UI update#391
Conversation
feat: change img
feat: select center
feat: home style done
feat: nfts tokens and txdetail
feat: nft add #
feat: address detail
feat: address detail add qrcode
feat: address logs
feat: address icon
feat: chart style change
feat: font and contract publish
feat: token value add $
fix: fix search jump clear
fix: fix file upload
feat: change help icon
fix: fix font wight
fix: fix tooltip style
fix ui walkthrough problem
differentiate testnet
| '00auto': '0 0 auto', | ||
| }, | ||
| screens: { | ||
| 'min-769': '769px', |
There was a problem hiding this comment.
(tofix) should follow standard breakpoint conventions like https://getbootstrap.com/docs/5.0/layout/breakpoints/
screens: {
'sm': '640px',
'md': '768px',
'lg': '1024px',
'xl': '1280px',
'2xl': '1536px'
}
for this case, perhaps we do a custom breakpoint md: 769px
| @@ -0,0 +1,18 @@ | |||
| import { memo } from 'react'; | |||
| import AdsCarousel from './_components/ScrollAds'; | |||
There was a problem hiding this comment.
(tofix) no clear reason to have _components instead of components? should rename _* to *
| </div> | ||
|
|
||
| <div className="mx-auto box-border w-full max-w-[1440px] px-4 min-[769px]:px-6 min-[993px]:min-w-[200px] min-[993px]:px-10"> | ||
| <BannerContainer /> |
| @@ -0,0 +1,36 @@ | |||
| import { useAppSelector } from '@_store'; | |||
There was a problem hiding this comment.
(tofix) @_store is confusing. Should change tsconfig to be "@/": ["src/"]. Common conventions:
- @ for source folder
- ~ for root folder
| import AceEditor from 'react-ace'; | ||
| import 'ace-builds/src-noconflict/mode-csharp'; | ||
| import 'ace-builds/src-noconflict/theme-github'; | ||
| import 'ace-builds/src-noconflict/theme-tomorrow'; |
There was a problem hiding this comment.
(tofix) do on-demand dynamic import if there are more than >1 theme, or just remove -github
| }, [width]); | ||
| const isLG = useMemo(() => { | ||
| return width < 1024; | ||
| return width < 1025; |
There was a problem hiding this comment.
(tofix) avoid magic numbers. Those values should be exported figma design tokens similar to what I wrote in tailwind config { lg: '1024' }
| const { tokens, nfts, accounts, contracts, blocks } = res; | ||
| if (tokens.length) { | ||
| router.push(`/${defaultChain}/token/${tokens[0].symbol}`); | ||
| router.push(`/${MULTI_CHAIN}/token/${tokens[0].symbol}`); |
There was a problem hiding this comment.
(tofix) multiple nested ifs are really hard to follow. Refactor this block out into a separate util getRouteFromParams method:
getRouteFromParams(res: ISearchResponse): string {
// check for tokens, nfts, accounts etc to assign a route
return route;
}
then write tests for the method
| return isMainNet ? 'tDVV' : 'tDVW'; | ||
| }; | ||
|
|
||
| export const useCurrentPageChain = () => { |
There was a problem hiding this comment.
(tofix) add UT as it's a new hook
| { ...commonColumns[2], width: 384 }, | ||
| { ...commonColumns[3], width: 384 }, | ||
| ]; | ||
| export default function getColumns(currentPage, pageSize): ColumnsType<HolderItem> { |
There was a problem hiding this comment.
getColumns is just re-exported getCommonColumns with same parameters here. Why not export function getCommonColumns(currentPage, pageSize): ColumnsType<HolderItem> ?
| Testnet: 'https://t.me/aelfscantest_bot', | ||
| }; | ||
|
|
||
| export const SEARCH_TITLE = { |
There was a problem hiding this comment.
(tofix) rename file to const.ts or constants.ts later
| export const thousandsNumber = (number: string | number): string => { | ||
| const num = Number(number); | ||
| if (number === '' || Number.isNaN(num) || number === null) return '-'; | ||
| if (number === '' || Number.isNaN(num) || number === null) return '--'; |
There was a problem hiding this comment.
(tofix) I see alot of '--' so it's better to make this a const or ENUM for formatting.
| }; | ||
|
|
||
| const chainChange = (value: string) => { | ||
| console.log(value, 'value'); |
There was a problem hiding this comment.
remove console.log for production builds
| }, | ||
| }} | ||
| showMultiChain={chain === MULTI_CHAIN} | ||
| showMultiChain={true} |
There was a problem hiding this comment.
just showMultiChain will do, unless you expect the condition to change many times
| defaultPageSize={Number(ps)} | ||
| defaultPageType={defaultPageType} | ||
| defaultChain={defaultChain} | ||
| defaultChain={defaultChain || ''} |
There was a problem hiding this comment.
move to L14 to group fallback values in 1 place const defaultChain = searchParams['chain'] || MULTI_CHAIN || ''
| } | ||
| const selectFile = filtered[0]; | ||
| const newPath = `${path}${selectFile.name}/`; | ||
| // if (index === names.length - 1) { |
There was a problem hiding this comment.
Delete the commented out block. You have git history for changes.
| onChange(e.node.key.split('#')); | ||
| }; | ||
|
|
||
| const ismd = useMD(); |
There was a problem hiding this comment.
change useMD to useBreakpointMD to be descriptive and check other usages too
| const chainArr = useMemo(() => { | ||
| return chainList.map((ele) => ele.chainList_id); | ||
| }, [chainList]); | ||
| console.log(chainArr, props, 'props'); |
There was a problem hiding this comment.
remove console.log in production builds
| const { chain } = useParams(); | ||
| const params = useSearchParams(); | ||
| const chain = params.get('chain') || MULTI_CHAIN; | ||
| const selectChain = useMemo(() => { |
There was a problem hiding this comment.
double check that you actually need useMemo here if the param is directly from nextjs hook
|
|
||
| return ( | ||
| <div className="chain-select-container mr-4 w-full !py-0" id="chain-select-container"> | ||
| <div className="chain-select-container w-full !py-0" id="chain-select-container" suppressHydrationWarning> |
There was a problem hiding this comment.
(tofix) add a comment to explain why the need to supress warnings here
| }, [name, showContractAddress, type]); | ||
|
|
||
| return type === AddressType.address || showContractAddress || (type === AddressType.Contract && !name) ? ( | ||
| address ? ( |
There was a problem hiding this comment.
(tofix) move the jsx code into functions like renderAddress and renderName and convert ternary conditions to if-else. This is hard to read.
if (type === AddressType.address || showContractAddress || (type === AddressType.Contract && !name) {
return address ? renderAddress() : '-';
}
else {
return name ? renderName() : '-';
}
please enable https://eslint.org/docs/latest/rules/no-nested-ternary rules for eslint
| ) | ||
| ) : name ? ( | ||
| <div className="address w-full truncate"> | ||
| <div className="address flex w-full truncate"> |
There was a problem hiding this comment.
(tofix)

I'm getting a warning from eslint-plugin-tailwindcss. extract with @apply later
| import clsx from 'clsx'; | ||
| import QrCodeModal from './qrCode'; | ||
|
|
||
| export default function MultiChain({ |
There was a problem hiding this comment.
(tofix) add UT for new component
| @@ -0,0 +1,26 @@ | |||
| import IconFont from '@_components/IconFont'; | |||
preview code optimization
V2.0.0 UI update. close #390