Skip to content

Commit

Permalink
[fix] no more login prompt at start;
Browse files Browse the repository at this point in the history
[ipv] more info in ReceiveCard.
  • Loading branch information
louzhixian committed Aug 1, 2020
1 parent 65a76b3 commit e27e496
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 15 deletions.
23 changes: 16 additions & 7 deletions src/components/ReceiveCard.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<template>
<div>
<q-card flat>
<q-card-section class="column items-center">
<q-card-section class="column items-center q-pb-xs">
<vue-qrcode :value="addresses[type]" :width="200" />
</q-card-section>
<q-card-section class="column items-center">
<q-card-section class="column items-center q-py-xs">
<div class="text-caption text-grey">{{$t('receiveCard.label.address')}}</div>
<div class="text-center q-px-lg" style="min-height: 4rem;word-break: break-word">
<div
class="text-center text-subtitle2 q-px-lg"
style="min-height: 3.5rem;word-break: break-word;line-height:1.3"
>
{{addresses[type]}}
<q-btn
color="grey"
Expand All @@ -19,16 +22,22 @@
/>
</div>
</q-card-section>
<q-card-section class="column items-center q-py-xs">
<div
class="text-caption text-accent text-center q-pa-sm"
style="min-height: 4rem;line-height: 1.3"
>{{$t(`receiveCard.msg.${type}`)}}</div>
</q-card-section>
<q-separator spaced />
<div class="text-center text-h6 q-mb-xs">{{$t('receiveCard.msg.where')}}</div>
<div class="text-center text-h6 q-mb-sm">{{$t('receiveCard.msg.where')}}</div>
<q-tabs
v-model="type"
class="bg-grey-2 text-grey"
active-bg-color="white"
active-color="accent"
no-caps
>
<q-tab name="native" :label="$t('receiveCard.label.native')" />
<q-tab name="default" :label="$t('receiveCard.label.native')" />
<q-tab name="ckb" :label="$t('receiveCard.label.ckb')" />
<q-tab name="portal" :label="$t('receiveCard.label.portal')" />
</q-tabs>
Expand All @@ -47,10 +56,10 @@ export default defineComponent({
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
components: { VueQrcode },
setup() {
const type: Ref<'native' | 'ckb' | 'portal'> = ref('native');
const type: Ref<'default' | 'ckb' | 'portal'> = ref('default');
const { address, portalAddress } = useAccount();
const addresses = {
native: computed(() => address.value?.addressString || '-'),
default: computed(() => address.value?.addressString || '-'),
ckb: computed(() => address.value?.toCKBAddress() || '-'),
portal: computed(() => portalAddress.value || '-'),
};
Expand Down
8 changes: 6 additions & 2 deletions src/compositions/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ watch(address, async address => {
updateAccount(address),
loadTxRecords({ address }),
loadSwapRates(),
loadCards(),
authorized.value && loadCards(),
updateDao(address),
getPortalAddress(address),
initSocket(address)
Expand Down Expand Up @@ -328,7 +328,11 @@ export async function checkLoginStatus(address: string) {

watch(authorized, authorized => {
void loadTxRecords({ address: address.value });
authorized && void loadContacts();
if (authorized) {
console.log('[account] authorized: ', authorized);
void loadContacts();
void loadCards();
}
});

export function logout() {
Expand Down
1 change: 0 additions & 1 deletion src/compositions/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ export const checkAuthorization = async (
): Promise<string | undefined> => {
const AT = Cookies.get('AT+' + address);
if (!!AT) {
console.log('[api] AT: ', AT);
const { exp } = jwt.decode(AT) as Record<string, number>;
if (new Date().getTime() < exp * 1000 || bypass) {
return AT;
Expand Down
9 changes: 7 additions & 2 deletions src/i18n/en-us/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export default {
sendAmount: 'Pay Amount',
receiveAmount: 'Receive Amount',
hash,
rate: 'Rate',
rate,
range: 'Amount Range'
}
},
Expand All @@ -196,7 +196,12 @@ export default {
address
},
msg: {
where: 'From where?'
where: 'From where?',
default:
'Current ETH address. Others can send CKB to this address with Portal Wallet.',
ckb: 'The CKB full address corresponding to your ETH address.',
portal:
'A Transit address. When you need to transfer CKB from exchanges or CKB wallets with no full address support, please use this address.'
}
},
daoCard: {
Expand Down
11 changes: 8 additions & 3 deletions src/i18n/zh-cn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const loading = '加载中';
const login = '登录';
const note = '备注';
const ok = 'OK';
const rate = '费率';
const rate = '汇率';
const send = '发送';
const sent = '已发送';
const settings = '设置';
Expand Down Expand Up @@ -184,7 +184,7 @@ export default {
sendAmount: '支付数量',
receiveAmount: '获得数量',
hash,
rate: '费率',
rate,
range: '金额范围'
}
},
Expand All @@ -196,7 +196,12 @@ export default {
address
},
msg: {
where: '从哪里收款?'
where: '从哪里收款?',
default:
'当前登陆的以太坊地址。其他人可以通过 Portal Wallet 向这个地址发送 CKB 资产。',
ckb: '与当前以太坊地址相对应的 CKB 长地址。',
portal:
'一个中转地址。当您需要从交易所或者其他不支持长地址格式的 CKB 钱包接收 CKB 资产时,请使用这个地址。'
}
},
daoCard: {
Expand Down

1 comment on commit e27e496

@vercel
Copy link

@vercel vercel bot commented on e27e496 Aug 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.