Merge branch 'Thunnini/owner-check'

This commit is contained in:
Thunnini 2022-12-18 23:10:34 +09:00
commit 53e3ec81ee

View File

@ -31,7 +31,7 @@ import {
sendMsgs, sendMsgs,
simulateMsgs, simulateMsgs,
} from "../../wallets"; } from "../../wallets";
import { ChainIdHelper } from "@keplr-wallet/cosmos"; import { Bech32Address, ChainIdHelper } from "@keplr-wallet/cosmos";
import { AllChainsItem } from "../../components/chain-list/all-chains-item"; import { AllChainsItem } from "../../components/chain-list/all-chains-item";
import { SearchInput } from "../../components/search-input"; import { SearchInput } from "../../components/search-input";
@ -89,8 +89,8 @@ export default function VerificationPage() {
const [searchValue, setSearchValue] = useState(""); const [searchValue, setSearchValue] = useState("");
const [nftOwnerAddress, setNFTOwnerAddress] = useState("");
const [isOwner, setIsOwner] = useState(false); const [isOwner, setIsOwner] = useState(false);
// const [isAgree, setIsAgree] = useState(false);
const [isModalOpen, setModalOpen] = useState(false); const [isModalOpen, setModalOpen] = useState(false);
@ -193,6 +193,7 @@ export default function VerificationPage() {
if (keplrWallet) { if (keplrWallet) {
const key = await keplrWallet.getKey(MainChainId); const key = await keplrWallet.getKey(MainChainId);
setIsOwner(ownerOfQueryResponse.data.owner === key.bech32Address); setIsOwner(ownerOfQueryResponse.data.owner === key.bech32Address);
setNFTOwnerAddress(ownerOfQueryResponse.data.owner);
} }
const addressesQueryResponse = await queryAddressesFromTwitterName( const addressesQueryResponse = await queryAddressesFromTwitterName(
@ -406,6 +407,10 @@ export default function VerificationPage() {
}; };
const isRegisterButtonDisable = (() => { const isRegisterButtonDisable = (() => {
if (!isOwner) {
return true;
}
const hasCheckedItem = checkedItems.size > 0; const hasCheckedItem = checkedItems.size > 0;
return !hasCheckedItem; return !hasCheckedItem;
@ -422,7 +427,6 @@ export default function VerificationPage() {
<ContentContainer> <ContentContainer>
<BackButton /> <BackButton />
<TwitterProfile twitterProfileInformation={twitterAuthInfo} /> <TwitterProfile twitterProfileInformation={twitterAuthInfo} />
<ChainListTitleContainer> <ChainListTitleContainer>
<ChainListTitle>Chain List</ChainListTitle> <ChainListTitle>Chain List</ChainListTitle>
<SearchInput <SearchInput
@ -430,7 +434,6 @@ export default function VerificationPage() {
setSearchValue={setSearchValue} setSearchValue={setSearchValue}
/> />
</ChainListTitleContainer> </ChainListTitleContainer>
{!searchValue ? ( {!searchValue ? (
<AllChainsItem <AllChainsItem
chainList={chainList} chainList={chainList}
@ -438,7 +441,6 @@ export default function VerificationPage() {
setCheckedItems={setCheckedItems} setCheckedItems={setCheckedItems}
/> />
) : null} ) : null}
<ChainList <ChainList
chainList={chainList.filter( chainList={chainList.filter(
(chain) => (chain) =>
@ -456,14 +458,14 @@ export default function VerificationPage() {
setCheckedItems={setCheckedItems} setCheckedItems={setCheckedItems}
/> />
{/*<AgreeContainer*/} {!isOwner && nftOwnerAddress ? (
{/* onClick={() => {*/} <OwnerAlert>
{/* setIsAgree(!isAgree);*/} You are not owner of this name.
{/* }}*/} <br />
{/*>*/} Please select the account (
{/* <AgreeCheckBox type="checkbox" checked={isAgree} readOnly />I*/} {Bech32Address.shortenAddress(nftOwnerAddress, 28)})
{/* check that Osmo is required for this transaction*/} </OwnerAlert>
{/*</AgreeContainer>*/} ) : null}
{chainList.length > 0 && ( {chainList.length > 0 && (
<ButtonContainer disabled={isRegisterButtonDisable}> <ButtonContainer disabled={isRegisterButtonDisable}>
@ -553,30 +555,15 @@ const ChainListTitle = styled.div`
color: ${color.white}; color: ${color.white};
`; `;
// const AgreeContainer = styled.div` const OwnerAlert = styled.div`
// display: flex; font-family: "Inter", serif;
// align-items: center; font-style: normal;
// gap: 0.5rem; font-weight: 500;
// font-size: 0.9rem;
// font-family: "Inter", serif; line-height: 1.1rem;
// font-style: normal; text-align: center;
// font-weight: 500;
// font-size: 0.8rem; color: ${color.grey["400"]};
// line-height: 0.8rem;
// padding-top: 1.25rem;
// text-transform: uppercase; `;
// user-select: none;
//
// color: ${color.grey["400"]};
//
// padding: 2rem 0;
//
// cursor: pointer;
// `;
//
// const AgreeCheckBox = styled.input.attrs({ type: "checkbox" })`
// width: 1.2rem;
// height: 1.2rem;
//
// accent-color: ${color.orange["200"]};
// `;