mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-13 19:06:26 +00:00
Filter depth chart by host
This commit is contained in:
parent
a600e70be0
commit
449ee79ca4
@ -56,14 +56,17 @@ const DepthChart: React.FC<DepthChartProps> = ({
|
||||
const [xRange, setXRange] = useState<number>(8);
|
||||
const [xType, setXType] = useState<string>('premium');
|
||||
const [currencyCode, setCurrencyCode] = useState<number>(0);
|
||||
const [coordinatorFilter, setCoordinatorFilter] = useState<string>('all');
|
||||
const [center, setCenter] = useState<number>();
|
||||
|
||||
const height = maxHeight < 10 ? 10 : maxHeight;
|
||||
const width = maxWidth < 10 ? 10 : maxWidth > 72.8 ? 72.8 : maxWidth;
|
||||
|
||||
useEffect(() => {
|
||||
setCurrencyCode(fav.currency); // as selected in BookControl
|
||||
}, [fav.currency]);
|
||||
setCurrencyCode(fav.currency); // as selected in BookControl
|
||||
setCoordinatorFilter(fav.coordinator);
|
||||
console.log(fav.coordinator);
|
||||
}, [fav.currency, fav.coordinator]);
|
||||
|
||||
useEffect(() => {
|
||||
if (Object.values(federation.book).length > 0) {
|
||||
@ -89,7 +92,7 @@ const DepthChart: React.FC<DepthChartProps> = ({
|
||||
});
|
||||
setEnrichedOrders(enriched);
|
||||
}
|
||||
}, [federationUpdatedAt, currencyCode]);
|
||||
}, [federationUpdatedAt, currencyCode, coordinatorFilter]);
|
||||
|
||||
useEffect(() => {
|
||||
if (enrichedOrders.length > 0) {
|
||||
@ -119,7 +122,7 @@ const DepthChart: React.FC<DepthChartProps> = ({
|
||||
setXRange(8);
|
||||
setRangeSteps(0.5);
|
||||
}
|
||||
}, [enrichedOrders, xType, federationUpdatedAt, currencyCode]);
|
||||
}, [enrichedOrders, xType, federationUpdatedAt, currencyCode, coordinatorFilter]);
|
||||
|
||||
const generateSeries: () => void = () => {
|
||||
const sortedOrders: PublicOrder[] =
|
||||
@ -128,6 +131,12 @@ const DepthChart: React.FC<DepthChartProps> = ({
|
||||
.filter(
|
||||
(order: PublicOrder | null) => currencyCode === 0 || order?.currency == currencyCode,
|
||||
)
|
||||
.filter(
|
||||
(order: PublicOrder | null) =>
|
||||
coordinatorFilter === 'any' ||
|
||||
(coordinatorFilter === 'robosats' && order?.federated) ||
|
||||
order?.coordinatorShortAlias == coordinatorFilter,
|
||||
)
|
||||
.sort(
|
||||
(order1: PublicOrder | null, order2: PublicOrder | null) =>
|
||||
(order1?.base_price ?? 0) - (order2?.base_price ?? 0),
|
||||
@ -136,6 +145,12 @@ const DepthChart: React.FC<DepthChartProps> = ({
|
||||
.filter(
|
||||
(order: PublicOrder | null) => currencyCode === 0 || order?.currency == currencyCode,
|
||||
)
|
||||
.filter(
|
||||
(order: PublicOrder | null) =>
|
||||
coordinatorFilter === 'any' ||
|
||||
(coordinatorFilter === 'robosats' && order?.federated) ||
|
||||
order?.coordinatorShortAlias == coordinatorFilter,
|
||||
)
|
||||
.sort(
|
||||
(order1: PublicOrder | null, order2: PublicOrder | null) =>
|
||||
order1?.premium - order2?.premium,
|
||||
|
@ -25,6 +25,7 @@ export interface PublicOrder {
|
||||
maker_status?: 'Active' | 'Seen recently' | 'Inactive';
|
||||
coordinatorShortAlias?: string;
|
||||
link?: string;
|
||||
federated?: boolean;
|
||||
}
|
||||
|
||||
export interface Book {
|
||||
|
@ -41,6 +41,7 @@ const eventToPublicOrder = (event: Event): { dTag: string; publicOrder: PublicOr
|
||||
if (!coordinator || statusTag[1] !== 'pending') return { dTag: dTag[1], publicOrder: null };
|
||||
|
||||
publicOrder.coordinatorShortAlias = coordinator?.shortAlias;
|
||||
publicOrder.federated = coordinator?.federated ?? false;
|
||||
|
||||
event.tags.forEach((tag) => {
|
||||
switch (tag[0]) {
|
||||
|
@ -47,7 +47,8 @@
|
||||
"i2p": ""
|
||||
},
|
||||
"mainnetNodesPubkeys": ["0226f31c5f3a8b48bbbb7aaa97a10effcfb445b5972a676955d5c095383d35a428"],
|
||||
"testnetNodesPubkeys": ["028e7a019180a664b84edf77ba656e96f2eb84f67f56d93020341caf4109e0dbc7"]
|
||||
"testnetNodesPubkeys": ["028e7a019180a664b84edf77ba656e96f2eb84f67f56d93020341caf4109e0dbc7"],
|
||||
"federated": true
|
||||
},
|
||||
"lake": {
|
||||
"longAlias": "TheBigLake",
|
||||
@ -94,7 +95,8 @@
|
||||
"i2p": ""
|
||||
},
|
||||
"mainnetNodesPubkeys": ["0385262f7e9e2eeeba1e7d6182a0efec98e79d01154b76189f3e0b88bcee279dd0"],
|
||||
"testnetNodesPubkeys": ["0355f8604df9ec4bee20a284f045f94e26cdd1fc5e15dee0716a5a5dfc7cd33b7c"]
|
||||
"testnetNodesPubkeys": ["0355f8604df9ec4bee20a284f045f94e26cdd1fc5e15dee0716a5a5dfc7cd33b7c"],
|
||||
"federated": true
|
||||
},
|
||||
"veneto": {
|
||||
"longAlias": "BitcoinVeneto",
|
||||
@ -140,7 +142,8 @@
|
||||
"i2p": ""
|
||||
},
|
||||
"mainnetNodesPubkeys": ["02c5b5972b05fba2cd2c2d9269a47bc478f73fae0f248a85cb1e5af60a07c1919d"],
|
||||
"testnetNodesPubkeys": ["032b698c8143f293d138c0926594f11d119194ddedb513f63a944d14c094d0e54a"]
|
||||
"testnetNodesPubkeys": ["032b698c8143f293d138c0926594f11d119194ddedb513f63a944d14c094d0e54a"],
|
||||
"federated": true
|
||||
},
|
||||
"moon": {
|
||||
"longAlias": "Over the moon",
|
||||
@ -186,7 +189,8 @@
|
||||
"i2p": ""
|
||||
},
|
||||
"mainnetNodesPubkeys": ["023924542082a5d16bce188ec4c29a45f00dd439a3f5992034d82e3353232a0345"],
|
||||
"testnetNodesPubkeys": ["02f0ddc838b35fe54daa13baa4abab84475c7b9f2670ff4b53c1724792843ef62a"]
|
||||
"testnetNodesPubkeys": ["02f0ddc838b35fe54daa13baa4abab84475c7b9f2670ff4b53c1724792843ef62a"],
|
||||
"federated": true
|
||||
},
|
||||
"local": {
|
||||
"longAlias": "Local Dev",
|
||||
@ -209,6 +213,7 @@
|
||||
"Development Policy": "Don't look around, just buidl"
|
||||
},
|
||||
"mainnetNodesPubkeys": ["..."],
|
||||
"testnetNodesPubkeys": ["..."]
|
||||
"testnetNodesPubkeys": ["..."],
|
||||
"federated": true
|
||||
}
|
||||
}
|
||||
|
@ -416,7 +416,6 @@
|
||||
"Maker": "Creador",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
"Taker": "Prenedor",
|
||||
"Order Host": "Amfitrió de l'ordre",
|
||||
"The provider the lightning and communication infrastructure. The host will be in charge of providing support and solving disputes. The trade fees are set by the host. Make sure to only select order hosts that you trust!": "El proveïdor de la infraestructura LN i comunicacions. L'amfitrió serà l'encarregat de donar suport i resoldre disputes. LEs comissions de les transaccions són fixades per l'amfitrió. Assegureu-vos de seleccionar només els amfitrions en què confieu!",
|
||||
"#41": "Phrases in components/Notifications/index.tsx",
|
||||
"Lightning routing failed": "L'enrutament Lightning ha fallat",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "You send approx {{swapSats}} LN Sats (fees might vary)",
|
||||
"Your order fixed exchange rate": "Pevný směnný kurz tvé nabídky",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "Tvůrce",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "You send approx {{swapSats}} LN Sats (fees might vary)",
|
||||
"Your order fixed exchange rate": "Dein fixierter Order-Kurs",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "Maker",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "You send approx {{swapSats}} LN Sats (fees might vary)",
|
||||
"Your order fixed exchange rate": "Your order fixed exchange rate",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "Maker",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "Envías aproximadamente {{swapSats}} LN Sats (la comisión puede variar)",
|
||||
"Your order fixed exchange rate": "La tasa de cambio fija de tu orden",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "Creador",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "You send approx {{swapSats}} LN Sats (fees might vary)",
|
||||
"Your order fixed exchange rate": "Zure eskaeraren kanbio-tasa finkoa",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "Egile",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "Vous envoyez environ {{swapSats}} LN Sats (les frais peuvent varier)",
|
||||
"Your order fixed exchange rate": "Taux de change fixe de votre commande",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "Auteur",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "Invierai circa {{swapSats}} LN Sats (le commissioni possono variare)",
|
||||
"Your order fixed exchange rate": "Il tasso di cambio fisso del tuo ordine",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "Maker",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "約{{swapSats}} ライトニングSatsを送信します(手数料は異なる場合があります)",
|
||||
"Your order fixed exchange rate": "注文の固定為替レート",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "メーカー",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "You send approx {{swapSats}} LN Sats (fees might vary)",
|
||||
"Your order fixed exchange rate": "Your order fixed exchange rate",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "Maker",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "Você envia aprox {{swapSats}} LN Sats (as taxas podem variar)",
|
||||
"Your order fixed exchange rate": "Taxa de câmbio fixa do seu pedido",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "Maker",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "Вы отправляете примерно {{swapSats}} спутников LN (комиссия может различаться)",
|
||||
"Your order fixed exchange rate": "Фиксированный курс обмена Вашего ордера",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "Мейкер",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "You send approx {{swapSats}} LN Sats (fees might vary)",
|
||||
"Your order fixed exchange rate": "Din orders fasta växelkurs",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "Maker",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "Unatuma takribani {{swapSats}} LN Sats (ada inaweza kutofautiana)",
|
||||
"Your order fixed exchange rate": "Kiwango chako cha kubadilisha cha amri",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "Muumba",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "You send approx {{swapSats}} LN Sats (fees might vary)",
|
||||
"Your order fixed exchange rate": "คุณกำหนดอัตราแลกเปลี่ยนคงที่",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "Maker",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "你将发送大约{{swapSats}}闪电聪(费用会造成有所差异)",
|
||||
"Your order fixed exchange rate": "你的订单的固定汇率",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "挂单方",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
@ -412,7 +412,6 @@
|
||||
"You send approx {{swapSats}} LN Sats (fees might vary)": "你將發送大約{{swapSats}}閃電聰(費用會造成有所差異)",
|
||||
"Your order fixed exchange rate": "你的訂單的固定匯率",
|
||||
"#40": "Phrases in components/MakerForm/SelectCoordinator.tsx",
|
||||
"Order Host": "Order Host",
|
||||
"Disabled": "Disabled",
|
||||
"Maker": "掛單方",
|
||||
"Onchain payouts enabled": "Onchain payouts enabled",
|
||||
|
Loading…
Reference in New Issue
Block a user