This commit is contained in:
koalasat 2024-11-25 10:38:33 +01:00
parent 449ee79ca4
commit 075ee0c30c
No known key found for this signature in database
GPG Key ID: 2F7F61C6146AB157
8 changed files with 41 additions and 12 deletions

View File

@ -38,6 +38,15 @@ repos:
files: ^frontend/
types_or: [javascript, jsx, ts, tsx, css, markdown, json] # uses https://github.com/pre-commit/identify
entry: bash -c 'cd frontend && npm run format'
- id: lintern-frontend
name: lintern-frontend
stages:
- commit
- merge-commit
language: system
files: ^frontend/
types_or: [javascript, jsx, ts, tsx, css, markdown, json] # uses https://github.com/pre-commit/identify
entry: bash -c 'cd frontend && npm run lint'
- id: prettier-mobile
name: prettier-mobile
stages:
@ -47,6 +56,15 @@ repos:
files: ^mobile/
types_or: [javascript, jsx, ts, tsx, css, markdown, json] # uses https://github.com/pre-commit/identify
entry: bash -c 'cd mobile && npm run format'
- id: lintern-mobile
name: lintern-mobile
stages:
- commit
- merge-commit
language: system
files: ^mobile/
types_or: [javascript, jsx, ts, tsx, css, markdown, json] # uses https://github.com/pre-commit/identify
entry: bash -c 'cd frontend && npm run lint'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.13
hooks:

View File

@ -12,7 +12,7 @@ import { NoRobotDialog } from '../../components/Dialogs';
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
import VisitThirdParty from '../../components/Dialogs/VisitThirdParty';
import { PublicOrder } from '../../models';
import { type PublicOrder } from '../../models';
const MakerPage = (): JSX.Element => {
const { fav, windowSize, navbarHeight } = useContext<UseAppStoreType>(AppContext);

View File

@ -22,7 +22,6 @@ 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 {

View File

@ -129,13 +129,13 @@ const DepthChart: React.FC<DepthChartProps> = ({
xType === 'base_price'
? enrichedOrders
.filter(
(order: PublicOrder | null) => currencyCode === 0 || order?.currency == currencyCode,
(order: PublicOrder | null) => currencyCode === 0 || order?.currency === currencyCode,
)
.filter(
(order: PublicOrder | null) =>
coordinatorFilter === 'any' ||
(coordinatorFilter === 'robosats' && order?.federated) ||
order?.coordinatorShortAlias == coordinatorFilter,
order?.coordinatorShortAlias === coordinatorFilter,
)
.sort(
(order1: PublicOrder | null, order2: PublicOrder | null) =>
@ -143,13 +143,13 @@ const DepthChart: React.FC<DepthChartProps> = ({
)
: enrichedOrders
.filter(
(order: PublicOrder | null) => currencyCode === 0 || order?.currency == currencyCode,
(order: PublicOrder | null) => currencyCode === 0 || order?.currency === currencyCode,
)
.filter(
(order: PublicOrder | null) =>
coordinatorFilter === 'any' ||
(coordinatorFilter === 'robosats' && order?.federated) ||
order?.coordinatorShortAlias == coordinatorFilter,
order?.coordinatorShortAlias === coordinatorFilter,
)
.sort(
(order1: PublicOrder | null, order2: PublicOrder | null) =>

View File

@ -38,7 +38,14 @@ const ExchangeDialog = ({ open = false, onClose }: Props): JSX.Element => {
const [loadingInfo, setLoadingInfo] = useState<boolean>(true);
useEffect(() => {
if (open) federation.loadInfo();
if (open) {
federation
.loadInfo()
.then(() => {})
.catch((error) => {
console.error('Error loading info:', error);
});
}
}, [open]);
useEffect(() => {

View File

@ -87,7 +87,12 @@ const MakerForm = ({
const amountSafeThresholds = [1.03, 0.98];
useEffect(() => {
federation.loadInfo();
federation
.loadInfo()
.then(() => {})
.catch((error) => {
console.error('Error loading info:', error);
});
}, []);
useEffect(() => {

View File

@ -10,7 +10,7 @@ import {
CircularProgress,
Stack,
} from '@mui/material';
import { Bolt, Link, Info } from '@mui/icons-material';
import { Link } from '@mui/icons-material';
import RobotAvatar from '../RobotAvatar';
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
import { useTheme } from '@emotion/react';

View File

@ -1,4 +1,4 @@
import { type PublicOrder, type Favorites, type Federation, Coordinator } from '../models';
import { type PublicOrder, type Favorites, type Federation } from '../models';
import thirdParties from '../../static/thirdparties.json';
interface AmountFilter {
@ -35,7 +35,7 @@ const filterByHost = function (
): boolean {
if (shortAlias === 'any') {
return true;
} else if (shortAlias == 'robosats') {
} else if (shortAlias === 'robosats') {
const coordinator = federation.getCoordinator(order.coordinatorShortAlias ?? '');
return coordinator?.federated ?? false;
} else {
@ -84,7 +84,7 @@ const filterOrders = function ({
const coordinatorCheck = [...enabledCoordinators, ...Object.keys(thirdParties)].includes(
order.coordinatorShortAlias ?? '',
);
const typeChecks = order.type === baseFilter.type || baseFilter.type == null;
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 currencyChecks = order.currency === baseFilter.currency || baseFilter.currency === 0;