mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-13 10:56:24 +00:00
Filter by robosats orders
This commit is contained in:
parent
04670cd671
commit
4e8017b9c3
@ -5,7 +5,7 @@
|
||||
/* Colors */
|
||||
$background-color: #ffffff !default;
|
||||
$text-color: #2c2c2c !default;
|
||||
$muted-text-color: #393e46 !default;
|
||||
$muted-text-color: hsl(217, 10%, 25%) !default;
|
||||
$primary-color: #1976d2 !default;
|
||||
$primary-light-color: #42a5f5 !default;
|
||||
$primary-dark-color: #1565c0 !default;
|
||||
|
@ -22,6 +22,8 @@ import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank';
|
||||
import SwapCalls from '@mui/icons-material/SwapCalls';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import RobotAvatar from '../RobotAvatar';
|
||||
import RoboSats from '../Icons/RoboSats';
|
||||
import RoboSatsNoText from '../Icons/RoboSatsNoText';
|
||||
|
||||
interface BookControlProps {
|
||||
width: number;
|
||||
@ -350,6 +352,11 @@ const BookControl = ({
|
||||
<FlagWithProps code='ANY' />
|
||||
</div>
|
||||
</MenuItem>
|
||||
<MenuItem value='robosats'>
|
||||
<div style={{ display: 'flex', alignItems: 'center', flexWrap: 'wrap' }}>
|
||||
<RoboSatsNoText sx={{ color: '#1976d2' }} />
|
||||
</div>
|
||||
</MenuItem>
|
||||
{federation
|
||||
.getCoordinators()
|
||||
.filter((coord) => coord.enabled)
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { type PublicOrder, type Favorites, type Federation } from '../models';
|
||||
import { type PublicOrder, type Favorites, type Federation, Coordinator } from '../models';
|
||||
import thirdParties from '../../static/thirdparties.json';
|
||||
|
||||
interface AmountFilter {
|
||||
@ -28,9 +28,16 @@ const filterByPayment = function (order: PublicOrder, paymentMethods: any[]): bo
|
||||
}
|
||||
};
|
||||
|
||||
const filterByHost = function (order: PublicOrder, shortAlias: string): boolean {
|
||||
const filterByHost = function (
|
||||
order: PublicOrder,
|
||||
shortAlias: string,
|
||||
federation: Federation,
|
||||
): boolean {
|
||||
if (shortAlias === 'any') {
|
||||
return true;
|
||||
} else if (shortAlias == 'robosats') {
|
||||
const coordinator = federation.getCoordinator(order.coordinatorShortAlias ?? '');
|
||||
return coordinator?.federated ?? false;
|
||||
} else {
|
||||
return order.coordinatorShortAlias === shortAlias;
|
||||
}
|
||||
@ -84,8 +91,7 @@ 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;
|
||||
const hostChecks = filterByHost(order, baseFilter.coordinator, federation);
|
||||
return (
|
||||
coordinatorCheck &&
|
||||
typeChecks &&
|
||||
|
Loading…
Reference in New Issue
Block a user