Skip to content

Commit

Permalink
Merge pull request #1021 from chainapsis/retto/QA-register-vote-setting
Browse files Browse the repository at this point in the history
[QA] qa 사항들과 기타 버그들 수정
  • Loading branch information
Thunnini authored Jan 16, 2024
2 parents 422088a + a3c7210 commit 0546a3f
Show file tree
Hide file tree
Showing 18 changed files with 295 additions and 253 deletions.
4 changes: 1 addition & 3 deletions packages/mobile/src/components/empty-view/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ export const EmptyView: FunctionComponent<
No {subject} Yet
</Text>
) : (
<Text style={style.flatten(['color-gray-400', 'subtitle3'])}>
{children}
</Text>
children
)}
</Box>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {YAxis} from '../../axis';
import {Stack} from '../../stack';
import {Text} from 'react-native';
import {AddressItem} from '../../address-item';
import {EmptyView} from '../../empty-view';
import {EmptyView, EmptyViewText} from '../../empty-view';
import {registerCardModal} from '../../modal/card';
import {ScrollView} from '../../scroll-view/common-scroll-view';

Expand Down Expand Up @@ -259,13 +259,21 @@ export const AddressBookModal = registerCardModal(
{(() => {
switch (type) {
case 'accounts':
return intl.formatMessage({
id: 'components.address-book-modal.empty-view-accounts',
});
return (
<EmptyViewText
text={intl.formatMessage({
id: 'components.address-book-modal.empty-view-accounts',
})}
/>
);
default:
return intl.formatMessage({
id: 'components.address-book-modal.empty-view-default',
});
return (
<EmptyViewText
text={intl.formatMessage({
id: 'components.address-book-modal.empty-view-default',
})}
/>
);
}
})()}
</EmptyView>
Expand Down
14 changes: 14 additions & 0 deletions packages/mobile/src/components/pageHeader/header-register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,26 @@ export const RegisterHeaderTitle: FunctionComponent<PropsWithChildren> = ({
children,
}) => {
const style = useStyle();

return (
<Text style={style.flatten(['h3', 'color-text-high', 'text-center'])}>
{children}
</Text>
);
};

export const RegisterHeaderTitleH4: FunctionComponent<PropsWithChildren> = ({
children,
}) => {
const style = useStyle();

return (
<Text style={style.flatten(['h4', 'color-text-high', 'text-center'])}>
{children}
</Text>
);
};

export const registerHeaderOptions = {
headerTitle: RegisterHeaderTitle,
headerTitleAlign: 'center' as 'center' | 'left',
Expand Down
2 changes: 1 addition & 1 deletion packages/mobile/src/languages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
"page.setting.general.delete-suggest-chain.empty-text": "No Chain Added Yet",
"page.setting.general.delete-suggest-chain.chain-item.tooltip-text": "The infrastructure and setting of this chain is not configured by Keplr team. Please reach out to the chain or website team for technical support.",

"page.setting.general.manage-WC.empty-text": "Not Wallet Connect Sessions yet",
"page.setting.general.manage-WC.empty-text": "No WalletConnect Sessions yet",

"page.setting.security.connected-websites-title": "Connected Websites",
"page.setting.security.connected-websites-paragraph": "Websites that can view your address and make requests for signing",
Expand Down
2 changes: 1 addition & 1 deletion packages/mobile/src/languages/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
"page.setting.general.delete-suggest-chain.empty-text": "추가된 체인이 없습니다.",
"page.setting.general.delete-suggest-chain.chain-item.tooltip-text": "해당 체인의 인프라와 설정은 케플러팀 관할이 아닙니다. 체인 운영팀이나 연결한 웹사이트 관리자에게 연락하여 지원을 받으시길 바랍니다.",

"page.setting.general.manage-WC.empty-text": "Not Wallet Connect Sessions yet",
"page.setting.general.manage-WC.empty-text": "No WalletConnect Sessions yet",

"page.setting.security.connected-websites-title": "연결된 웹사이트",
"page.setting.security.connected-websites-paragraph": "이 웹사이트들은 당신의 지갑 주소를 조회하고, 서명을 요청할 수 있습니다.",
Expand Down
7 changes: 6 additions & 1 deletion packages/mobile/src/navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ import {
import {SettingGeneralVersionScreen} from './screen/setting/screens/general/version';
import {CameraScreen} from './screen/camera';
import {SettingGeneralManageWalletConnectScreen} from './screen/setting/screens/security/wallet-connect';
import {registerHeaderOptions} from './components/pageHeader/header-register';
import {
RegisterHeaderTitleH4,
registerHeaderOptions,
} from './components/pageHeader/header-register';
import {MigrationWelcomeScreen} from './screen/migration-welcome';
import {RegisterGoogleSignInScreen} from './screen/register/google-sign-in';
import {RegisterAppleSignInScreen} from './screen/register/apple-sign-in';
Expand Down Expand Up @@ -417,6 +420,7 @@ export const RegisterNavigation: FunctionComponent = () => {
id: 'pages.register.connect-hardware.header.title',
}),
...registerHeaderOptions,
headerTitle: RegisterHeaderTitleH4,
}}
/>

Expand Down Expand Up @@ -1025,6 +1029,7 @@ export const AppNavigation: FunctionComponent = observer(() => {
id: 'pages.register.connect-ledger.title',
}),
...registerHeaderOptions,
headerTitle: RegisterHeaderTitleH4,
}}
component={ConnectLedgerScreen}
/>
Expand Down
171 changes: 88 additions & 83 deletions packages/mobile/src/screen/governance/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ const embedChainInfosIdentifiers = EmbedChainInfos.map(

export const GovernanceScreen: FunctionComponent = observer(() => {
const style = useStyle();
const {hugeQueriesStore, queriesStore, scamProposalStore} = useStore();
const {hugeQueriesStore, queriesStore, scamProposalStore, chainStore} =
useStore();
const [isOpenSelectChainModal, setIsOpenSelectChainModal] = useState(false);
const [isOpenInfoModal, setIsOpenInfoModal] = useState(false);
const navigation = useNavigation<StackNavProp>();
const intl = useIntl();
const isFetching = useRef(true);
const isFetching = useRef(false);

useEffectOnce(() => {
navigation.setOptions({
Expand Down Expand Up @@ -82,99 +83,103 @@ export const GovernanceScreen: FunctionComponent = observer(() => {
);

const modalItems: SelectModalItem[] = useMemo(() => {
return hugeQueriesStore.stakables
.filter(viewToken =>
embedChainInfosIdentifiers.includes(
ChainIdHelper.parse(viewToken.chainInfo.chainId).identifier,
),
return chainStore.chainInfos
.filter(
chainInfo => chainInfo.embedded.embedded && chainInfo.stakeCurrency,
)
.filter(
viewToken =>
chainInfo =>
!NoDashboardLinkIdentifiers.includes(
ChainIdHelper.parse(viewToken.chainInfo.chainId).identifier,
ChainIdHelper.parse(chainInfo.chainId).identifier,
),
)
.map(viewToken => {
.map(chainInfo => {
return {
key: viewToken.chainInfo.chainId,
label: viewToken.chainInfo.chainName,
imageUrl: viewToken.chainInfo.chainSymbolImageUrl,
key: chainInfo.chainId,
label: chainInfo.chainName,
imageUrl: chainInfo.chainSymbolImageUrl,
} as SelectModalItem;
});
}, [hugeQueriesStore.stakables]);
}, [chainStore.chainInfos]);

const viewItems = delegations
.filter(
viewToken =>
!NoDashboardLinkIdentifiers.includes(
ChainIdHelper.parse(viewToken.chainInfo.chainId).identifier,
),
)
.map(delegation => {
const isGovV1Supported =
GovernanceV1ChainIdentifiers.includes(
ChainIdHelper.parse(delegation.chainInfo.chainId).identifier,
) ||
!(
//NOTE gov/v1이 구현되어있지 않을때 error code 12가 반환되서 일단 이렇게 검증함
(
const viewItems = (() => {
if (delegations.length) {
isFetching.current = true;
}

return delegations
.filter(
viewToken =>
!NoDashboardLinkIdentifiers.includes(
ChainIdHelper.parse(viewToken.chainInfo.chainId).identifier,
),
)
.map(delegation => {
const isGovV1Supported =
GovernanceV1ChainIdentifiers.includes(
ChainIdHelper.parse(delegation.chainInfo.chainId).identifier,
) ||
!(
//NOTE gov/v1이 구현되어있지 않을때 error code 12가 반환되서 일단 이렇게 검증함
(
queriesStore
.get(delegation.chainInfo.chainId)
.governanceV1.queryGovernance.getQueryGovernance({
status: 'PROPOSAL_STATUS_VOTING_PERIOD',
'pagination.limit': 3000,
}).error?.data as {code: number}
)?.code === 12
)
);
(
queriesStore
.get(delegation.chainInfo.chainId)
.governanceV1.queryGovernance.getQueryGovernance({
status: 'PROPOSAL_STATUS_VOTING_PERIOD',
'pagination.limit': 3000,
}).error?.data as {code: number}
)?.code === 12
)
);

const queryGovernance = isGovV1Supported
? queriesStore
.get(delegation.chainInfo.chainId)
.governanceV1.queryGovernance.getQueryGovernance({
status: 'PROPOSAL_STATUS_VOTING_PERIOD',
'pagination.limit': 3000,
})
: queriesStore
.get(delegation.chainInfo.chainId)
.governance.queryGovernance.getQueryGovernance({
status: 'PROPOSAL_STATUS_VOTING_PERIOD',
});
const queryGovernance = isGovV1Supported
? queriesStore
.get(delegation.chainInfo.chainId)
.governanceV1.queryGovernance.getQueryGovernance({
status: 'PROPOSAL_STATUS_VOTING_PERIOD',
'pagination.limit': 3000,
})
: queriesStore
.get(delegation.chainInfo.chainId)
.governance.queryGovernance.getQueryGovernance({
status: 'PROPOSAL_STATUS_VOTING_PERIOD',
});

//NOTE delegations중 하나라도 완료가 되면 isFetching을 false로 설정하고 변경하지 않음
isFetching.current =
!isFetching.current || !queryGovernance.isFetching ? false : true;
//NOTE delegations중 하나라도 완료가 되면 isFetching을 false로 설정하고 변경하지 않음
isFetching.current =
!isFetching.current || !queryGovernance.isFetching ? false : true;

return isGovV1Supported
? {
isGovV1Supported,
proposalLen: queryGovernance.proposals.filter(
proposal =>
!scamProposalStore.isScamProposal(
delegation.chainInfo.chainId,
proposal.id,
),
).length,
chainId: delegation.chainInfo.chainId,
imageUrl: delegation.chainInfo.chainSymbolImageUrl,
chainName: delegation.chainInfo.chainName,
}
: {
isGovV1Supported,
proposalLen: queryGovernance.proposals.filter(
proposal =>
!scamProposalStore.isScamProposal(
delegation.chainInfo.chainId,
proposal.id,
),
).length,
chainId: delegation.chainInfo.chainId,
imageUrl: delegation.chainInfo.chainSymbolImageUrl,
chainName: delegation.chainInfo.chainName,
};
})
.filter(viewItem => viewItem.proposalLen !== 0);
return isGovV1Supported
? {
isGovV1Supported,
proposalLen: queryGovernance.proposals.filter(
proposal =>
!scamProposalStore.isScamProposal(
delegation.chainInfo.chainId,
proposal.id,
),
).length,
chainId: delegation.chainInfo.chainId,
imageUrl: delegation.chainInfo.chainSymbolImageUrl,
chainName: delegation.chainInfo.chainName,
}
: {
isGovV1Supported,
proposalLen: queryGovernance.proposals.filter(
proposal =>
!scamProposalStore.isScamProposal(
delegation.chainInfo.chainId,
proposal.id,
),
).length,
chainId: delegation.chainInfo.chainId,
imageUrl: delegation.chainInfo.chainSymbolImageUrl,
chainName: delegation.chainInfo.chainName,
};
})
.filter(viewItem => viewItem.proposalLen !== 0);
})();

return (
<PageWithScrollView
Expand Down Expand Up @@ -225,7 +230,7 @@ export const GovernanceScreen: FunctionComponent = observer(() => {
<React.Fragment>
<Gutter size={100} />
<EmptyView>
<Box alignX="center">
<Box alignX="center" paddingX={39}>
<EmptyViewText
text={intl.formatMessage({
id: 'page.governance.main.empty-title',
Expand Down
18 changes: 12 additions & 6 deletions packages/mobile/src/screen/governance/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ import React, {FunctionComponent, useMemo, useRef, useState} from 'react';
import {observer} from 'mobx-react-lite';
import {RouteProp, useRoute} from '@react-navigation/native';
import {GovernanceNavigation} from '../../../navigation';
import {RefreshControl, StyleSheet, Text} from 'react-native';
import {RefreshControl, StyleSheet} from 'react-native';
import {GovernanceCardBody} from '../components/card';
import {useStore} from '../../../stores';
import {ProposalStatus} from '../../../stores/governance/types';
import {GovernanceV1ChainIdentifiers} from '../../../config';
import {ChainIdHelper} from '@keplr-wallet/cosmos';
import {Gutter} from '../../../components/gutter';
import {EmptyView} from '../../../components/empty-view';
import {FormattedMessage} from 'react-intl';
import {EmptyView, EmptyViewText} from '../../../components/empty-view';
import {useIntl} from 'react-intl';
import {useStyle} from '../../../styles';
import {useSafeAreaInsets} from 'react-native-safe-area-context';
import {FlatList} from '../../../components/flat-list';
import {Box} from '../../../components/box';

const DEFAULT_PARAMS = {
'pagination.offset': 0,
Expand All @@ -24,6 +25,7 @@ export const GovernanceListScreen: FunctionComponent = observer(() => {
const {queriesStore, scamProposalStore} = useStore();
const style = useStyle();
const route = useRoute<RouteProp<GovernanceNavigation, 'Governance.list'>>();
const intl = useIntl();
const [params, setParams] = useState({page: 0, perPageNumber: 20});
const {chainId, isGovV1Supported} = route.params;
const governanceV1 = queriesStore.get(chainId).governanceV1.queryGovernance;
Expand Down Expand Up @@ -126,9 +128,13 @@ export const GovernanceListScreen: FunctionComponent = observer(() => {
<React.Fragment>
<Gutter size={138} />
<EmptyView>
<Text>
<FormattedMessage id="page.governance.proposal-list.empty-text" />
</Text>
<Box alignX="center" paddingX={60}>
<EmptyViewText
text={intl.formatMessage({
id: 'page.governance.proposal-list.empty-text',
})}
/>
</Box>
</EmptyView>
</React.Fragment>
)
Expand Down
Loading

0 comments on commit 0546a3f

Please sign in to comment.