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

add nft #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added iwallet-nft.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "toshi-frontend-boilerplate",
"version": "0.0.1",
"version": "0.0.2",
"description": "boilerplate",
"directories": {
"test": "test"
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "iWallet Pro",
"manifest_version": 3,
"version": "0.0.1",
"version": "0.0.2",
"description": "Brand New Version Wallet Extension for lOST",
"action": {
"default_popup": "index.html",
Expand Down
52 changes: 38 additions & 14 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
import React, { Component, Fragment } from 'react'
import { connect } from 'react-redux'
import { Login, Account, AccountImport, AccountManage, DeveloperMode, TokenTransfer, TokenTransferFailed, TokenTransferSuccess,
AccountQRCode, AccountCreateStep1, AccountCreateStep2, AccountCreateStep3, AccountSetting, ChangePwd,
Lock, AccountAdd, ChangeLanguage, IostWallet, UserAgreement, GasManage, RamManage, WhiteList, TokenDetail,
AssetManage
import {
Login,
Account,
AccountImport,
AccountManage,
DeveloperMode,
TokenTransfer,
TokenTransferFailed,
TokenTransferSuccess,
AccountQRCode,
AccountCreateStep1,
AccountCreateStep2,
AccountCreateStep3,
AccountSetting,
ChangePwd,
Lock,
AccountAdd,
ChangeLanguage,
IostWallet,
UserAgreement,
GasManage,
RamManage,
WhiteList,
TokenDetail,
AssetManage,
NftDetail,
} from 'components'
import Settings from 'components/Settings'
import Popup from 'components/Popup'
Expand All @@ -13,7 +35,7 @@ import utils from 'utils'
import user from 'utils/user'
import * as accountActions from 'actions/accounts'
import './App.scss'
import ui from "utils/ui";
import ui from 'utils/ui'

type Props = {
children: React.DOM,
Expand All @@ -34,14 +56,14 @@ class App extends Component<Props> {
init = async () => {
try {
const enpassword = await user.getEnPassword()
if(enpassword){
if (enpassword) {
const lockState = await user.getLockState()
if(lockState === false){
if (lockState === false) {
//解锁页面
this.changeLocation('/lock')
}else {
} else {
const accounts = await user.getUsers()
if (accounts.length){
if (accounts.length) {
user.setUsers(accounts)
const activeAccount = await user.getActiveAccount()
const account = activeAccount || accounts[0]
Expand All @@ -55,22 +77,22 @@ class App extends Component<Props> {
await user.setActiveAccount(account)
this.changeLocation('/account')

chrome.storage.local.get(['activeAccount'], ({activeAccount}) => {
chrome.storage.local.get(['activeAccount'], ({ activeAccount }) => {
// console.log('当前账号', activeAccount)
})
}else {
} else {
this.changeLocation('/accountImport')
}
}
}else {
} else {
this.changeLocation('/login')
}
} catch (err) {
console.log(err)
}
}

changeLocation = (location) => {
changeLocation = location => {
this.setState({
currentLocation: location,
})
Expand Down Expand Up @@ -127,6 +149,8 @@ class App extends Component<Props> {
return <RamManage changeLocation={this.changeLocation} />
case '/tokenDetail':
return <TokenDetail changeLocation={this.changeLocation} />
case '/nftDetail':
return <NftDetail changeLocation={this.changeLocation} />
case '/assetManage':
return <AssetManage changeLocation={this.changeLocation} />
}
Expand All @@ -143,7 +167,7 @@ class App extends Component<Props> {
}
}

const mapStateToProps = (state) => ({
const mapStateToProps = state => ({
locale: state.i18n.locale,
})

Expand Down
1 change: 1 addition & 0 deletions src/actions/actionTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const TOGGLE_OVERLAY = 'TOGGLE_OVERLAY'

export const UPDATE_SAVED_TOKEN_SYMBOLS = 'UPDATE_SAVED_TOKEN_SYMBOLS'
export const SELECT_TOKEN = 'SELECT_TOKEN'
export const SELECT_NFT = 'SELECT_NFT'

export const SET_USER_INFO = 'SET_USER_INFO'
export const RESET_USER_INFO = 'RESET_USER_INFO'
Expand Down
22 changes: 13 additions & 9 deletions src/actions/token.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import {
UPDATE_SAVED_TOKEN_SYMBOLS,
SELECT_TOKEN,
} from 'actions/actionTypes'
import { UPDATE_SAVED_TOKEN_SYMBOLS, SELECT_TOKEN, SELECT_NFT } from 'actions/actionTypes'

export const updateSavedTokenSymbols = (tokenSymbols) => ({
export const updateSavedTokenSymbols = tokenSymbols => ({
type: UPDATE_SAVED_TOKEN_SYMBOLS,
payload: {
tokenSymbols,
}
},
})

export const selectToken = (tokenSymbol) => ({
export const selectToken = tokenSymbol => ({
type: SELECT_TOKEN,
payload: {
tokenSymbol: tokenSymbol,
}
})
},
})

export const selectNft = nftId => ({
type: SELECT_NFT,
payload: {
nftId: nftId,
},
})
8 changes: 3 additions & 5 deletions src/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import LoadingImage from 'components/LoadingImage'

import './Button.scss'

type Props = {
type Props = {}

}

const Button = (props) => (
<button {...props} className={cx('Button', props.className, {'btn-account': props.account})}>
const Button = props => (
<button {...props} className={cx('Button', props.className, { 'btn-account': props.account })}>
{props.children}
{props.isLoading && <LoadingImage />}
</button>
Expand Down
14 changes: 7 additions & 7 deletions src/components/Button.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "colors.scss";
@import 'colors.scss';

.Button {
width: 300px;
Expand All @@ -14,14 +14,15 @@
transition: background-color 300ms, color 300ms;

&:hover {
background-color: rgba($brand-black2, .8);
background-color: rgba($brand-black2, 0.8);
}

&:focus {
background-color: rgba($brand-black2, .9);
background-color: rgba($brand-black2, 0.9);
}
&:disabled {
background-color: #e9e9e9;
background-color: #e9e9e9 !important;
cursor: not-allowed !important;
}

&.btn-account {
Expand All @@ -32,20 +33,19 @@
border: 1px solid;
}


&--blue {
color: $brand-blue;
background-color: $white;
border: 1px solid $brand-blue;

&:hover {
color: $white;
background-color: rgba($brand-blue, .8);
background-color: rgba($brand-blue, 0.8);
}

&:focus {
color: $white;
background-color: rgba($brand-blue, .6);
background-color: rgba($brand-blue, 0.6);
}
}
}
Expand Down
Loading