Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop into testnet #1433

Merged
merged 17 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
a539a9c
Merge pull request #1426 from nervosnetwork/master
Keith-CY Jan 16, 2024
b642894
refactor: downgrade @types/react to a suitable version (#211)
WhiteMinds Jan 17, 2024
d2f8292
chore(deps): update dependency @types/react-test-renderer to v18.0.7 …
renovate[bot] Jan 17, 2024
9f4e4e8
chore(deps): update dependency @types/react-outside-click-handler to …
renovate[bot] Jan 17, 2024
80a12f5
fix(deps): update dependency classnames to v2.5.1 (#207)
renovate[bot] Jan 17, 2024
de48ab9
fix(deps): update dependency @spore-sdk/core to v0.1.0 (#215)
renovate[bot] Jan 17, 2024
26ec118
Merge pull request #1428 from nervosnetwork/master
Keith-CY Jan 17, 2024
8d55691
Merge pull request #1429 from nervosnetwork/master
Keith-CY Jan 17, 2024
b2d8d04
fix: styles for the script page (#217)
WhiteMinds Jan 17, 2024
552979f
Merge branch 'develop' of https://github.com/magickbase/ckb-explorer-…
Keith-CY Jan 17, 2024
c8e7d08
chore(deps): update typescript-eslint monorepo to v6.19.0 (#216)
renovate[bot] Jan 17, 2024
beec708
chore(deps): update storybook monorepo to v7.6.8 (#213)
renovate[bot] Jan 17, 2024
981b00e
chore(deps): update dependency @types/node to v16.18.71 (#212)
renovate[bot] Jan 17, 2024
f512595
fix(inscription): ink should be more shorter when language changed (#…
Daryl-L Jan 17, 2024
0f7e356
Fix: loading state of search input (#209)
zhangyouxin Jan 17, 2024
89510e4
feat: update maintain i18n
WhiteMinds Jan 17, 2024
6497b7e
Merge pull request #1432 from WhiteMinds/feat/UpdateMaintainI18n
Keith-CY Jan 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"bignumber.js": "9.1.2",
"camelcase": "7.0.1",
"camelcase-keys": "7.0.2",
"classnames": "2.3.2",
"classnames": "2.5.1",
"dayjs": "1.11.10",
"default-passive-events": "2.0.0",
"echarts": "4.9.0",
Expand All @@ -39,30 +39,30 @@
},
"devDependencies": {
"@sentry/webpack-plugin": "2.10.2",
"@storybook/addon-essentials": "7.6.7",
"@storybook/addon-interactions": "7.6.7",
"@storybook/addon-links": "7.6.7",
"@storybook/addon-essentials": "7.6.8",
"@storybook/addon-interactions": "7.6.8",
"@storybook/addon-links": "7.6.8",
"@storybook/addon-onboarding": "1.0.10",
"@storybook/addon-storysource": "^7.5.3",
"@storybook/blocks": "7.6.7",
"@storybook/preset-create-react-app": "7.6.7",
"@storybook/react": "7.6.7",
"@storybook/react-webpack5": "7.6.7",
"@storybook/blocks": "7.6.8",
"@storybook/preset-create-react-app": "7.6.8",
"@storybook/react": "7.6.8",
"@storybook/react-webpack5": "7.6.8",
"@storybook/testing-library": "0.2.2",
"@testing-library/react": "12.1.5",
"@types/echarts": "4.9.22",
"@types/eslint": "8.56.2",
"@types/jest": "29.5.11",
"@types/lodash.debounce": "4.0.9",
"@types/node": "16.18.70",
"@types/react": "18.2.47",
"@types/node": "16.18.71",
"@types/react": "17.0.65",
"@types/react-dom": "17.0.20",
"@types/react-outside-click-handler": "^1.3.0",
"@types/react-router-dom": "5.3.3",
"@types/react-test-renderer": "^18.0.0",
"@types/styled-components": "5.1.32",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "6.18.1",
"@typescript-eslint/parser": "6.19.0",
"antd-dayjs-webpack-plugin": "^1.0.6",
"babel-plugin-named-exports-order": "0.0.2",
"create-react-app": "^5.0.0",
Expand All @@ -86,7 +86,7 @@
"react-app-rewired": "2.2.1",
"react-test-renderer": "^17.0.2",
"rxjs": "7.8.1",
"storybook": "7.6.7",
"storybook": "7.6.8",
"stylelint": "^15.10.1",
"stylelint-config-css-modules": "^4.3.0",
"stylelint-config-standard": "^35.0.0",
Expand Down
42 changes: 42 additions & 0 deletions src/components/Search/index.module.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../../styles/variables.module';

.byNameOrId {
// remove original button styles
border: none;
Expand All @@ -15,3 +17,43 @@
background: #f0f0f0;
white-space: nowrap;
}

.searchInputPanel {
position: relative;
width: 100%;
height: 100%;
font-size: 14px;
padding-left: 10px;
padding-right: 20px;
background: white;
color: #333;
border: 0 solid white;
border-radius: 4px;

&:focus {
color: #333;
outline: none;
}

&::placeholder {
color: #888;
}

@media (max-width: $mobileBreakPoint) {
font-size: 12px;
width: 100%;
padding-left: 6px;
padding-right: 16px;
}
}

.spinner {
margin-left: 8px;
animation: rotate 2s linear infinite;
}

@keyframes rotate {
100% {
transform: rotate(360deg);
}
}
28 changes: 20 additions & 8 deletions src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { useHistory } from 'react-router'
import { useTranslation } from 'react-i18next'
import debounce from 'lodash.debounce'
import { useQuery, useQueryClient } from '@tanstack/react-query'
import { ImageButton, SearchInputPanel, SearchPanel, SearchButton, SearchContainer } from './styled'
import { ImageButton, SearchPanel, SearchButton, SearchContainer } from './styled'
import { explorerService, Response } from '../../services/ExplorerService'
import SearchLogo from '../../assets/search_black.png'
import ClearLogo from '../../assets/clear.png'
Expand All @@ -27,6 +27,7 @@ import { SearchResultType } from '../../services/ExplorerService/fetcher'
import styles from './index.module.scss'
import { SearchByNameResults } from './SearchByNameResults'
import { useSearchType } from '../../services/AppSettings/hooks'
import { ReactComponent as SpinnerIcon } from './spinner.svg'

const handleSearchById = async (
searchValue: string,
Expand All @@ -48,6 +49,7 @@ const handleSearchById = async (

try {
const { data } = await explorerService.api.fetchSearchByIdResult(addPrefixForHash(query))
setInputLoading(false)
onClear()

const { type, attributes } = data
Expand Down Expand Up @@ -174,12 +176,18 @@ const Search: FC<{
return (
<SearchContainer>
<SearchPanel moreHeight={hasButton} hasButton={hasButton}>
<ImageButton>
<img src={SearchLogo} alt="search logo" />
</ImageButton>
{inputLoading ? (
<SpinnerIcon width="22px" height="22px" className={styles.spinner} />
) : (
<ImageButton>
<img src={SearchLogo} alt="search logo" />
</ImageButton>
)}

<SearchInput
autoFocus={!isMobile}
value={inputLoading ? t('search.loading') : keyword}
loading={inputLoading}
value={keyword}
onChange={event => setKeyword(event.target.value)}
onEditEndedChange={setEditEnded}
placeholder={isSearchByName ? t('navbar.search_by_name_placeholder') : t('navbar.search_placeholder')}
Expand All @@ -205,17 +213,21 @@ const Search: FC<{
const SearchInput: FC<
ComponentPropsWithoutRef<'input'> & {
onEditEndedChange?: (editEnded: boolean) => void
loading?: boolean
}
> = ({ onEditEndedChange, value: propsValue, onChange: propsOnChange, onKeyUp: propsOnKeyUp, ...elprops }) => {
> = ({ loading, onEditEndedChange, value: propsValue, onChange: propsOnChange, onKeyUp: propsOnKeyUp, ...elprops }) => {
const [value, setValue] = useForkedState(propsValue)

const onChange: ChangeEventHandler<HTMLInputElement> = useCallback(
event => {
if (loading) {
return
}
setValue(event.target.value)
propsOnChange?.(event)
onEditEndedChange?.(event.target.value === '')
},
[onEditEndedChange, propsOnChange, setValue],
[onEditEndedChange, propsOnChange, setValue, loading],
)

const onKeyUp: KeyboardEventHandler<HTMLInputElement> = useCallback(
Expand All @@ -229,7 +241,7 @@ const SearchInput: FC<
[onEditEndedChange, propsOnKeyUp],
)

return <SearchInputPanel value={value} onChange={onChange} onKeyUp={onKeyUp} {...elprops} />
return <input className={styles.searchInputPanel} value={value} onChange={onChange} onKeyUp={onKeyUp} {...elprops} />
}

export default Search
7 changes: 7 additions & 0 deletions src/components/Search/spinner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/hooks/useDASAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface PendingQuery {
// and logic for aggregating multiple queries can actually be implemented in ExplorerService instead of relying on the Context.
// However, the current implementation still uses Context because it provides
// the possibility of implementing page-level and component-level accountMap caching in the future.
export const DASQueryContextProvider: FC<React.PropsWithChildren> = ({ children }) => {
export const DASQueryContextProvider: FC<React.PropsWithChildren<{}>> = ({ children }) => {
const accountMap = useRef<DASAccountMap>({})
const pendingQueries = useRef<PendingQuery[]>([])

Expand Down
4 changes: 2 additions & 2 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@
"args": "Args",
"hash_type": "Hash Type",
"overview": "Overview",
"user_defined_token": "User Defined Token",
"user_defined_token": "Simple User Defined Token",
"inscription": "Inscription",
"confirmation": "Confirmation",
"confirmations": "Confirmations",
Expand Down Expand Up @@ -542,7 +542,7 @@
"deposit_address_tooltip": "Number of addresses with non-zero balance of Nervos DAO"
},
"error": {
"maintain": "The site is temporarily down for maintenance. Please check back soon.",
"maintain": "The current browser data is delayed. Please refer to the ckb node data for accuracy.",
"page_crashed_tip": "Oops! Some errors were encountered.",
"back_home": "BACK HOME"
},
Expand Down
4 changes: 2 additions & 2 deletions src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@
"args": "Args",
"hash_type": "Hash Type",
"overview": "概览",
"user_defined_token": "User Defined Token",
"user_defined_token": "Simple User Defined Token",
"inscription": "铭文",
"confirmation": "确认区块",
"confirmations": "确认区块",
Expand Down Expand Up @@ -543,7 +543,7 @@
"deposit_address_tooltip": "Nervos DAO 锁定余额不为零的地址"
},
"error": {
"maintain": "网络维护中,请稍后再试",
"maintain": "当前浏览器数据滞后,请以 ckb node 的数据为准。",
"page_crashed_tip": "遇到了一些错误",
"back_home": "前往首页"
},
Expand Down
17 changes: 13 additions & 4 deletions src/pages/Address/AddressComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ const AddressLockScript: FC<{ address: Address }> = ({ address }) => {
}

export const AddressOverviewCard: FC<{ address: Address }> = ({ address }) => {
const { t } = useTranslation()
const { t, i18n } = useTranslation()
const { udtAccounts = [] } = address
const [activeTab, setActiveTab] = useState<AssetInfo>(AssetInfo.UDT)

const [udts, inscriptions] = udtAccounts.reduce(
(acc, cur) => {
Expand Down Expand Up @@ -195,10 +196,14 @@ export const AddressOverviewCard: FC<{ address: Address }> = ({ address }) => {

{udts.length > 0 || (cotaList?.length && cotaList.length > 0) || inscriptions.length > 0 ? (
<AddressUDTAssetsPanel className={styles.addressUDTAssetsPanel}>
<AddressAssetsTab>
<AddressAssetsTab animated={false} key={i18n.language} activeKey={activeTab.toString()}>
{(udts.length > 0 || cotaList?.length) && (
<AddressAssetsTabPane
tab={<AddressAssetsTabPaneTitle>{t('address.user_defined_token')}</AddressAssetsTabPaneTitle>}
tab={
<AddressAssetsTabPaneTitle onClick={() => setActiveTab(AssetInfo.UDT)}>
{t('address.user_defined_token')}
</AddressAssetsTabPaneTitle>
}
key={AssetInfo.UDT}
>
<div className="addressUdtAssetsGrid">
Expand Down Expand Up @@ -235,7 +240,11 @@ export const AddressOverviewCard: FC<{ address: Address }> = ({ address }) => {
)}
{inscriptions.length > 0 && (
<AddressAssetsTabPane
tab={<AddressAssetsTabPaneTitle>{t('address.inscription')}</AddressAssetsTabPaneTitle>}
tab={
<AddressAssetsTabPaneTitle onClick={() => setActiveTab(AssetInfo.INSCRIPTION)}>
{t('address.inscription')}
</AddressAssetsTabPaneTitle>
}
key={AssetInfo.INSCRIPTION}
>
<div className="addressUdtAssetsGrid">
Expand Down
18 changes: 18 additions & 0 deletions src/pages/Address/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,22 @@ export const AddressAssetsTab = styled(Tabs)`
}
}

/* stylelint-disable-next-line selector-class-pattern */
.ant-tabs-tab-remove {
&:hover,
&:active {
color: var(--primary-color);
}
}

/* stylelint-disable-next-line selector-class-pattern */
.ant-tabs-tab-btn {
&:active,
&:focus {
color: var(--primary-color);
}
}

/* stylelint-disable-next-line selector-class-pattern */
.ant-tabs-nav .ant-tabs-ink-bar {
height: 4px;
Expand Down Expand Up @@ -186,6 +202,8 @@ export const AddressUDTItemPanel = styled.a`
pointer-events: ${(props: { isLink: boolean }) => (props.isLink ? 'auto' : 'none')};

.addressUdtLabel {
text-overflow: ellipsis;
overflow: hidden;
text-align: left;
font-size: 12px;
padding: 2px 8px;
Expand Down
7 changes: 1 addition & 6 deletions src/pages/Script/ScriptsComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,7 @@ export const ScriptTransactions = ({ page, size }: { page: number; size: number
/>
))
) : (
<div
style={{
textAlign: 'center',
padding: '20px',
}}
>
<div className={styles.loadingOrEmpty}>
{transactionsQuery.isLoading && !previousTransactionEmpty ? t('nft.loading') : t(`nft.no_record`)}
</div>
)}
Expand Down
7 changes: 7 additions & 0 deletions src/pages/Script/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@
}
}

.loadingOrEmpty {
margin-top: 4px;
padding: 20px;
text-align: center;
background: #fff;
}

.scriptCellsPanel {
padding: 0 40px;
margin-top: 4px;
Expand Down
Loading