diff --git a/frontend/src/components/BookTable/BookControl.tsx b/frontend/src/components/BookTable/BookControl.tsx index e92c7a87..dca66a7f 100644 --- a/frontend/src/components/BookTable/BookControl.tsx +++ b/frontend/src/components/BookTable/BookControl.tsx @@ -20,6 +20,8 @@ import { AppContext, type UseAppStoreType } from '../../contexts/AppContext'; import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank'; import SwapCalls from '@mui/icons-material/SwapCalls'; +import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext'; +import RobotAvatar from '../RobotAvatar'; interface BookControlProps { width: number; @@ -33,6 +35,7 @@ const BookControl = ({ setPaymentMethods, }: BookControlProps): JSX.Element => { const { fav, setFav } = useContext(AppContext); + const { federation } = useContext(FederationContext); const { t, i18n } = useTranslation(); const theme = useTheme(); @@ -52,6 +55,11 @@ const BookControl = ({ setFav({ ...fav, currency, mode: currency === 1000 ? 'swap' : 'fiat' }); }; + const handleHostChange = function (e: React.ChangeEvent): void { + const coordinator = String(e.target.value); + setFav({ ...fav, coordinator }); + }; + const handleTypeChange = function (mouseEvent: React.MouseEvent, val: number): void { setFav({ ...fav, type: val }); }; @@ -306,6 +314,63 @@ const BookControl = ({ ) : null} + + {width > large ? ( + + + {fav.currency === 1000 ? t(fav.type === 0 ? 'to' : 'from') : t('hosted by')} + + + ) : null} + + + diff --git a/frontend/src/contexts/AppContext.tsx b/frontend/src/contexts/AppContext.tsx index b2bb3035..4d9aa66a 100644 --- a/frontend/src/contexts/AppContext.tsx +++ b/frontend/src/contexts/AppContext.tsx @@ -154,7 +154,7 @@ export const initialAppContext: UseAppStoreType = { clientVersion: getClientVersion(), setAcknowledgedWarning: () => {}, acknowledgedWarning: false, - fav: { type: null, currency: 0, mode: 'fiat' }, + fav: { type: null, currency: 0, mode: 'fiat', coordinator: 'any' }, setFav: () => {}, }; diff --git a/frontend/src/models/Favorites.model.ts b/frontend/src/models/Favorites.model.ts index c9ee4d1b..13690853 100644 --- a/frontend/src/models/Favorites.model.ts +++ b/frontend/src/models/Favorites.model.ts @@ -2,6 +2,7 @@ export interface Favorites { type: number | null; mode: 'swap' | 'fiat'; currency: number; + coordinator: string; } export default Favorites; diff --git a/frontend/src/utils/filterOrders.ts b/frontend/src/utils/filterOrders.ts index f4f7e3f1..cefb2717 100644 --- a/frontend/src/utils/filterOrders.ts +++ b/frontend/src/utils/filterOrders.ts @@ -27,6 +27,14 @@ const filterByPayment = function (order: PublicOrder, paymentMethods: any[]): bo } }; +const filterByHost = function (order: PublicOrder, shortAlias: string): boolean { + if (shortAlias === 'any') { + return true; + } else { + return order.coordinatorShortAlias === shortAlias; + } +}; + const filterByAmount = function (order: PublicOrder, filter: AmountFilter): boolean { const filterMaxAmount = Number(filter.amount !== '' ? filter.amount : filter.maxAmount) * (1 + filter.threshold); @@ -66,13 +74,16 @@ const filterOrders = function ({ const paymentMethodChecks = paymentMethods.length > 0 ? filterByPayment(order, paymentMethods) : true; const amountChecks = amountFilter != null ? filterByAmount(order, amountFilter) : true; + const hostChecks = + baseFilter.coordinator != 'any' ? filterByHost(order, baseFilter.coordinator) : true; return ( typeChecks && modeChecks && premiumChecks && currencyChecks && paymentMethodChecks && - amountChecks + amountChecks && + hostChecks ); }); return filteredOrders; diff --git a/frontend/static/locales/ca.json b/frontend/static/locales/ca.json index 9b54659d..e65a3d76 100644 --- a/frontend/static/locales/ca.json +++ b/frontend/static/locales/ca.json @@ -83,6 +83,7 @@ "DESTINATION": "DESTÍ", "I want to": "Vull", "METHOD": "MÈTODE", + "Select Host": "Select Host", "Select Payment Currency": "Selecciona moneda de pagament", "Select Payment Method": "Tria mètode de pagament", "Sell": "Vendre", @@ -90,6 +91,7 @@ "Swap In": "Swap In", "Swap Out": "Swap Out", "and use": "i fer servir", + "hosted by": "hosted by", "pay with": "pagar amb", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "Afegir filtre", diff --git a/frontend/static/locales/cs.json b/frontend/static/locales/cs.json index 81303c09..e40806e3 100644 --- a/frontend/static/locales/cs.json +++ b/frontend/static/locales/cs.json @@ -83,6 +83,7 @@ "DESTINATION": "DESTINATION", "I want to": "Já chci", "METHOD": "METHOD", + "Select Host": "Select Host", "Select Payment Currency": "Vybrat měnu platby", "Select Payment Method": "Select Payment Method", "Sell": "Prodej", @@ -90,6 +91,7 @@ "Swap In": "Swap In", "Swap Out": "Swap Out", "and use": "použít", + "hosted by": "hosted by", "pay with": "pay with", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "Přidat filter", diff --git a/frontend/static/locales/de.json b/frontend/static/locales/de.json index 0a86f4c9..42b46e4b 100644 --- a/frontend/static/locales/de.json +++ b/frontend/static/locales/de.json @@ -83,6 +83,7 @@ "DESTINATION": "DESTINATION", "I want to": "Ich möchte", "METHOD": "METHOD", + "Select Host": "Select Host", "Select Payment Currency": "Währung auswählen", "Select Payment Method": "Select Payment Method", "Sell": "Verkaufen", @@ -90,6 +91,7 @@ "Swap In": "Swap In", "Swap Out": "Swap Out", "and use": "und verwende", + "hosted by": "hosted by", "pay with": "pay with", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "Add filter", diff --git a/frontend/static/locales/en.json b/frontend/static/locales/en.json index 3f3b1705..004ce92b 100644 --- a/frontend/static/locales/en.json +++ b/frontend/static/locales/en.json @@ -83,6 +83,7 @@ "DESTINATION": "DESTINATION", "I want to": "I want to", "METHOD": "METHOD", + "Select Host": "Select Host", "Select Payment Currency": "Select Payment Currency", "Select Payment Method": "Select Payment Method", "Sell": "Sell", @@ -90,6 +91,7 @@ "Swap In": "Swap In", "Swap Out": "Swap Out", "and use": "and use", + "hosted by": "hosted by", "pay with": "pay with", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "Add filter", diff --git a/frontend/static/locales/es.json b/frontend/static/locales/es.json index 57262c22..9c663b80 100644 --- a/frontend/static/locales/es.json +++ b/frontend/static/locales/es.json @@ -83,6 +83,7 @@ "DESTINATION": "DESTINO", "I want to": "Quiero", "METHOD": "MÉTODO", + "Select Host": "Select Host", "Select Payment Currency": "Selecciona moneda de pago", "Select Payment Method": "Selecciona método de pago", "Sell": "Vender", @@ -90,6 +91,7 @@ "Swap In": "Swap a LN", "Swap Out": "Swap desde LN", "and use": "y usa", + "hosted by": "hosted by", "pay with": "paga con", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "Añadir filtro", diff --git a/frontend/static/locales/eu.json b/frontend/static/locales/eu.json index b65b3e87..9db43104 100644 --- a/frontend/static/locales/eu.json +++ b/frontend/static/locales/eu.json @@ -83,6 +83,7 @@ "DESTINATION": "DESTINATION", "I want to": "Nahi dut", "METHOD": "METHOD", + "Select Host": "Select Host", "Select Payment Currency": "Aukeratu Ordainketa Txanpona", "Select Payment Method": "Select Payment Method", "Sell": "Saldu", @@ -90,6 +91,7 @@ "Swap In": "Swap In", "Swap Out": "Swap Out", "and use": "eta erabili", + "hosted by": "hosted by", "pay with": "pay with", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "Gehitu iragazkia", diff --git a/frontend/static/locales/fr.json b/frontend/static/locales/fr.json index bdc244c3..0f32c30b 100644 --- a/frontend/static/locales/fr.json +++ b/frontend/static/locales/fr.json @@ -83,6 +83,7 @@ "DESTINATION": "DESTINATION", "I want to": "Je veux", "METHOD": "MÉTHODE", + "Select Host": "Select Host", "Select Payment Currency": "Sélectionner la devise de paiement", "Select Payment Method": "Sélectionner le mode de paiement", "Sell": "Vendre", @@ -90,6 +91,7 @@ "Swap In": "Échange LN->OC", "Swap Out": "Échange OC->LN", "and use": "et utiliser", + "hosted by": "hosted by", "pay with": "payer avec", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "Ajouter filtre", diff --git a/frontend/static/locales/it.json b/frontend/static/locales/it.json index 88999c5d..492c62ac 100644 --- a/frontend/static/locales/it.json +++ b/frontend/static/locales/it.json @@ -83,6 +83,7 @@ "DESTINATION": "DESTINAZIONE", "I want to": "Voglio", "METHOD": "METODO", + "Select Host": "Select Host", "Select Payment Currency": "Seleziona valuta di pagamento", "Select Payment Method": "Seleziona il metodo di pagamento", "Sell": "Vendere", @@ -90,6 +91,7 @@ "Swap In": "Swap In", "Swap Out": "Swap Out", "and use": "ed usa", + "hosted by": "hosted by", "pay with": "paga con", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "Aggiungi filtro", diff --git a/frontend/static/locales/ja.json b/frontend/static/locales/ja.json index 92f25b21..620831e5 100644 --- a/frontend/static/locales/ja.json +++ b/frontend/static/locales/ja.json @@ -83,6 +83,7 @@ "DESTINATION": "方向", "I want to": "私はしたいのは:", "METHOD": "方法", + "Select Host": "Select Host", "Select Payment Currency": "支払い通貨を選択してください。", "Select Payment Method": "支払い方法を選択してください。", "Sell": "売る", @@ -90,6 +91,7 @@ "Swap In": "スワップイン", "Swap Out": "スワップアウト", "and use": "そして使用するのは", + "hosted by": "hosted by", "pay with": "支払い方法は:", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "フィルタを追加", diff --git a/frontend/static/locales/pl.json b/frontend/static/locales/pl.json index 6a34e334..a84efdac 100644 --- a/frontend/static/locales/pl.json +++ b/frontend/static/locales/pl.json @@ -83,6 +83,7 @@ "DESTINATION": "DESTINATION", "I want to": "chcę", "METHOD": "METHOD", + "Select Host": "Select Host", "Select Payment Currency": "Wybierz walutę płatności", "Select Payment Method": "Select Payment Method", "Sell": "Sprzedać", @@ -90,6 +91,7 @@ "Swap In": "Swap In", "Swap Out": "Swap Out", "and use": "i użyć", + "hosted by": "hosted by", "pay with": "pay with", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "Add filter", diff --git a/frontend/static/locales/pt.json b/frontend/static/locales/pt.json index 0a4af986..7603e2ab 100644 --- a/frontend/static/locales/pt.json +++ b/frontend/static/locales/pt.json @@ -83,6 +83,7 @@ "DESTINATION": "DESTINATION", "I want to": "Eu quero", "METHOD": "METHOD", + "Select Host": "Select Host", "Select Payment Currency": "Selecione a moeda de pagamento", "Select Payment Method": "Select Payment Method", "Sell": "Vender", @@ -90,6 +91,7 @@ "Swap In": "Swap In", "Swap Out": "Swap Out", "and use": "e utilizar", + "hosted by": "hosted by", "pay with": "pay with", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "Add filter", diff --git a/frontend/static/locales/ru.json b/frontend/static/locales/ru.json index 42c2a63b..988cdb6c 100644 --- a/frontend/static/locales/ru.json +++ b/frontend/static/locales/ru.json @@ -83,6 +83,7 @@ "DESTINATION": "МЕСТО НАЗНАЧЕНИЯ", "I want to": "Я хочу", "METHOD": "МЕТОД", + "Select Host": "Select Host", "Select Payment Currency": "Выбрать Валюту", "Select Payment Method": "Выбрать способ оплаты", "Sell": "Продать", @@ -90,6 +91,7 @@ "Swap In": "Своп в", "Swap Out": "Своп из", "and use": "и использовать", + "hosted by": "hosted by", "pay with": "оплатить", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "Добавить фильтр", diff --git a/frontend/static/locales/sv.json b/frontend/static/locales/sv.json index 7d499212..a7cd0162 100644 --- a/frontend/static/locales/sv.json +++ b/frontend/static/locales/sv.json @@ -83,6 +83,7 @@ "DESTINATION": "DESTINATION", "I want to": "Jag vill", "METHOD": "METHOD", + "Select Host": "Select Host", "Select Payment Currency": "Välj betalningsvaluta", "Select Payment Method": "Select Payment Method", "Sell": "Sälja", @@ -90,6 +91,7 @@ "Swap In": "Swap In", "Swap Out": "Swap Out", "and use": "och använda", + "hosted by": "hosted by", "pay with": "pay with", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "Add filter", diff --git a/frontend/static/locales/sw.json b/frontend/static/locales/sw.json index fa028cfc..e1562de9 100644 --- a/frontend/static/locales/sw.json +++ b/frontend/static/locales/sw.json @@ -83,6 +83,7 @@ "DESTINATION": "MAELEKEZO", "I want to": "Nataka", "METHOD": "NJIA", + "Select Host": "Select Host", "Select Payment Currency": "Chagua Sarafu ya Malipo", "Select Payment Method": "Chagua Njia ya Malipo", "Sell": "Uza", @@ -90,6 +91,7 @@ "Swap In": "Badilisha Ndani", "Swap Out": "Badilisha Nje", "and use": "na tumia", + "hosted by": "hosted by", "pay with": "lipa kwa", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "Ongeza kichujio", diff --git a/frontend/static/locales/th.json b/frontend/static/locales/th.json index df9d4043..f56161f6 100644 --- a/frontend/static/locales/th.json +++ b/frontend/static/locales/th.json @@ -83,6 +83,7 @@ "DESTINATION": "DESTINATION", "I want to": "ฉันต้องการ", "METHOD": "METHOD", + "Select Host": "Select Host", "Select Payment Currency": "เลือกสกุลเงิน", "Select Payment Method": "Select Payment Method", "Sell": "ขาย", @@ -90,6 +91,7 @@ "Swap In": "Swap In", "Swap Out": "Swap Out", "and use": "และใช้", + "hosted by": "hosted by", "pay with": "pay with", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "เพิ่มตัวกรอง", diff --git a/frontend/static/locales/zh-SI.json b/frontend/static/locales/zh-SI.json index a6b2ddbf..f82e224e 100644 --- a/frontend/static/locales/zh-SI.json +++ b/frontend/static/locales/zh-SI.json @@ -83,6 +83,7 @@ "DESTINATION": "目的地", "I want to": "我想要", "METHOD": "方式", + "Select Host": "Select Host", "Select Payment Currency": "选择支付货币", "Select Payment Method": "选择付款方式", "Sell": "出售", @@ -90,6 +91,7 @@ "Swap In": "换入", "Swap Out": "换出", "and use": "并使用", + "hosted by": "hosted by", "pay with": "支付", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "加筛选", diff --git a/frontend/static/locales/zh-TR.json b/frontend/static/locales/zh-TR.json index 16183940..a8016dc4 100644 --- a/frontend/static/locales/zh-TR.json +++ b/frontend/static/locales/zh-TR.json @@ -83,6 +83,7 @@ "DESTINATION": "目的地", "I want to": "我想要", "METHOD": "方式", + "Select Host": "Select Host", "Select Payment Currency": "選擇支付貨幣", "Select Payment Method": "選擇付款方式", "Sell": "出售", @@ -90,6 +91,7 @@ "Swap In": "換入", "Swap Out": "換出", "and use": "並使用", + "hosted by": "hosted by", "pay with": "支付", "#15": "Phrases in components/BookTable/index.tsx", "Add filter": "加篩選",