2023-02-28 18:56:29 +00:00
|
|
|
import { t } from '@vegaprotocol/i18n';
|
2022-03-30 00:01:34 +00:00
|
|
|
import { Splash } from '@vegaprotocol/ui-toolkit';
|
2022-03-27 09:40:27 +00:00
|
|
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
2022-03-30 00:01:34 +00:00
|
|
|
import { PositionsManager } from './positions-manager';
|
2022-03-25 12:40:08 +00:00
|
|
|
|
2023-01-19 21:53:10 +00:00
|
|
|
export const PositionsContainer = ({
|
|
|
|
onMarketClick,
|
|
|
|
}: {
|
|
|
|
onMarketClick?: (marketId: string) => void;
|
|
|
|
}) => {
|
2023-01-31 16:04:52 +00:00
|
|
|
const { pubKey, isReadOnly } = useVegaWallet();
|
2022-03-30 00:01:34 +00:00
|
|
|
|
2022-10-03 18:12:34 +00:00
|
|
|
if (!pubKey) {
|
2022-03-30 00:01:34 +00:00
|
|
|
return (
|
|
|
|
<Splash>
|
2022-03-31 01:08:25 +00:00
|
|
|
<p>{t('Please connect Vega wallet')}</p>
|
2022-03-30 00:01:34 +00:00
|
|
|
</Splash>
|
|
|
|
);
|
|
|
|
}
|
2023-01-31 16:04:52 +00:00
|
|
|
return (
|
|
|
|
<PositionsManager
|
|
|
|
partyId={pubKey}
|
|
|
|
onMarketClick={onMarketClick}
|
|
|
|
isReadOnly={isReadOnly}
|
|
|
|
/>
|
|
|
|
);
|
2022-03-25 12:40:08 +00:00
|
|
|
};
|