Skip to content

Commit

Permalink
fix: Update light client version. Disabled input when migrate sudt.
Browse files Browse the repository at this point in the history
  • Loading branch information
yanguoyu committed May 5, 2023
1 parent b3cd08d commit beea565
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .ckb-light-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.2.2
v0.2.3
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ const SUDTMigrateToExistAccountDialog = ({
sUDTAccounts,
isMainnet,
walletID,
isLightClient,
}: {
cell: SpecialAssetCell
closeDialog: () => void
tokenInfo?: Controller.GetTokenInfoList.TokenInfo
sUDTAccounts: State.SUDTAccount[]
isMainnet: boolean
walletID: string
isLightClient: boolean
}) => {
const [t] = useTranslation()
const [address, setAddress] = useState('')
Expand Down Expand Up @@ -92,6 +94,7 @@ const SUDTMigrateToExistAccountDialog = ({
onChange={onAddressChange}
value={address}
className={styles.addressInputSelect}
inputDisabeld={isLightClient}
/>
{addressError && <div className={styles.error}>{addressError}</div>}
</div>
Expand Down
6 changes: 6 additions & 0 deletions packages/neuron-ui/src/components/SpecialAssetList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
useGetAssetAccounts,
} from './hooks'
import styles from './specialAssetList.module.scss'
import { LIGHT_NETWORK_TYPE } from 'utils/const'

const { PAGE_SIZE } = CONSTANTS

Expand Down Expand Up @@ -113,6 +114,10 @@ const SpecialAssetList = () => {
} = useGlobalState()
const { suggestFeeRate } = useGetCountDownAndFeeRateStats()
const isMainnet = isMainnetUtil(networks, networkID)
const isLightClient = useMemo(() => networks.find(n => n.id === networkID)?.type === LIGHT_NETWORK_TYPE, [
networkID,
networks,
])
const foundTokenInfo = tokenInfoList.find(token => token.tokenID === accountToClaim?.account.tokenID)
const accountNames = useMemo(() => sUDTAccounts.filter(v => !!v.accountName).map(v => v.accountName!), [sUDTAccounts])
const updateAccountDialogProps: SUDTUpdateDialogProps | undefined = accountToClaim?.account
Expand Down Expand Up @@ -384,6 +389,7 @@ const SpecialAssetList = () => {
sUDTAccounts={sUDTAccounts}
isMainnet={isMainnet}
walletID={id}
isLightClient={isLightClient}
/>
</dialog>
)}
Expand Down
5 changes: 3 additions & 2 deletions packages/neuron-ui/src/widgets/InputSelect/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@ export interface InputSelectProps {
onChange?: (value: string, arg?: SelectOptions) => void
value?: string
placeholder?: string
inputDisabeld?: boolean
}

function parseValue(value: string, options: SelectOptions[]) {
const option = options.find(o => o.value === value)
return option?.value || value
}

const Select = ({ value, options, placeholder, disabled, onChange, className }: InputSelectProps) => {
const Select = ({ value, options, placeholder, disabled, onChange, className, inputDisabeld }: InputSelectProps) => {
const mounted = useRef(true)
const root = useRef<HTMLDivElement>(null)
const openRef = useRef<boolean>(false)
Expand Down Expand Up @@ -121,7 +122,7 @@ const Select = ({ value, options, placeholder, disabled, onChange, className }:
tabIndex={0}
data-open={openRef.current}
>
<input className={placeholderClass} onChange={onInputChange} value={value ?? innerValue} />
<input disabled={inputDisabeld} className={placeholderClass} onChange={onInputChange} value={value ?? innerValue} />
<div className={styles.arrow} />
</div>
{openRef.current ? (
Expand Down

0 comments on commit beea565

Please sign in to comment.