-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix coordinator selector maker page #1157
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -545,7 +545,7 @@ const CoordinatorDialog = ({ open = false, onClose, network, shortAlias }: Props | |
|
||
<Divider /> | ||
|
||
{coordinator?.info?.swap_enabled === false ? ( | ||
{!coordinator?.info?.swap_enabled ? ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lintern auto-fix |
||
<ListItem {...listItemProps}> | ||
<ListItemIcon> | ||
<LinkIcon /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ import React, { useContext, useEffect, useMemo, useState } from 'react'; | |
import { useTranslation } from 'react-i18next'; | ||
import { | ||
InputAdornment, | ||
LinearProgress, | ||
ButtonGroup, | ||
Slider, | ||
Switch, | ||
|
@@ -103,7 +102,7 @@ const MakerForm = ({ | |
|
||
useEffect(() => { | ||
updateCoordinatorInfo(); | ||
}, [maker.coordinator]); | ||
}, [maker.coordinator, coordinatorUpdatedAt]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this change |
||
|
||
const updateCoordinatorInfo = (): void => { | ||
if (maker.coordinator != null) { | ||
|
@@ -516,7 +515,9 @@ const MakerForm = ({ | |
(makerHasAmountRange && (minAmountError || maxAmountError)) || | ||
(!makerHasAmountRange && maker.amount <= 0) || | ||
(maker.isExplicit && (maker.badSatoshisText !== '' || maker.satoshis === '')) || | ||
(!maker.isExplicit && maker.badPremiumText !== '') | ||
(!maker.isExplicit && maker.badPremiumText !== '') || | ||
federation.getCoordinator(maker.coordinator)?.info === undefined || | ||
federation.getCoordinator(maker.coordinator)?.limits === undefined | ||
); | ||
}, [maker, amountLimits, coordinatorUpdatedAt, fav.type, makerHasAmountRange]); | ||
|
||
|
@@ -613,11 +614,6 @@ const MakerForm = ({ | |
}} | ||
zoom={maker.latitude != null && maker.longitude != null ? 6 : undefined} | ||
/> | ||
<Collapse in={Object.keys(limits).lenght === 0}> | ||
<div style={{ display: Object.keys(limits) === 0 ? '' : 'none' }}> | ||
<LinearProgress /> | ||
</div> | ||
</Collapse> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I removed the linear progress in favor of the circular progress in coordinator's avatar |
||
<Collapse in={!(Object.keys(limits).lenght === 0 || collapseAll)}> | ||
<Grid container justifyContent='space-between' spacing={0} sx={{ maxHeight: '1em' }}> | ||
<Grid item> | ||
|
@@ -1165,10 +1161,10 @@ const MakerForm = ({ | |
</Collapse> | ||
|
||
<SelectCoordinator | ||
coordinator={maker.coordinator} | ||
setCoordinator={(coordinator) => { | ||
coordinatorAlias={maker.coordinator} | ||
setCoordinator={(coordinatorAlias) => { | ||
setMaker((maker) => { | ||
return { ...maker, coordinator }; | ||
return { ...maker, coordinator: coordinatorAlias }; | ||
}); | ||
}} | ||
/> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,6 @@ import type Coordinator from '../../models'; | |
import { statusBadgeColor, pn, amountToString, computeSats } from '../../utils'; | ||
import TakeButton from './TakeButton'; | ||
import { F2fMapDialog } from '../Dialogs'; | ||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lintern auto-fix |
||
import { type UseFederationStoreType, FederationContext } from '../../contexts/FederationContext'; | ||
import { type Order } from '../../models'; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,11 +106,11 @@ export const FederationContextProvider = ({ | |
useEffect(() => { | ||
// On bitcoin network change we reset book, limits and federation info and fetch everything again | ||
const newFed = initialFederationContext.federation; | ||
newFed.registerHook('onFederationReady', () => { | ||
setCoordinatorUpdatedAt(new Date().toISOString()); | ||
newFed.registerHook('onFederationUpdate', () => { | ||
setFederationUpdatedAt(new Date().toISOString()); | ||
}); | ||
newFed.registerHook('onCoordinatorUpdate', () => { | ||
setFederationUpdatedAt(new Date().toISOString()); | ||
setCoordinatorUpdatedAt(new Date().toISOString()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Reckless-Satoshi There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it's likely that with this change some minor bugs on the list will be fixed |
||
}); | ||
void newFed.start(origin, settings, hostUrl); | ||
setFederation(newFed); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,7 +43,7 @@ export const updateExchangeInfo = (federation: Federation): ExchangeInfo => { | |
premiums[index] = coordinator.info.last_day_nonkyc_btc_premium; | ||
volumes[index] = coordinator.info.last_day_volume; | ||
highestVersion = getHigherVer(highestVersion, coordinator.info.version); | ||
active_robots_today = Math.max(active_robots_today, coordinator.info['active_robots_today']); | ||
active_robots_today = Math.max(active_robots_today, coordinator.info.active_robots_today); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lintern auto-fix |
||
|
||
aggregations.forEach((key: any) => { | ||
info[key] = Number(info[key]) + Number(coordinator.info[key]); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,7 +126,7 @@ class Garage { | |
) => { | ||
if (!token || !shortAlias) return; | ||
|
||
let slot = this.getSlot(token); | ||
const slot = this.getSlot(token); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lintern auto-fix |
||
|
||
if (slot != null) { | ||
slot.updateRobot(shortAlias, { token, ...attributes }); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,13 +69,13 @@ const filterOrders = function ({ | |
const filteredOrders = orders.filter((order) => { | ||
const typeChecks = order.type === baseFilter.type || baseFilter.type == null; | ||
const modeChecks = baseFilter.mode === 'fiat' ? !(order.currency === 1000) : true; | ||
const premiumChecks = premium != null ? filterByPremium(order, premium) : true; | ||
const premiumChecks = premium !== null ? filterByPremium(order, premium) : true; | ||
const currencyChecks = order.currency === baseFilter.currency || baseFilter.currency === 0; | ||
const paymentMethodChecks = | ||
paymentMethods.length > 0 ? filterByPayment(order, paymentMethods) : true; | ||
const amountChecks = amountFilter != null ? filterByAmount(order, amountFilter) : true; | ||
const amountChecks = amountFilter !== null ? filterByAmount(order, amountFilter) : true; | ||
const hostChecks = | ||
baseFilter.coordinator != 'any' ? filterByHost(order, baseFilter.coordinator) : true; | ||
baseFilter.coordinator !== 'any' ? filterByHost(order, baseFilter.coordinator) : true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lintern auto-fix |
||
return ( | ||
typeChecks && | ||
modeChecks && | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lintern auto-fix