mirror of
https://github.com/RoboSats/robosats.git
synced 2024-12-26 22:06:08 +03:00
Lint
This commit is contained in:
parent
449ee79ca4
commit
075ee0c30c
@ -38,6 +38,15 @@ repos:
|
|||||||
files: ^frontend/
|
files: ^frontend/
|
||||||
types_or: [javascript, jsx, ts, tsx, css, markdown, json] # uses https://github.com/pre-commit/identify
|
types_or: [javascript, jsx, ts, tsx, css, markdown, json] # uses https://github.com/pre-commit/identify
|
||||||
entry: bash -c 'cd frontend && npm run format'
|
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
|
- id: prettier-mobile
|
||||||
name: prettier-mobile
|
name: prettier-mobile
|
||||||
stages:
|
stages:
|
||||||
@ -47,6 +56,15 @@ repos:
|
|||||||
files: ^mobile/
|
files: ^mobile/
|
||||||
types_or: [javascript, jsx, ts, tsx, css, markdown, json] # uses https://github.com/pre-commit/identify
|
types_or: [javascript, jsx, ts, tsx, css, markdown, json] # uses https://github.com/pre-commit/identify
|
||||||
entry: bash -c 'cd mobile && npm run format'
|
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
|
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||||
rev: v0.1.13
|
rev: v0.1.13
|
||||||
hooks:
|
hooks:
|
||||||
|
@ -12,7 +12,7 @@ import { NoRobotDialog } from '../../components/Dialogs';
|
|||||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
||||||
import VisitThirdParty from '../../components/Dialogs/VisitThirdParty';
|
import VisitThirdParty from '../../components/Dialogs/VisitThirdParty';
|
||||||
import { PublicOrder } from '../../models';
|
import { type PublicOrder } from '../../models';
|
||||||
|
|
||||||
const MakerPage = (): JSX.Element => {
|
const MakerPage = (): JSX.Element => {
|
||||||
const { fav, windowSize, navbarHeight } = useContext<UseAppStoreType>(AppContext);
|
const { fav, windowSize, navbarHeight } = useContext<UseAppStoreType>(AppContext);
|
||||||
|
@ -22,7 +22,6 @@ import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank';
|
|||||||
import SwapCalls from '@mui/icons-material/SwapCalls';
|
import SwapCalls from '@mui/icons-material/SwapCalls';
|
||||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||||
import RobotAvatar from '../RobotAvatar';
|
import RobotAvatar from '../RobotAvatar';
|
||||||
import RoboSats from '../Icons/RoboSats';
|
|
||||||
import RoboSatsNoText from '../Icons/RoboSatsNoText';
|
import RoboSatsNoText from '../Icons/RoboSatsNoText';
|
||||||
|
|
||||||
interface BookControlProps {
|
interface BookControlProps {
|
||||||
|
@ -129,13 +129,13 @@ const DepthChart: React.FC<DepthChartProps> = ({
|
|||||||
xType === 'base_price'
|
xType === 'base_price'
|
||||||
? enrichedOrders
|
? enrichedOrders
|
||||||
.filter(
|
.filter(
|
||||||
(order: PublicOrder | null) => currencyCode === 0 || order?.currency == currencyCode,
|
(order: PublicOrder | null) => currencyCode === 0 || order?.currency === currencyCode,
|
||||||
)
|
)
|
||||||
.filter(
|
.filter(
|
||||||
(order: PublicOrder | null) =>
|
(order: PublicOrder | null) =>
|
||||||
coordinatorFilter === 'any' ||
|
coordinatorFilter === 'any' ||
|
||||||
(coordinatorFilter === 'robosats' && order?.federated) ||
|
(coordinatorFilter === 'robosats' && order?.federated) ||
|
||||||
order?.coordinatorShortAlias == coordinatorFilter,
|
order?.coordinatorShortAlias === coordinatorFilter,
|
||||||
)
|
)
|
||||||
.sort(
|
.sort(
|
||||||
(order1: PublicOrder | null, order2: PublicOrder | null) =>
|
(order1: PublicOrder | null, order2: PublicOrder | null) =>
|
||||||
@ -143,13 +143,13 @@ const DepthChart: React.FC<DepthChartProps> = ({
|
|||||||
)
|
)
|
||||||
: enrichedOrders
|
: enrichedOrders
|
||||||
.filter(
|
.filter(
|
||||||
(order: PublicOrder | null) => currencyCode === 0 || order?.currency == currencyCode,
|
(order: PublicOrder | null) => currencyCode === 0 || order?.currency === currencyCode,
|
||||||
)
|
)
|
||||||
.filter(
|
.filter(
|
||||||
(order: PublicOrder | null) =>
|
(order: PublicOrder | null) =>
|
||||||
coordinatorFilter === 'any' ||
|
coordinatorFilter === 'any' ||
|
||||||
(coordinatorFilter === 'robosats' && order?.federated) ||
|
(coordinatorFilter === 'robosats' && order?.federated) ||
|
||||||
order?.coordinatorShortAlias == coordinatorFilter,
|
order?.coordinatorShortAlias === coordinatorFilter,
|
||||||
)
|
)
|
||||||
.sort(
|
.sort(
|
||||||
(order1: PublicOrder | null, order2: PublicOrder | null) =>
|
(order1: PublicOrder | null, order2: PublicOrder | null) =>
|
||||||
|
@ -38,7 +38,14 @@ const ExchangeDialog = ({ open = false, onClose }: Props): JSX.Element => {
|
|||||||
const [loadingInfo, setLoadingInfo] = useState<boolean>(true);
|
const [loadingInfo, setLoadingInfo] = useState<boolean>(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (open) federation.loadInfo();
|
if (open) {
|
||||||
|
federation
|
||||||
|
.loadInfo()
|
||||||
|
.then(() => {})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error loading info:', error);
|
||||||
|
});
|
||||||
|
}
|
||||||
}, [open]);
|
}, [open]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -87,7 +87,12 @@ const MakerForm = ({
|
|||||||
const amountSafeThresholds = [1.03, 0.98];
|
const amountSafeThresholds = [1.03, 0.98];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
federation.loadInfo();
|
federation
|
||||||
|
.loadInfo()
|
||||||
|
.then(() => {})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Error loading info:', error);
|
||||||
|
});
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -10,7 +10,7 @@ import {
|
|||||||
CircularProgress,
|
CircularProgress,
|
||||||
Stack,
|
Stack,
|
||||||
} from '@mui/material';
|
} from '@mui/material';
|
||||||
import { Bolt, Link, Info } from '@mui/icons-material';
|
import { Link } from '@mui/icons-material';
|
||||||
import RobotAvatar from '../RobotAvatar';
|
import RobotAvatar from '../RobotAvatar';
|
||||||
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||||
import { useTheme } from '@emotion/react';
|
import { useTheme } from '@emotion/react';
|
||||||
|
@ -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';
|
import thirdParties from '../../static/thirdparties.json';
|
||||||
|
|
||||||
interface AmountFilter {
|
interface AmountFilter {
|
||||||
@ -35,7 +35,7 @@ const filterByHost = function (
|
|||||||
): boolean {
|
): boolean {
|
||||||
if (shortAlias === 'any') {
|
if (shortAlias === 'any') {
|
||||||
return true;
|
return true;
|
||||||
} else if (shortAlias == 'robosats') {
|
} else if (shortAlias === 'robosats') {
|
||||||
const coordinator = federation.getCoordinator(order.coordinatorShortAlias ?? '');
|
const coordinator = federation.getCoordinator(order.coordinatorShortAlias ?? '');
|
||||||
return coordinator?.federated ?? false;
|
return coordinator?.federated ?? false;
|
||||||
} else {
|
} else {
|
||||||
@ -84,7 +84,7 @@ const filterOrders = function ({
|
|||||||
const coordinatorCheck = [...enabledCoordinators, ...Object.keys(thirdParties)].includes(
|
const coordinatorCheck = [...enabledCoordinators, ...Object.keys(thirdParties)].includes(
|
||||||
order.coordinatorShortAlias ?? '',
|
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 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 currencyChecks = order.currency === baseFilter.currency || baseFilter.currency === 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user