fix: build issue

This commit is contained in:
bartosz-lipinski 2021-02-11 13:33:10 -06:00
parent e960d1d19b
commit 9c92d884c4
11 changed files with 20 additions and 37 deletions

View File

@ -1,9 +1,7 @@
import { Button, Dropdown, Menu } from "antd";
import { ButtonProps } from "antd/lib/button";
import React from "react";
import { LABELS } from "../../constants";
import { contexts } from '@oyster/common';
const { useWallet } = contexts.Wallet;
import { useWallet } from './../../contexts/wallet';
export interface ConnectButtonProps extends ButtonProps, React.RefAttributes<HTMLElement> {
allowWalletChange?: boolean;
@ -29,7 +27,7 @@ export const ConnectButton = (
onClick={connected ? onClick : connect}
disabled={connected && disabled}
>
{connected ? props.children : LABELS.CONNECT_LABEL}
{connected ? props.children : 'Connect'}
</Button>;
}
@ -38,7 +36,7 @@ export const ConnectButton = (
onClick={connected ? onClick : connect}
disabled={connected && disabled}
overlay={menu}>
{LABELS.CONNECT_LABEL}
Connect
</Dropdown.Button>
);
};

View File

@ -1 +1,2 @@
export { ExplorerLink } from './ExplorerLink/index';
export { ConnectButton } from './ConnectButton/index';

View File

@ -41,6 +41,7 @@ export const WALLET_PROVIDERS = [
export interface WalletAdapter extends EventEmitter {
publicKey: PublicKey | null,
signTransaction: (transaction: Transaction) => Promise<Transaction>;
// signMultipleTransaction: (transaction: Transaction[]) => Promise<Transaction[]>;
connect: () => any,
disconnect: () => any,
}

View File

@ -1,5 +1,5 @@
export * as actions from './actions';
export * as components from './components';
export * from './components';
export * as config from './config';
export * as constants from './constants';
export * as hooks from './hooks';

View File

@ -1,6 +1,6 @@
import React from 'react';
import { Button, Popover } from 'antd';
import { contexts } from '@oyster/common';
import { contexts, ConnectButton } from '@oyster/common';
import { CurrentUserBadge } from '../CurrentUserBadge';
import { SettingOutlined } from '@ant-design/icons';
import { Settings } from '../Settings';
@ -12,26 +12,15 @@ export const AppBar = (props: { left?: JSX.Element; right?: JSX.Element }) => {
const TopBar = (
<div className="App-Bar-right">
<CurrentUserBadge />
<div>
{!connected && (
<Button
{connected ? (
<CurrentUserBadge />
) : (
<ConnectButton
type="text"
size="large"
onClick={connected ? wallet?.disconnect : wallet?.connect}
style={{ color: '#2abdd2' }}
>
{LABELS.CONNECT_BUTTON}
</Button>
)}
{connected && (
<Popover
placement="bottomRight"
title={LABELS.WALLET_TOOLTIP}
trigger="click"
></Popover>
)}
</div>
allowWalletChange={true}
style={{ color: "#2abdd2" }}/>
)}
<Popover
placement="topRight"
title={LABELS.SETTINGS_TOOLTIP}

View File

@ -11,14 +11,13 @@ import {
LendingReserveParser,
} from '../../models';
import { Card } from 'antd';
import { contexts, ParsedAccount } from '@oyster/common';
import { contexts, ParsedAccount, ConnectButton } from '@oyster/common';
import { borrow } from '../../actions';
import './style.less';
import { LABELS } from '../../constants';
import { ActionConfirmation } from './../ActionConfirmation';
import { BackButton } from './../BackButton';
import { ConnectButton } from '../ConnectButton';
import CollateralInput from '../CollateralInput';
import { useMidPriceInUSD } from '../../contexts/market';
import { RiskSlider } from '../RiskSlider';

View File

@ -7,9 +7,8 @@ import { PublicKey } from '@solana/web3.js';
import './style.less';
import { ActionConfirmation } from './../ActionConfirmation';
import { LABELS, marks } from '../../constants';
import { ConnectButton } from '../ConnectButton';
import CollateralInput from '../CollateralInput';
import { contexts } from '@oyster/common';
import { contexts, ConnectButton } from '@oyster/common';
const { useWallet } = contexts.Wallet;
const { useConnection } = contexts.Connection;

View File

@ -3,7 +3,7 @@ import Card from 'antd/lib/card';
import React, { useCallback, useEffect } from 'react';
import { useState } from 'react';
import { LABELS, marks } from '../../constants';
import { ParsedAccount, contexts, utils } from '@oyster/common';
import { ParsedAccount, contexts, utils, ConnectButton } from '@oyster/common';
import {
EnrichedLendingObligation,
InputType,
@ -15,7 +15,6 @@ import { ActionConfirmation } from '../ActionConfirmation';
import { liquidate } from '../../actions';
import './style.less';
import CollateralInput from '../CollateralInput';
import { ConnectButton } from '../ConnectButton';
import { useMidPriceInUSD } from '../../contexts/market';
const { notify, fromLamports, wadToLamports } = utils;
const { useConnection } = contexts.Connection;

View File

@ -7,12 +7,11 @@ import {
} from '../../hooks';
import { LendingReserve } from '../../models';
import { Card, Slider } from 'antd';
import { ParsedAccount, contexts, utils, hooks } from '@oyster/common';
import { ParsedAccount, contexts, utils, hooks, ConnectButton } from '@oyster/common';
import { repay } from '../../actions';
import './style.less';
import { LABELS, marks } from '../../constants';
import { ActionConfirmation } from './../ActionConfirmation';
import { ConnectButton } from '../ConnectButton';
import CollateralInput from '../CollateralInput';
import { useMidPriceInUSD } from '../../contexts/market';

View File

@ -12,9 +12,8 @@ import { PublicKey } from '@solana/web3.js';
import './style.less';
import { LABELS, marks } from '../../constants';
import { ActionConfirmation } from './../ActionConfirmation';
import { ConnectButton } from '../ConnectButton';
import CollateralInput from '../CollateralInput';
import { contexts } from '@oyster/common';
import { contexts, ConnectButton } from '@oyster/common';
const { useConnection } = contexts.Connection;
const { useWallet } = contexts.Wallet;

View File

@ -1,9 +1,8 @@
import React, { useCallback } from 'react';
import { Card } from 'antd';
import { LAMPORTS_PER_SOL } from '@solana/web3.js';
import { ConnectButton } from './../../components/ConnectButton';
import { LABELS } from '../../constants';
import { contexts, utils } from '@oyster/common';
import { contexts, utils, ConnectButton } from '@oyster/common';
const { useConnection } = contexts.Connection;
const { useWallet } = contexts.Wallet;
const { notify } = utils;