Skip to content

Commit

Permalink
🚧
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Burg committed Aug 22, 2023
1 parent 0e863b4 commit a67f65d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
15 changes: 9 additions & 6 deletions batcher-ui/components/BatcherInfo/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const BatcherInfo = () => {

return (
<div className="font-custom">
<div className="flex flex-row p-3">
<div className="flex flex-col md:flex-row p-3">
<div className="flex flex-direction-col border-solid border-2 border-[#7B7B7E]">
<div className="p-3">
<p className="text-xl font-mono">Batcher Time Remaining</p>
Expand All @@ -47,7 +47,7 @@ const BatcherInfo = () => {
<p>
{`${
status === BatcherStatus.CLEARED
? 'LastBatch'
? 'Last batch : '
: 'Current batch : '
} ${batchNumber}`}
</p>
Expand All @@ -59,7 +59,7 @@ const BatcherInfo = () => {
</div>
<div className="border-[#7B7B7E] border-2 border-solid">
<div className="flex flex-col batcher-balance-title">
<div className="flex border-solid border-2 border-[#7B7B7E]">
<div className="flex flex-row border-solid border-2 border-[#7B7B7E] justify-between">
<p className="batcher-title p-3">Balances</p>
<p className="batcher-title p-3">
{currentSwap.isReverse
Expand All @@ -85,15 +85,18 @@ const BatcherInfo = () => {
</p>
</div>
</div>
<div className="flex flex-row border-[#7B7B7E] border-2 border-solid">
<div className="flex flex-row border-[#7B7B7E] border-2 border-solid justify-between">
<p className="p-4">Address</p>
{userAddress ? (
<p>{userAddress}</p>
<p className="p-4">{`${userAddress.substring(
0,
3
)}...${userAddress.substring(userAddress.length - 3)}`}</p>
) : (
<p className="p-4">No Wallet connected</p>
)}
</div>
<div className="flex flex-row border-[#7B7B7E] border-2 border-solid">
<div className="flex flex-row border-[#7B7B7E] border-2 border-solid justify-between">
<p className="p-4">Oracle Price</p>
<p className="p-4">
{oraclePrice} {tokenPair}
Expand Down
16 changes: 8 additions & 8 deletions batcher-ui/contexts/events.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { HubConnection, HubConnectionBuilder } from '@microsoft/signalr';
import React, { createContext, useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { /* HubConnection */ HubConnectionBuilder } from '@microsoft/signalr';
import React, { createContext, useEffect } from 'react';
// import { useSelector } from 'react-redux';
import { useDispatch } from 'react-redux';
import { newEvent } from 'src/actions/events';
import { userAddressSelector } from 'src/reducers';
import { setup, subscribeTokenBalances } from 'utils/webSocketUtils';
// import { userAddressSelector } from 'src/reducers';
import { setup /* subscribeTokenBalances */ } from 'utils/webSocketUtils';

export const EventsContext = createContext<{}>({});

export const EventsProvider = ({ children }: { children: React.ReactNode }) => {
const [socket, setSocket] = useState<HubConnection | undefined>(undefined);
// const [socket, setSocket] = useState<HubConnection | undefined>(undefined);
const dispatch = useDispatch();
const userAddress = useSelector(userAddressSelector);
// const userAddress = useSelector(userAddressSelector);

useEffect(() => {
const socket = new HubConnectionBuilder()
.withUrl(process.env.NEXT_PUBLIC_TZKT_URI_API + '/v1/ws')
.build();
setup(socket);
setSocket(socket);
// setSocket(socket);
socket.on('bigmaps', e => {
if (e.data) dispatch(newEvent(e));
});
Expand Down

0 comments on commit a67f65d

Please sign in to comment.