28b4593a1d
Co-authored-by: bwallacee <ben@vega.xyz>
46 lines
1.3 KiB
TypeScript
46 lines
1.3 KiB
TypeScript
import { useVegaWallet } from '@vegaprotocol/wallet-react';
|
|
import { FillsManager } from '@vegaprotocol/fills';
|
|
import { create } from 'zustand';
|
|
import { persist } from 'zustand/middleware';
|
|
import { useDataGridEvents } from '@vegaprotocol/datagrid';
|
|
import { Splash } from '@vegaprotocol/ui-toolkit';
|
|
import type { DataGridSlice } from '../../stores/datagrid-store-slice';
|
|
import { createDataGridSlice } from '../../stores/datagrid-store-slice';
|
|
import { useMarketClickHandler } from '../../lib/hooks/use-market-click-handler';
|
|
import { useT } from '../../lib/use-t';
|
|
|
|
export const FillsContainer = () => {
|
|
const t = useT();
|
|
const onMarketClick = useMarketClickHandler(true);
|
|
const { pubKey } = useVegaWallet();
|
|
|
|
const gridStore = useFillsStore((store) => store.gridStore);
|
|
const updateGridStore = useFillsStore((store) => store.updateGridStore);
|
|
|
|
const gridStoreCallbacks = useDataGridEvents(gridStore, (colState) => {
|
|
updateGridStore(colState);
|
|
});
|
|
|
|
if (!pubKey) {
|
|
return (
|
|
<Splash>
|
|
<p>{t('Please connect Vega wallet')}</p>
|
|
</Splash>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<FillsManager
|
|
partyId={pubKey}
|
|
onMarketClick={onMarketClick}
|
|
gridProps={gridStoreCallbacks}
|
|
/>
|
|
);
|
|
};
|
|
|
|
export const useFillsStore = create<DataGridSlice>()(
|
|
persist(createDataGridSlice, {
|
|
name: 'vega_fills_store',
|
|
})
|
|
);
|