Upgrade all libraries

This commit is contained in:
koalasat
2025-05-09 17:10:33 +02:00
parent e2211ee10d
commit ef2d8e7aee
126 changed files with 6150 additions and 5750 deletions

View File

@ -0,0 +1,84 @@
import { defineConfig, globalIgnores } from "eslint/config";
import react from "eslint-plugin-react";
import reactHooks from "eslint-plugin-react-hooks";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import prettier from "eslint-plugin-prettier";
import { fixupPluginRules } from "@eslint/compat";
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});
export default defineConfig([globalIgnores(["**/index.js", "**/PaymentMethods/Icons/code/code.js"]), {
extends: compat.extends(
"eslint:recommended",
"plugin:react/recommended",
'plugin:@typescript-eslint/recommended',
"prettier",
),
plugins: {
react,
"react-hooks": fixupPluginRules(reactHooks),
"@typescript-eslint": typescriptEslint,
prettier,
},
languageOptions: {
globals: {
...globals.browser,
...globals.jest,
...globals.node,
},
ecmaVersion: "latest",
sourceType: "module",
parserOptions: {
ecmaVersion: 2020,
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
project: "./tsconfig.json",
},
},
settings: {
"import/resolver": {
typescript: {},
},
react: {
version: "detect",
},
},
rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "off",
"react/prop-types": "off",
"react/react-in-jsx-scope": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/naming-convention": ["error", {
selector: "variableLike",
format: ["camelCase", "snake_case", "PascalCase", "UPPER_CASE"],
leadingUnderscore: "allow",
}],
'@typescript-eslint/no-unused-vars': [
'error',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_' }
],
},
}]);

11010
frontend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -15,84 +15,90 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.22.9",
"@babel/plugin-transform-runtime": "^7.22.9",
"@babel/preset-env": "^7.22.9",
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"@babel/runtime": "^7.22.6",
"@types/jest": "^29.5.3",
"@types/latlon-geohash": "^2.0.3",
"@types/leaflet": "^1.9.7",
"@types/react": "^18.2.21",
"@types/react-dom": "^18.2.7",
"@types/webpack": "^5.28.4",
"@typescript-eslint/eslint-plugin": "^5.35.1",
"@typescript-eslint/parser": "^5.35.1",
"babel-loader": "^9.1.3",
"eslint": "^8.45.0",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard-with-typescript": "^36.1.0",
"@babel/core": "^7.27.1",
"@babel/plugin-transform-runtime": "^7.27.1",
"@babel/preset-env": "^7.27.2",
"@babel/preset-react": "^7.27.1",
"@babel/preset-typescript": "^7.27.1",
"@babel/runtime": "^7.27.1",
"@eslint/compat": "^1.2.9",
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.26.0",
"@types/jest": "^29.5.14",
"@types/latlon-geohash": "^2.0.4",
"@types/leaflet": "^1.9.17",
"@types/react": "^19.1.3",
"@types/react-dom": "^19.1.3",
"@types/webpack": "^5.28.5",
"@typescript-eslint/eslint-plugin": "^8.32.0",
"@typescript-eslint/parser": "^8.32.0",
"babel-loader": "^10.0.0",
"css-loader": "^7.1.2",
"eslint": "^9.26.0",
"eslint-config-love": "^119.0.0",
"eslint-config-prettier": "^10.1.5",
"eslint-import-resolver-typescript": "^4.3.4",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-n": "^17.18.0",
"eslint-plugin-prettier": "^5.4.0",
"eslint-plugin-promise": "^6.6.0",
"eslint-plugin-promise": "^7.2.1",
"eslint-plugin-react": "^7.37.5",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-hooks": "^5.2.0",
"filemanager-webpack-plugin": "^8.0.0",
"globals": "^16.1.0",
"html-webpack-plugin": "^5.6.3",
"jest": "^29.6.1",
"prettier": "^3.4.2",
"jest": "^29.7.0",
"prettier": "^3.5.3",
"style-loader": "^4.0.0",
"ts-node": "^10.9.2",
"typescript": "^5.7.2",
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4"
"typescript": "^5.8.3",
"webpack": "^5.99.8",
"webpack-cli": "^6.0.1"
},
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@christopherpickering/react-leaflet-markercluster": "^1.1.0",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/base": "^5.0.0-beta.7",
"@mui/icons-material": "^5.15.9",
"@mui/lab": "^5.0.0-alpha.136",
"@mui/material": "^5.15.14",
"@mui/system": "^6.1.5",
"@mui/x-date-pickers": "^7.23.1",
"@mui/x-data-grid": "^7.23.1",
"@nivo/core": "^0.89.1",
"@nivo/line": "^0.89.1",
"@emotion/react": "^11.14.0",
"@emotion/styled": "^11.14.0",
"@mui/base": "^5.0.0-beta.70",
"@mui/icons-material": "^7.1.0",
"@mui/lab": "^7.0.0-beta.12",
"@mui/material": "^7.1.0",
"@mui/system": "^7.1.0",
"@mui/x-data-grid": "^8.3.0",
"@mui/x-date-pickers": "^8.3.0",
"@nivo/core": "^0.94.0",
"@nivo/line": "^0.94.0",
"base-ex": "^0.8.1",
"country-flag-icons": "^1.5.13",
"date-fns": "^2.30.0",
"file-replace-loader": "^1.4.0",
"i18next": "^23.2.11",
"i18next-browser-languagedetector": "^8.0.2",
"i18next-http-backend": "^2.6.2",
"country-flag-icons": "^1.5.19",
"date-fns": "^4.1.0",
"file-replace-loader": "^1.4.2",
"i18next": "^25.1.2",
"i18next-browser-languagedetector": "^8.1.0",
"i18next-http-backend": "^3.0.2",
"install": "^0.13.0",
"js-sha256": "^0.11.0",
"latlon-geohash": "^2.0.0",
"leaflet": "^1.9.4",
"light-bolt11-decoder": "^3.1.1",
"light-bolt11-decoder": "^3.2.0",
"nostr-tools": "^2.12.0",
"npm": "^11.0.0",
"openpgp": "^5.11.0",
"react": "^18.2.0",
"npm": "^11.3.0",
"openpgp": "^6.1.0",
"react": "^18.3.0",
"react-countdown": "^2.3.6",
"react-dom": "^18.2.0",
"react-grid-layout": "^1.5.0",
"react-i18next": "^14.1.2",
"react-dom": "^18.3.0",
"react-grid-layout": "^1.5.1",
"react-i18next": "^15.5.1",
"react-image": "^4.1.0",
"react-leaflet": "^4.2.1",
"react-qr-code": "^2.0.11",
"react-router-dom": "^6.21.2",
"react-qr-code": "^2.0.15",
"react-router-dom": "^7.6.0",
"react-smooth-image": "^1.1.0",
"react-world-flags": "^1.6.0",
"reconnecting-websocket": "^4.4.0",
"robo-identities-wasm": "^0.1.0",
"simple-plist": "^1.3.1",
"webln": "^0.3.2",
"websocket": "^1.0.34"
"websocket": "^1.0.35"
}
}

View File

@ -15,7 +15,7 @@ import { GarageContextProvider } from './contexts/GarageContext';
import { FederationContextProvider } from './contexts/FederationContext';
import NotificationSwitchBadge from './components/NotificationSwitch';
const App = (): JSX.Element => {
const App = (): React.JSX.Element => {
const [client] = window.RobosatsSettings.split('-');
return (
<StrictMode>

View File

@ -14,7 +14,7 @@ import { FederationContext, type UseFederationStoreType } from '../../contexts/F
import VisitThirdParty from '../../components/Dialogs/VisitThirdParty';
import { type PublicOrder } from '../../models';
const BookPage = (): JSX.Element => {
const BookPage = (): React.JSX.Element => {
const { windowSize } = useContext<UseAppStoreType>(AppContext);
const { federation } = useContext<UseFederationStoreType>(FederationContext);
const { t } = useTranslation();
@ -43,7 +43,7 @@ const BookPage = (): JSX.Element => {
}
};
const NavButtons = function (): JSX.Element {
const NavButtons = function (): React.JSX.Element {
return (
<ButtonGroup variant='contained' color='inherit'>
<Button

View File

@ -1,5 +1,5 @@
import React, { useContext } from 'react';
import { MemoryRouter, HashRouter, BrowserRouter } from 'react-router-dom';
import { MemoryRouter, HashRouter, BrowserRouter, BrowserRouterProps } from 'react-router-dom';
import { Box, Typography, styled } from '@mui/material';
import { type UseAppStoreType, AppContext, closeAll } from '../contexts/AppContext';
@ -11,7 +11,11 @@ import { useTranslation } from 'react-i18next';
import { GarageContext, type UseGarageStoreType } from '../contexts/GarageContext';
import Routes from './Routes';
const getRouter = (): any => {
const getRouter = (): (({
basename,
children,
window,
}: BrowserRouterProps) => React.JSX.Element) => {
const [client] = window.RobosatsSettings.split('-');
if (client === 'web') {
return BrowserRouter;

View File

@ -28,7 +28,7 @@ export interface OpenDialogs {
thirdParty: string;
}
const MainDialogs = (): JSX.Element => {
const MainDialogs = (): React.JSX.Element => {
const { open, setOpen, settings, clientVersion } = useContext<UseAppStoreType>(AppContext);
const { federation } = useContext<UseFederationStoreType>(FederationContext);

View File

@ -14,7 +14,7 @@ import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageCon
import VisitThirdParty from '../../components/Dialogs/VisitThirdParty';
import { type PublicOrder } from '../../models';
const MakerPage = (): JSX.Element => {
const MakerPage = (): React.JSX.Element => {
const { fav, windowSize, navbarHeight } = useContext<UseAppStoreType>(AppContext);
const { federation } = useContext<UseFederationStoreType>(FederationContext);
const { garage, maker } = useContext<UseGarageStoreType>(GarageContext);
@ -37,7 +37,7 @@ const MakerPage = (): JSX.Element => {
mode: fav.mode,
coordinator: 'robosats',
},
premium: Number(maker.premium) ?? null,
premium: Number(maker.premium ?? null),
paymentMethods: maker.paymentMethods,
amountFilter: {
amount: maker.amount,

View File

@ -19,10 +19,10 @@ const StyledTooltip = styled(({ className, ...props }: TooltipProps) => (
}));
interface MoreTooltipProps {
children: JSX.Element;
children: React.JSX.Element;
}
const MoreTooltip = ({ children }: MoreTooltipProps): JSX.Element => {
const MoreTooltip = ({ children }: MoreTooltipProps): React.JSX.Element => {
const { t } = useTranslation();
const { open, setOpen } = useContext<UseAppStoreType>(AppContext);

View File

@ -18,7 +18,7 @@ import RobotAvatar from '../../components/RobotAvatar';
import { AppContext, type UseAppStoreType, closeAll } from '../../contexts/AppContext';
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
const NavBar = (): JSX.Element => {
const NavBar = (): React.JSX.Element => {
const theme = useTheme();
const { t } = useTranslation();
const { page, setPage, settings, setSlideDirection, open, setOpen, windowSize, navbarHeight } =
@ -70,7 +70,7 @@ const NavBar = (): JSX.Element => {
);
};
const changePage = function (mouseEvent: any, newPage: Page): void {
const changePage = function (_mouseEvent: React.SyntheticEven, newPage: Page): void {
if (newPage !== 'none') {
const slot = garage.getSlot();
handleSlideDirection(page, newPage);

View File

@ -13,7 +13,7 @@ import { Order, type Slot } from '../../models';
import { type UseGarageStoreType, GarageContext } from '../../contexts/GarageContext';
import { genBase62Token } from '../../utils';
const OrderPage = (): JSX.Element => {
const OrderPage = (): React.JSX.Element => {
const { windowSize, setOpen, acknowledgedWarning, setAcknowledgedWarning, navbarHeight } =
useContext<UseAppStoreType>(AppContext);
const { federation } = useContext<UseFederationStoreType>(FederationContext);

View File

@ -34,7 +34,7 @@ interface OnboardingProps {
baseUrl: string;
}
const Onboarding = ({ setView, inputToken, setInputToken }: OnboardingProps): JSX.Element => {
const Onboarding = ({ setView, inputToken, setInputToken }: OnboardingProps): React.JSX.Element => {
const { t } = useTranslation();
const navigate = useNavigate();

View File

@ -38,7 +38,7 @@ const RobotProfile = ({
setInputToken,
setView,
width,
}: RobotProfileProps): JSX.Element => {
}: RobotProfileProps): React.JSX.Element => {
const { windowSize, client, setOpen } = useContext<UseAppStoreType>(AppContext);
const { garage, slotUpdatedAt } = useContext<UseGarageStoreType>(GarageContext);
const { federation } = useContext<UseFederationStoreType>(FederationContext);

View File

@ -30,7 +30,7 @@ const TokenInput = ({
loading = false,
setInputToken,
setValidToken = () => {},
}: TokenInputProps): JSX.Element => {
}: TokenInputProps): React.JSX.Element => {
const { t } = useTranslation();
const { garage } = useContext<UseGarageStoreType>(GarageContext);
const [showCopied, setShowCopied] = useState<boolean>(false);

View File

@ -15,7 +15,7 @@ interface WelcomeProps {
setInputToken: (state: string) => void;
}
const Welcome = ({ setView, width, setInputToken }: WelcomeProps): JSX.Element => {
const Welcome = ({ setView, width, setInputToken }: WelcomeProps): React.JSX.Element => {
const { setPage } = useContext<UseAppStoreType>(AppContext);
const { t } = useTranslation();
const navigate = useNavigate();

View File

@ -20,7 +20,7 @@ import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
import RecoveryDialog from '../../components/Dialogs/Recovery';
const RobotPage = (): JSX.Element => {
const RobotPage = (): React.JSX.Element => {
const { torStatus, windowSize, settings, page, client } = useContext<UseAppStoreType>(AppContext);
const { garage } = useContext<UseGarageStoreType>(GarageContext);
const { t } = useTranslation();

View File

@ -5,7 +5,7 @@ import { t } from 'i18next';
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
const Coordinators = (): JSX.Element => {
const Coordinators = (): React.JSX.Element => {
const { federation, addNewCoordinator } = useContext<UseFederationStoreType>(FederationContext);
const { garage } = useContext<UseGarageStoreType>(GarageContext);
const [newAlias, setNewAlias] = useState<string>('');

View File

@ -4,7 +4,7 @@ import SettingsForm from '../../components/SettingsForm';
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
import Coordinators from './Coordinators';
const SettingsPage = (): JSX.Element => {
const SettingsPage = (): React.JSX.Element => {
const { windowSize, navbarHeight } = useContext<UseAppStoreType>(AppContext);
const maxHeight = (windowSize.height - navbarHeight) * 0.85 - 3;
return (

View File

@ -24,7 +24,7 @@ const BookControl = ({
width,
paymentMethod,
setPaymentMethods,
}: BookControlProps): JSX.Element => {
}: BookControlProps): React.JSX.Element => {
const { fav, setFav } = useContext<UseAppStoreType>(AppContext);
const { federation } = useContext<UseFederationStoreType>(FederationContext);

View File

@ -88,7 +88,7 @@ const BookTable = ({
showFooter = true,
showNoResults = true,
onOrderClicked = () => null,
}: BookTableProps): JSX.Element => {
}: BookTableProps): React.JSX.Element => {
const { fav, setOpen } = useContext<UseAppStoreType>(AppContext);
const { federation } = useContext<UseFederationStoreType>(FederationContext);
@ -183,7 +183,7 @@ const BookTable = ({
field: 'maker_nick',
headerName: t('Robot'),
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
const thirdParty = thirdParties[params.row.coordinatorShortAlias];
return (
<ListItemButton
@ -219,7 +219,7 @@ const BookTable = ({
field: 'maker_nick',
headerName: t('Robot'),
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
const coordinator = federation.getCoordinator(params.row.coordinatorShortAlias);
const thirdParty = thirdParties[params.row.coordinatorShortAlias];
return (
@ -264,7 +264,7 @@ const BookTable = ({
field: 'coordinatorShortAlias',
headerName: t('Host'),
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
const coordinator = federation.getCoordinator(params.row.coordinatorShortAlias);
const thirdParty = thirdParties[params.row.coordinatorShortAlias];
return (
@ -298,7 +298,7 @@ const BookTable = ({
field: 'type',
headerName: t('Is'),
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
return (
<div
style={{ cursor: 'pointer' }}
@ -324,7 +324,7 @@ const BookTable = ({
headerName: t('Amount'),
type: 'number',
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
const amount = fav.mode === 'swap' ? params.row.amount * 100 : params.row.amount;
const minAmount =
fav.mode === 'swap' ? params.row.min_amount * 100 : params.row.min_amount;
@ -352,7 +352,7 @@ const BookTable = ({
field: 'currency',
headerName: t('Currency'),
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
const currencyCode = String(currencyDict[params.row.currency.toString()]);
return (
<div
@ -382,7 +382,7 @@ const BookTable = ({
field: 'payment_method',
headerName: fav.mode === 'fiat' ? t('Payment Method') : t('Destination'),
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
return (
<div
style={{ cursor: 'pointer' }}
@ -411,7 +411,7 @@ const BookTable = ({
field: 'payment_method',
headerName: t('Pay'),
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
return (
<div
style={{
@ -441,7 +441,7 @@ const BookTable = ({
headerName: t('Price'),
type: 'number',
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
const currencyCode = String(currencyDict[params.row.currency.toString()]);
const coordinator =
federation.getCoordinator(params.row.coordinatorShortAlias) ??
@ -480,7 +480,7 @@ const BookTable = ({
headerName: t('Premium'),
type: 'number',
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
const currencyCode = String(currencyDict[params.row.currency.toString()]);
let fontColor = `rgb(0,0,0)`;
let premiumPoint = 0;
@ -532,7 +532,7 @@ const BookTable = ({
headerName: t('Timer'),
type: 'number',
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
const hours = Math.round(params.row.escrow_duration / 3600);
const minutes = Math.round((params.row.escrow_duration - hours * 3600) / 60);
return (
@ -555,7 +555,7 @@ const BookTable = ({
headerName: t('Expiry'),
type: 'string',
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
const expiresAt: Date = new Date(params.row.expires_at);
const timeToExpiry: number = Math.abs(expiresAt - new Date());
const percent = Math.round((timeToExpiry / (24 * 60 * 60 * 1000)) * 100);
@ -603,7 +603,7 @@ const BookTable = ({
headerName: t('Sats now'),
type: 'number',
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
const coordinator =
federation.getCoordinator(params.row.coordinatorShortAlias) ??
federation.getCoordinators()[0];
@ -637,7 +637,7 @@ const BookTable = ({
field: 'id',
headerName: 'Order ID',
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
return (
<div
style={{ cursor: 'pointer' }}
@ -660,7 +660,7 @@ const BookTable = ({
headerName: t('Bond'),
type: 'number',
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: PublicOrder }) => {
return (
<div
style={{ cursor: 'pointer' }}
@ -850,7 +850,7 @@ const BookTable = ({
return filteredColumns(fullscreen ? fullWidth : maxWidth);
}, [maxWidth, fullscreen, fullWidth, fav.mode]);
const Footer = function (): JSX.Element {
const Footer = function (): React.JSX.Element {
return (
<Grid container alignItems='center' direction='row' justifyContent='space-between'>
<Grid item>
@ -883,7 +883,7 @@ const BookTable = ({
);
};
const NoResultsOverlay = function (): JSX.Element {
const NoResultsOverlay = function (): React.JSX.Element {
return (
<Grid
container

View File

@ -20,7 +20,7 @@ interface Props {
onClose: () => void;
}
const AboutDialog = ({ open, onClose }: Props): JSX.Element => {
const AboutDialog = ({ open, onClose }: Props): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -23,7 +23,7 @@ import ContentCopy from '@mui/icons-material/ContentCopy';
import ForumIcon from '@mui/icons-material/Forum';
import { ExportIcon, NewTabIcon } from '../Icons';
function CredentialTextfield(props): JSX.Element {
function CredentialTextfield(props): React.JSX.Element {
return (
<Grid item align='center' xs={12}>
<Tooltip placement='top' enterTouchDelay={200} enterDelay={200} title={props.tooltipTitle}>
@ -75,7 +75,7 @@ const AuditPGPDialog = ({
peerPubKey,
passphrase,
onClickBack,
}: Props): JSX.Element => {
}: Props): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -15,7 +15,7 @@ interface Props {
onAccept: () => void;
}
const CancelOrderDialog = ({ open, onClose, onAccept }: Props): JSX.Element => {
const CancelOrderDialog = ({ open, onClose, onAccept }: Props): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -24,7 +24,7 @@ interface Props {
onClose: () => void;
}
const ClientDialog = ({ open = false, onClose }: Props): JSX.Element => {
const ClientDialog = ({ open = false, onClose }: Props): React.JSX.Element => {
const { t } = useTranslation();
const { clientVersion } = useContext<AppContextProps>(AppContext);

View File

@ -24,7 +24,7 @@ interface Props {
onClose: () => void;
}
const CommunityDialog = ({ open = false, onClose }: Props): JSX.Element => {
const CommunityDialog = ({ open = false, onClose }: Props): React.JSX.Element => {
const { t } = useTranslation();
const [client] = window.RobosatsSettings.split('-');

View File

@ -15,7 +15,7 @@ const ConfirmationDialog = ({
hasRobot,
onClickDone,
onClickGenerateRobot = () => null,
}: ConfirmationDialogProps): JSX.Element => {
}: ConfirmationDialogProps): React.JSX.Element => {
return hasRobot ? (
<StoreTokenDialog
open={open}

View File

@ -93,7 +93,7 @@ const ContactButtons = ({
simplex,
website,
reddit,
}: Contact): JSX.Element => {
}: Contact): React.JSX.Element => {
const { t } = useTranslation();
const [showMatrix, setShowMatrix] = useState<boolean>(false);
const [showNostr, setShowNostr] = useState<boolean>(false);
@ -260,7 +260,7 @@ interface BadgesProps {
size_limit: number | undefined;
}
const BadgesHall = ({ badges, size_limit }: BadgesProps): JSX.Element => {
const BadgesHall = ({ badges, size_limit }: BadgesProps): React.JSX.Element => {
const { t } = useTranslation();
const sxProps = {
width: '3em',
@ -355,7 +355,7 @@ const BadgesHall = ({ badges, size_limit }: BadgesProps): JSX.Element => {
);
};
const CoordinatorDialog = ({ open = false, onClose, shortAlias }: Props): JSX.Element => {
const CoordinatorDialog = ({ open = false, onClose, shortAlias }: Props): React.JSX.Element => {
const { t } = useTranslation();
const { clientVersion, page, settings, origin } = useContext(AppContext);
const { federation } = useContext<UseFederationStoreType>(FederationContext);

View File

@ -22,7 +22,7 @@ interface Props {
tgToken: string;
}
const EnableTelegramDialog = ({ open, onClose, tgBotName, tgToken }: Props): JSX.Element => {
const EnableTelegramDialog = ({ open, onClose, tgBotName, tgToken }: Props): React.JSX.Element => {
const { settings } = useContext<UseAppStoreType>(AppContext);
const { t } = useTranslation();
const theme = useTheme();

View File

@ -32,7 +32,7 @@ interface Props {
onClose: () => void;
}
const ExchangeDialog = ({ open = false, onClose }: Props): JSX.Element => {
const ExchangeDialog = ({ open = false, onClose }: Props): React.JSX.Element => {
const { t } = useTranslation();
const { federation } = useContext(FederationContext);
const [loadingInfo, setLoadingInfo] = useState<boolean>(true);

View File

@ -34,7 +34,7 @@ const F2fMapDialog = ({
interactive = false,
zoom,
message = '',
}: Props): JSX.Element => {
}: Props): React.JSX.Element => {
const { t } = useTranslation();
const [position, setPosition] = useState<[number, number]>();
const [useTiles, setUseTiles] = useState<boolean>(false);

View File

@ -15,7 +15,7 @@ interface Props {
onClose: () => void;
}
const LearnDialog = ({ open, onClose }: Props): JSX.Element => {
const LearnDialog = ({ open, onClose }: Props): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -21,7 +21,7 @@ const NoRobotDialog = ({
open,
onClose,
onClickGenerateRobot = () => null,
}: Props): JSX.Element => {
}: Props): React.JSX.Element => {
const { t } = useTranslation();
const navigate = useNavigate();

View File

@ -25,7 +25,7 @@ interface Props {
onClose: () => void;
}
const ProfileDialog = ({ open = false, onClose }: Props): JSX.Element => {
const ProfileDialog = ({ open = false, onClose }: Props): React.JSX.Element => {
const { federation } = useContext<UseFederationStoreType>(FederationContext);
const { garage, slotUpdatedAt } = useContext<UseGarageStoreType>(GarageContext);
const { t } = useTranslation();
@ -109,7 +109,7 @@ const ProfileDialog = ({ open = false, onClose }: Props): JSX.Element => {
<b>{t('Coordinators that know your robot:')}</b>
</Typography>
{federation.getCoordinators().map((coordinator: Coordinator): JSX.Element => {
{federation.getCoordinators().map((coordinator: Coordinator): React.JSX.Element => {
const coordinatorRobot = garage.getSlot()?.getRobot(coordinator.shortAlias);
return (
<div key={coordinator.shortAlias}>

View File

@ -12,7 +12,7 @@ interface Props {
setInputToken: (inputToken: string) => void;
}
const RecoveryDialog = ({ setInputToken, setView }: Props): JSX.Element => {
const RecoveryDialog = ({ setInputToken, setView }: Props): React.JSX.Element => {
const { t } = useTranslation();
const { open, setOpen } = useContext<UseAppStoreType>(AppContext);
const { garage } = useContext<UseGarageStoreType>(GarageContext);

View File

@ -23,7 +23,12 @@ interface Props {
onClickDone: () => void;
}
const StoreTokenDialog = ({ open, onClose, onClickBack, onClickDone }: Props): JSX.Element => {
const StoreTokenDialog = ({
open,
onClose,
onClickBack,
onClickDone,
}: Props): React.JSX.Element => {
const { garage } = useContext<UseGarageStoreType>(GarageContext);
const { t } = useTranslation();

View File

@ -38,7 +38,7 @@ const ContactButtons = ({
simplex,
website,
reddit,
}: Contact): JSX.Element => {
}: Contact): React.JSX.Element => {
const { t } = useTranslation();
const [showMatrix, setShowMatrix] = useState<boolean>(false);
const [showNostr, setShowNostr] = useState<boolean>(false);
@ -186,7 +186,7 @@ const ContactButtons = ({
);
};
const ThirdPartyDialog = ({ open = false, onClose, shortAlias }: Props): JSX.Element => {
const ThirdPartyDialog = ({ open = false, onClose, shortAlias }: Props): React.JSX.Element => {
const { t } = useTranslation();
const { federation } = useContext<UseFederationStoreType>(FederationContext);
const [thirdParty, setThirdParty] = useState<Coordinator>(thirdParties[shortAlias]);

View File

@ -26,7 +26,7 @@ interface Props {
onClose: () => void;
}
const UpdateDialog = ({ coordinatorVersion, clientVersion }: Props): JSX.Element => {
const UpdateDialog = ({ coordinatorVersion, clientVersion }: Props): React.JSX.Element => {
const { t } = useTranslation();
const [open, setOpen] = useState<boolean>(() => checkVer(coordinatorVersion));
const coordinatorString = `v${coordinatorVersion.major}-${coordinatorVersion.minor}-${coordinatorVersion.patch}`;

View File

@ -17,7 +17,7 @@ interface Props {
thirdPartyOrder?: PublicOrder;
}
const VisitThirdParty = ({ open, onClose, thirdPartyOrder }: Props): JSX.Element => {
const VisitThirdParty = ({ open, onClose, thirdPartyOrder }: Props): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -15,7 +15,7 @@ interface Props {
longAlias: string;
}
const WarningDialog = ({ open, onClose, longAlias }: Props): JSX.Element => {
const WarningDialog = ({ open, onClose, longAlias }: Props): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -20,7 +20,7 @@ const FederationTable = ({
maxWidth = 90,
maxHeight = 50,
fillContainer = false,
}: FederationTableProps): JSX.Element => {
}: FederationTableProps): React.JSX.Element => {
const { t } = useTranslation();
const { federation, federationUpdatedAt } = useContext<UseFederationStoreType>(FederationContext);
const { setOpen, windowSize, settings } = useContext<UseAppStoreType>(AppContext);
@ -89,12 +89,12 @@ const FederationTable = ({
});
};
const aliasObj = useCallback((_width: number) => {
const aliasObj = useCallback(() => {
return {
field: 'longAlias',
headerName: mobile ? '' : t('Rating'),
width: mobile ? 60 : 190,
renderCell: (params: any) => {
renderCell: (params: { row: Coordinator }) => {
const coordinator = federation.getCoordinator(params.row.shortAlias);
return (
<Grid
@ -130,53 +130,50 @@ const FederationTable = ({
};
}, []);
const ratingObj = useCallback(
(width: number) => {
return {
field: 'rating',
headerName: t('Rating'),
width: mobile ? 60 : 180,
renderCell: (params: any) => {
const coordinator = federation.getCoordinator(params.row.shortAlias);
const coordinatorRating = ratings[coordinator.nostrHexPubkey];
const ratingObj = useCallback(() => {
return {
field: 'rating',
headerName: t('Rating'),
width: mobile ? 60 : 180,
renderCell: (params: { row: Coordinator }) => {
const coordinator = federation.getCoordinator(params.row.shortAlias);
const coordinatorRating = ratings[coordinator.nostrHexPubkey];
if (!coordinatorRating) return <></>;
if (!coordinatorRating) return <></>;
const average =
coordinatorRating && coordinatorRating[1] > 0
? coordinatorRating[0] / coordinatorRating[1]
: 0;
return (
<>
{mobile ? (
<Grid container direction='column' alignItems='center' style={{ paddingTop: 10 }}>
<Typography>{`${parseFloat((average * 10).toFixed(1))}`}</Typography>
</Grid>
) : (
<>
<Rating
readOnly
precision={0.5}
name='size-large'
value={average * 5}
defaultValue={0}
disabled={settings.connection !== 'nostr'}
onClick={() => {
onClickCoordinator(params.row.shortAlias);
}}
/>
<Typography variant='caption' color='text.secondary'>
{`(${coordinatorRating[1]})`}
</Typography>
</>
)}
</>
);
},
};
},
[federationUpdatedAt],
);
const average =
coordinatorRating && coordinatorRating[1] > 0
? coordinatorRating[0] / coordinatorRating[1]
: 0;
return (
<>
{mobile ? (
<Grid container direction='column' alignItems='center' style={{ paddingTop: 10 }}>
<Typography>{`${parseFloat((average * 10).toFixed(1))}`}</Typography>
</Grid>
) : (
<>
<Rating
readOnly
precision={0.5}
name='size-large'
value={average * 5}
defaultValue={0}
disabled={settings.connection !== 'nostr'}
onClick={() => {
onClickCoordinator(params.row.shortAlias);
}}
/>
<Typography variant='caption' color='text.secondary'>
{`(${coordinatorRating[1]})`}
</Typography>
</>
)}
</>
);
},
};
}, [federationUpdatedAt]);
const enabledObj = useCallback(
(width: number) => {
@ -184,7 +181,7 @@ const FederationTable = ({
field: 'enabled',
headerName: t('Enabled'),
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: Coordinator }) => {
return (
<Checkbox
checked={params.row.enabled}
@ -205,7 +202,7 @@ const FederationTable = ({
field: 'up',
headerName: t('Up'),
width: width * fontSize,
renderCell: (params: any) => {
renderCell: (params: { row: Coordinator }) => {
return (
<div
style={{ cursor: 'pointer' }}

View File

@ -2,7 +2,7 @@ import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Paper, Alert, AlertTitle, Button } from '@mui/material';
const SelfhostedAlert = (): JSX.Element => {
const SelfhostedAlert = (): React.JSX.Element => {
const { t } = useTranslation();
const [show, setShow] = useState<boolean>(true);

View File

@ -31,7 +31,7 @@ function federationUrls(): string[] {
export const safeUrls = federationUrls();
const UnsafeAlert = (): JSX.Element => {
const UnsafeAlert = (): React.JSX.Element => {
const { hostUrl } = useContext<UseAppStoreType>(AppContext);
const { windowSize } = useContext<UseAppStoreType>(AppContext);
const { t } = useTranslation();

View File

@ -3,7 +3,7 @@ import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
import SelfhostedAlert from './SelfhostedAlert';
import UnsafeAlert from './UnsafeAlert';
const HostAlert = (): JSX.Element => {
const HostAlert = (): React.JSX.Element => {
const { client, hostUrl } = useContext<UseAppStoreType>(AppContext);
const component =
!hostUrl.includes('robosats') && (client === 'selfhosted' || client === 'desktop')

View File

@ -9,10 +9,14 @@ interface Props {
height?: string | number;
}
const FlagWithProps = ({ code, width = '1.428em', height = '1.428em' }: Props): JSX.Element => {
const FlagWithProps = ({
code,
width = '1.428em',
height = '1.428em',
}: Props): React.JSX.Element => {
const defaultProps = { width, height };
let flag: JSX.Element | null = null;
let flag: React.JSX.Element | null = null;
if (code === 'AED') flag = <Flags.AE {...defaultProps} />;
if (code === 'AUD') flag = <Flags.AU {...defaultProps} />;

View File

@ -33,7 +33,7 @@ interface AmountRangeProps {
maxAmount: string;
type: number;
currency: number;
handleRangeAmountChange: (e: any, activeThumb: any) => void;
handleRangeAmountChange: (event: Event, value: number | number[], activeThumb: number) => void;
handleMaxAmountChange: (
e: React.ChangeEventHandler<HTMLInputElement | HTMLTextAreaElement>,
) => void;

View File

@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { useTranslation } from 'react-i18next';
import useAutocomplete from '@mui/base/useAutocomplete';
import { useAutocomplete } from '@mui/base/useAutocomplete';
import { styled } from '@mui/material/styles';
import {
Button,
@ -19,6 +19,7 @@ import { fiatMethods, swapMethods, PaymentIcon } from '../PaymentMethods';
import DashboardCustomizeIcon from '@mui/icons-material/DashboardCustomize';
import CheckIcon from '@mui/icons-material/Check';
import CloseIcon from '@mui/icons-material/Close';
import { MUIStyledCommonProps } from '@mui/system';
const Root = styled('div')(
({ theme }) => `
@ -41,7 +42,7 @@ const Label = styled('label')(
pointer-events: none;
position: relative;
left: 1em;
top: ${String(sx.top) ?? '0.72em'};
top: ${String(sx?.top ?? '0.72em')};
maxHeight: 0em;
height: 0em;
white-space: no-wrap;
@ -268,9 +269,9 @@ interface AutocompletePaymentsProps {
optionsType: 'fiat' | 'swap';
onAutocompleteChange: (value: string) => void;
tooltipTitle: string;
labelProps: any;
tagProps: any;
listBoxProps: any;
labelProps: MUIStyledCommonProps;
tagProps: MUIStyledCommonProps;
listBoxProps: MUIStyledCommonProps;
error: string;
label: string;
sx: SxProps<Theme>;
@ -326,7 +327,9 @@ const AutocompletePayments: React.FC<AutocompletePaymentsProps> = (props) => {
const theme = useTheme();
const iconSize = 1.5 * theme.typography.fontSize;
function handleAddNew(inputProps: any): void {
function handleAddNew(
inputProps: React.InputHTMLAttributes<HTMLInputElement> & { ref: React.Ref<HTMLInputElement> },
): void {
fiatMethods.push({ name: inputProps.value, icon: 'custom' });
const a = value.push({ name: inputProps.value, icon: 'custom' });
setVal(() => '');

View File

@ -61,7 +61,7 @@ const MakerForm = ({
onSubmit = () => {},
onReset = () => {},
submitButtonLabel = 'Create Order',
}: MakerFormProps): JSX.Element => {
}: MakerFormProps): React.JSX.Element => {
const { fav, setFav } = useContext<UseAppStoreType>(AppContext);
const { federation, federationUpdatedAt } = useContext<UseFederationStoreType>(FederationContext);
const { maker, setMaker, garage } = useContext<UseGarageStoreType>(GarageContext);
@ -421,7 +421,11 @@ const MakerForm = ({
});
};
const handleRangeAmountChange = function (e: any, newValue, activeThumb: number): void {
const handleRangeAmountChange = (
e: Event,
newValue: number | number[],
activeThumb: number,
): void => {
let minAmount = e.target.value[0];
let maxAmount = e.target.value[1];
@ -541,7 +545,7 @@ const MakerForm = ({
}
};
const SummaryText = (): JSX.Element => {
const SummaryText = (): React.JSX.Element => {
return (
<Typography
component='h2'
@ -1197,9 +1201,7 @@ const MakerForm = ({
loading={submittingRequest}
color='primary'
variant='contained'
onClick={() => {
disableRequest ? onSubmit() : setOpenDialogs(true);
}}
onClick={() => (disableRequest ? onSubmit() : setOpenDialogs(true))}
>
{t(submitButtonLabel)}
</LoadingButton>

View File

@ -120,8 +120,8 @@ const SelectCoordinator: React.FC<SelectCoordinatorProps> = ({
onChange={handleCoordinatorChange}
disableUnderline
>
{federation.getCoordinators().map((coordinator): JSX.Element | null => {
let row: JSX.Element | null = null;
{federation.getCoordinators().map((coordinator): React.JSX.Element | null => {
let row: React.JSX.Element | null = null;
if (coordinator.enabled === true) {
row = (
<MenuItem key={coordinator.shortAlias} value={coordinator.shortAlias}>

View File

@ -39,7 +39,7 @@ const Map = ({
onOrderClicked = () => null,
center = [0, 0],
interactive = false,
}: Props): JSX.Element => {
}: Props): React.JSX.Element => {
const theme = useTheme();
const { worldmap } = useContext<UseAppStoreType>(AppContext);
@ -48,7 +48,7 @@ const Map = ({
position: [number, number],
orderType: number,
order?: PublicOrder,
): JSX.Element => {
): React.JSX.Element => {
const fillColor = orderType === 1 ? theme.palette.primary.main : theme.palette.secondary.main;
const outlineColor = 'black';
const eyesColor = 'white';
@ -66,8 +66,8 @@ const Map = ({
})
}
eventHandlers={{
click: (_event: LeafletMouseEvent) => {
order?.id != null && onOrderClicked(order.id, order.coordinatorShortAlias);
click: () => {
if (order?.id != null) onOrderClicked(order.id, order.coordinatorShortAlias);
},
}}
>
@ -80,7 +80,7 @@ const Map = ({
);
};
const LocationMarker = (): JSX.Element => {
const LocationMarker = (): React.JSX.Element => {
useMapEvents({
click(event: LeafletMouseEvent) {
if (interactive) {
@ -92,7 +92,7 @@ const Map = ({
return position != null ? RobotMarker('marker', position, orderType ?? 0) : <></>;
};
const getOrderMarkers = (): JSX.Element => {
const getOrderMarkers = (): React.JSX.Element => {
if (orders.length < 1) return <></>;
return (
<MarkerClusterGroup showCoverageOnHover={true} disableClusteringAtZoom={14}>

View File

@ -4,7 +4,7 @@ import { NotificationsActive, NotificationsOff } from '@mui/icons-material';
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
import { systemClient } from '../../services/System';
const NotificationSwitchBadge = (): JSX.Element => {
const NotificationSwitchBadge = (): React.JSX.Element => {
const { setSettings, settings, torStatus } = useContext<UseAppStoreType>(AppContext);
const theme = useTheme();

View File

@ -66,7 +66,7 @@ const Notifications = ({
page,
windowWidth,
openProfile,
}: NotificationsProps): JSX.Element => {
}: NotificationsProps): React.JSX.Element => {
const { t } = useTranslation();
const navigate = useNavigate();
const { garage, slotUpdatedAt } = useContext<UseGarageStoreType>(GarageContext);

View File

@ -44,7 +44,7 @@ const TakeButton = ({
currentOrder,
info,
onClickGenerateRobot = () => null,
}: TakeButtonProps): JSX.Element => {
}: TakeButtonProps): React.JSX.Element => {
const { t } = useTranslation();
const theme = useTheme();
const navigate = useNavigate();
@ -83,7 +83,7 @@ const TakeButton = ({
const currencyCode: string =
currentOrder?.currency === 1000 ? 'Sats' : currencies[`${Number(currentOrder?.currency)}`];
const InactiveMakerDialog = function (): JSX.Element {
const InactiveMakerDialog = function (): React.JSX.Element {
return (
<Dialog
open={open.inactiveMaker}
@ -128,7 +128,7 @@ const TakeButton = ({
const countdownTakeOrderRenderer = function ({
seconds,
completed,
}: countdownTakeOrderRendererProps): JSX.Element {
}: countdownTakeOrderRendererProps): React.JSX.Element {
if (isNaN(seconds) || completed) {
return takeOrderButton();
} else {
@ -185,7 +185,7 @@ const TakeButton = ({
);
}, [takeAmount, slotUpdatedAt]);
const takeOrderButton = function (): JSX.Element {
const takeOrderButton = function (): React.JSX.Element {
if (currentOrder?.has_range) {
return (
<Box

View File

@ -55,7 +55,7 @@ const OrderDetails = ({
currentOrder,
onClickCoordinator = () => null,
onClickGenerateRobot = () => null,
}: OrderDetailsProps): JSX.Element => {
}: OrderDetailsProps): React.JSX.Element => {
const { t } = useTranslation();
const theme = useTheme();
const { federation } = useContext<UseFederationStoreType>(FederationContext);
@ -106,7 +106,7 @@ const OrderDetails = ({
minutes,
seconds,
completed,
}: CountdownRenderProps): JSX.Element {
}: CountdownRenderProps): React.JSX.Element {
if (completed) {
// Render a completed state
return <span> {t('The order has expired')}</span>;
@ -132,7 +132,7 @@ const OrderDetails = ({
}
};
const timerRenderer = function (seconds: number): JSX.Element {
const timerRenderer = function (seconds: number): React.JSX.Element {
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds - hours * 3600) / 60);
return (
@ -151,7 +151,7 @@ const OrderDetails = ({
minutes: number;
seconds: number;
completed: boolean;
}): JSX.Element => {
}): React.JSX.Element => {
if (completed) {
// Render a completed state
return <span> {t('Penalty lifted, good to go!')}</span>;

View File

@ -84,7 +84,7 @@ const RobotInfo: React.FC<Props> = ({ coordinator, onClose, disabled }: Props) =
}
};
const handleSubmitInvoiceClicked = (e: any, rewardInvoice: string): void => {
const handleSubmitInvoiceClicked = (e: Event, rewardInvoice: string): void => {
setBadInvoice('');
setShowRewardsSpinner(true);

View File

@ -35,7 +35,7 @@ interface SettingsFormProps {
dense?: boolean;
}
const SettingsForm = ({ dense = false }: SettingsFormProps): JSX.Element => {
const SettingsForm = ({ dense = false }: SettingsFormProps): React.JSX.Element => {
const { settings, setSettings, client } = useContext<UseAppStoreType>(AppContext);
const theme = useTheme();
const { t } = useTranslation();

View File

@ -16,7 +16,7 @@ const TorIndicator = ({
tooltipOpen = undefined,
title,
progress,
}: TorIndicatorProps): JSX.Element => {
}: TorIndicatorProps): React.JSX.Element => {
return (
<Tooltip
open={tooltipOpen}
@ -54,7 +54,7 @@ const TorIndicator = ({
);
};
const TorConnectionBadge = (): JSX.Element => {
const TorConnectionBadge = (): React.JSX.Element => {
const { torStatus, settings } = useContext<UseAppStoreType>(AppContext);
const { t } = useTranslation();

View File

@ -8,7 +8,7 @@ interface BondStatusProps {
isMaker: boolean;
}
const BondStatus = ({ status, isMaker }: BondStatusProps): JSX.Element => {
const BondStatus = ({ status, isMaker }: BondStatusProps): React.JSX.Element => {
const { t } = useTranslation();
const theme = useTheme();

View File

@ -19,7 +19,7 @@ const CancelButton = ({
openCancelDialog,
openCollabCancelDialog,
loading = false,
}: CancelButtonProps): JSX.Element => {
}: CancelButtonProps): React.JSX.Element => {
const { t } = useTranslation();
const [openCancelWarning, setOpenCancelWarning] = useState<boolean>(false);

View File

@ -7,7 +7,7 @@ interface CollabCancelAlertProps {
order: Order | null;
}
const CollabCancelAlert = ({ order }: CollabCancelAlertProps): JSX.Element => {
const CollabCancelAlert = ({ order }: CollabCancelAlertProps): React.JSX.Element => {
const { t } = useTranslation();
let text = '';
if (order?.pending_cancel === true && order?.status === 9) {

View File

@ -19,7 +19,7 @@ export const ConfirmCancelDialog = ({
open,
onClose,
onCancelClick,
}: ConfirmCancelDialogProps): JSX.Element => {
}: ConfirmCancelDialogProps): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -24,7 +24,7 @@ export const ConfirmCollabCancelDialog = ({
onClose,
onCollabCancelClick,
peerAskedCancel,
}: ConfirmCollabCancelDialogProps): JSX.Element => {
}: ConfirmCollabCancelDialogProps): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -19,7 +19,7 @@ export const ConfirmDisputeDialog = ({
open,
onClose,
onAgreeClick,
}: ConfirmDisputeDialogProps): JSX.Element => {
}: ConfirmDisputeDialogProps): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -27,7 +27,7 @@ export const ConfirmFiatReceivedDialog = ({
onClose,
order,
onConfirmClick,
}: ConfirmFiatReceivedDialogProps): JSX.Element => {
}: ConfirmFiatReceivedDialogProps): React.JSX.Element => {
const { t } = useTranslation();
const currencyCode = currencies[order?.currency.toString()];
const amount = pn(

View File

@ -27,7 +27,7 @@ export const ConfirmFiatSentDialog = ({
onClose,
order,
onConfirmClick,
}: ConfirmFiatSentDialogProps): JSX.Element => {
}: ConfirmFiatSentDialogProps): React.JSX.Element => {
const { t } = useTranslation();
const currencyCode = currencies[order?.currency.toString()];
const amount = pn(

View File

@ -22,7 +22,7 @@ export const ConfirmUndoFiatSentDialog = ({
loadingButton,
onClose,
onConfirmClick,
}: ConfirmUndoFiatSentDialogProps): JSX.Element => {
}: ConfirmUndoFiatSentDialogProps): React.JSX.Element => {
const { t } = useTranslation();
const [time, setTime] = useState<number>(60);

View File

@ -25,7 +25,7 @@ export const WebLNDialog = ({
onClose,
waitingWebln,
isBuyer,
}: WebLNDialogProps): JSX.Element => {
}: WebLNDialogProps): React.JSX.Element => {
const { t } = useTranslation();
const theme = useTheme();

View File

@ -53,7 +53,7 @@ const EncryptedSocketChat: React.FC<Props> = ({
turtleMode,
setTurtleMode,
onSendMessage,
}: Props): JSX.Element => {
}: Props): React.JSX.Element => {
const { t } = useTranslation();
const theme = useTheme();
const { origin, hostUrl, settings } = useContext<UseAppStoreType>(AppContext);
@ -164,7 +164,7 @@ const EncryptedSocketChat: React.FC<Props> = ({
};
};
const onMessage: (message: any) => void = (message) => {
const onMessage: (message: object) => void = (message) => {
const dataFromServer = JSON.parse(message.data);
const slot = garage.getSlot();
const robot = slot?.getRobot();

View File

@ -52,7 +52,7 @@ const EncryptedTurtleChat: React.FC<Props> = ({
setTurtleMode,
turtleMode,
onSendMessage,
}: Props): JSX.Element => {
}: Props): React.JSX.Element => {
const { t } = useTranslation();
const theme = useTheme();
const { origin, hostUrl, settings } = useContext<UseAppStoreType>(AppContext);
@ -102,7 +102,7 @@ const EncryptedTurtleChat: React.FC<Props> = ({
.get(url + basePath, `/api/chat/?order_id=${order.id}&offset=${lastIndex}`, {
tokenSHA256: garage.getSlot()?.getRobot()?.tokenSHA256 ?? '',
})
.then((results: any) => {
.then((results: object) => {
if (results != null) {
setPeerConnected(results.peer_connected);
setPeerPubKey(results.peer_pubkey.split('\\').join('\n'));

View File

@ -40,7 +40,7 @@ const EncryptedChat: React.FC<Props> = ({
setMessages,
messages,
status,
}: Props): JSX.Element => {
}: Props): React.JSX.Element => {
const [turtleMode, setTurtleMode] = useState<boolean>(false);
const { garage } = useContext<UseGarageStoreType>(GarageContext);
const { federation } = useContext<UseFederationStoreType>(FederationContext);

View File

@ -48,7 +48,7 @@ export const DisputeStatementForm = ({
dispute,
shortAlias,
setDispute,
}: DisputeStatementFormProps): JSX.Element => {
}: DisputeStatementFormProps): React.JSX.Element => {
const { federation } = useContext<UseFederationStoreType>(FederationContext);
const { t } = useTranslation();

View File

@ -34,7 +34,7 @@ import { systemClient } from '../../../services/System';
import lnproxies from '../../../../static/lnproxies.json';
import { type UseAppStoreType, AppContext } from '../../../contexts/AppContext';
let filteredProxies: Array<Record<string, any>> = [];
let filteredProxies: Array<Record<string, object>> = [];
export interface LightningForm {
invoice: string;
amount: number;
@ -89,7 +89,7 @@ export const LightningPayoutForm = ({
lightning,
setLightning,
settings,
}: LightningPayoutFormProps): JSX.Element => {
}: LightningPayoutFormProps): React.JSX.Element => {
const { client } = useContext<UseAppStoreType>(AppContext);
const { t } = useTranslation();
const theme = useTheme();

View File

@ -31,7 +31,7 @@ export const OnchainPayoutForm = ({
onClickSubmit,
onchain,
setOnchain,
}: OnchainPayoutFormProps): JSX.Element => {
}: OnchainPayoutFormProps): React.JSX.Element => {
const { t } = useTranslation();
const minMiningFee = 2;

View File

@ -36,7 +36,7 @@ export const ChatPrompt = ({
loadingDispute,
messages,
setMessages,
}: ChatPromptProps): JSX.Element => {
}: ChatPromptProps): React.JSX.Element => {
const { t } = useTranslation();
const { slotUpdatedAt } = useContext<UseGarageStoreType>(GarageContext);
@ -59,7 +59,7 @@ export const ChatPrompt = ({
}: {
hours: number;
minutes: number;
}): JSX.Element {
}): React.JSX.Element {
return (
<span>{`${t('To open a dispute you need to wait')} ${hours}h ${zeroPad(minutes)}m `}</span>
);

View File

@ -17,7 +17,7 @@ export const DisputePrompt = ({
shortAlias,
onClickSubmit,
setDispute,
}: DisputePromptProps): JSX.Element => {
}: DisputePromptProps): React.JSX.Element => {
const { t } = useTranslation();
return (
<Grid

View File

@ -2,7 +2,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { List, ListItem, Divider, Typography } from '@mui/material';
export const DisputeLoserPrompt = (): JSX.Element => {
export const DisputeLoserPrompt = (): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -2,7 +2,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { List, ListItem, Divider, Typography } from '@mui/material';
export const DisputeWaitPeerPrompt = (): JSX.Element => {
export const DisputeWaitPeerPrompt = (): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -2,7 +2,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { List, ListItem, Divider, Typography } from '@mui/material';
export const DisputeWaitResolutionPrompt = (): JSX.Element => {
export const DisputeWaitResolutionPrompt = (): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -2,7 +2,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { List, ListItem, Divider, Typography } from '@mui/material';
export const DisputeWinnerPrompt = (): JSX.Element => {
export const DisputeWinnerPrompt = (): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -2,7 +2,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { List, ListItem, Divider, Typography } from '@mui/material';
export const EscrowWaitPrompt = (): JSX.Element => {
export const EscrowWaitPrompt = (): React.JSX.Element => {
const { t } = useTranslation();
return (
<List dense={true}>

View File

@ -15,7 +15,7 @@ export const ExpiredPrompt = ({
loadingRenew,
order,
onClickRenew,
}: ExpiredPromptProps): JSX.Element => {
}: ExpiredPromptProps): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -14,7 +14,10 @@ interface LockInvoicePromptProps {
concept: 'bond' | 'escrow';
}
export const LockInvoicePrompt = ({ order, concept }: LockInvoicePromptProps): JSX.Element => {
export const LockInvoicePrompt = ({
order,
concept,
}: LockInvoicePromptProps): React.JSX.Element => {
const { settings } = useContext<UseAppStoreType>(AppContext);
const { t } = useTranslation();
const theme = useTheme();
@ -42,7 +45,7 @@ export const LockInvoicePrompt = ({ order, concept }: LockInvoicePromptProps): J
return dict;
};
const ExpirationWarning = function (): JSX.Element {
const ExpirationWarning = function (): React.JSX.Element {
return (
<Typography variant='body2'>
{t(

View File

@ -13,7 +13,7 @@ interface PausedPrompProps {
export const PausedPrompt = ({
pauseLoading,
onClickResumeOrder,
}: PausedPrompProps): JSX.Element => {
}: PausedPrompProps): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -38,7 +38,7 @@ export const PayoutPrompt = ({
onchain,
setOnchain,
settings,
}: PayoutPrompProps): JSX.Element => {
}: PayoutPrompProps): React.JSX.Element => {
const { t } = useTranslation();
const currencyCode: string = currencies[`${order.currency}`];

View File

@ -2,7 +2,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { List, ListItem, Divider, Typography } from '@mui/material';
export const PayoutWaitPrompt = (): JSX.Element => {
export const PayoutWaitPrompt = (): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -27,7 +27,7 @@ export const PublicWaitPrompt = ({
order,
pauseLoading,
onClickPauseOrder,
}: PublicWaitPrompProps): JSX.Element => {
}: PublicWaitPrompProps): React.JSX.Element => {
const { t } = useTranslation();
const currencyCode = currencies[order.currency.toString()];

View File

@ -19,7 +19,7 @@ interface FailureReasonProps {
failureReason: string;
}
const FailureReason = ({ failureReason }: FailureReasonProps): JSX.Element => {
const FailureReason = ({ failureReason }: FailureReasonProps): React.JSX.Element => {
const { t } = useTranslation();
const theme = useTheme();
@ -49,14 +49,14 @@ export const RoutingFailedPrompt = ({
lightning,
setLightning,
settings,
}: RoutingFailedPromptProps): JSX.Element => {
}: RoutingFailedPromptProps): React.JSX.Element => {
const { t } = useTranslation();
const countdownRenderer = function ({
minutes,
seconds,
completed,
}: CountdownRenderProps): JSX.Element {
}: CountdownRenderProps): React.JSX.Element {
if (completed) {
return (
<Grid container direction='column' alignItems='center' justifyContent='center' spacing={1}>

View File

@ -2,7 +2,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { Grid, Typography, CircularProgress } from '@mui/material';
export const SendingSatsPrompt = (): JSX.Element => {
export const SendingSatsPrompt = (): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -41,7 +41,7 @@ export const SuccessfulPrompt = ({
onClickStartAgain,
onClickRenew,
loadingRenew,
}: SuccessfulPromptProps): JSX.Element => {
}: SuccessfulPromptProps): React.JSX.Element => {
const { t } = useTranslation();
const currencyCode: string = currencies[`${order.currency}`];
const { settings } = useContext<UseAppStoreType>(AppContext);

View File

@ -2,7 +2,7 @@ import React from 'react';
import { useTranslation } from 'react-i18next';
import { Divider, List, ListItem, Typography } from '@mui/material';
export const TakerFoundPrompt = (): JSX.Element => {
export const TakerFoundPrompt = (): React.JSX.Element => {
const { t } = useTranslation();
return (

View File

@ -7,9 +7,9 @@ import stepXofY from '../stepXofY';
interface TakerFoundPrompProps {
order: Order | null;
text: string;
variables?: any;
variables?: object;
color?: string;
icon?: () => JSX.Element;
icon?: () => React.JSX.Element;
}
export const Title = ({
@ -20,7 +20,7 @@ export const Title = ({
icon = function () {
return <></>;
},
}: TakerFoundPrompProps): JSX.Element => {
}: TakerFoundPrompProps): React.JSX.Element => {
const { t } = useTranslation();
const theme = useTheme();

View File

@ -63,7 +63,7 @@ const TradeSummary = ({
takerSummary,
platformSummary,
orderId,
}: Props): JSX.Element => {
}: Props): React.JSX.Element => {
const { client } = useContext<UseAppStoreType>(AppContext);
const { t } = useTranslation();
const theme = useTheme();

View File

@ -5,7 +5,7 @@ import { Button, Link } from '@mui/material';
import { AccountBalanceWallet } from '@mui/icons-material';
import { NewTabIcon } from '../Icons';
const WalletsButton = (): JSX.Element => {
const WalletsButton = (): React.JSX.Element => {
const { t } = useTranslation();
return (
<Button

View File

@ -108,12 +108,12 @@ interface Contract {
title: string;
titleVariables: object;
titleColor: string;
prompt: () => JSX.Element;
prompt: () => React.JSX.Element;
bondStatus: 'hide' | 'locked' | 'unlocked' | 'settled';
titleIcon: () => JSX.Element;
titleIcon: () => React.JSX.Element;
}
const TradeBox = ({ currentOrder, onStartAgain }: TradeBoxProps): JSX.Element => {
const TradeBox = ({ currentOrder, onStartAgain }: TradeBoxProps): React.JSX.Element => {
const { garage, slotUpdatedAt } = useContext<UseGarageStoreType>(GarageContext);
const { settings } = useContext<UseAppStoreType>(AppContext);
const { federation } = useContext<UseFederationStoreType>(FederationContext);
@ -345,7 +345,7 @@ const TradeBox = ({ currentOrder, onStartAgain }: TradeBoxProps): JSX.Element =>
setOpen({ ...open, webln: true });
webln
.makeInvoice(() => lightning.amount)
.then((invoice: any) => {
.then((invoice: object) => {
if (invoice !== undefined) {
updateInvoice(invoice.paymentRequest);
setWaitingWebln(false);

View File

@ -191,7 +191,7 @@ export const initialAppContext: UseAppStoreType = {
export const AppContext = createContext<UseAppStoreType>(initialAppContext);
export const AppContextProvider = ({ children }: AppContextProviderProps): JSX.Element => {
export const AppContextProvider = ({ children }: AppContextProviderProps): React.JSX.Element => {
// State provided right at the top level of the app. A chaotic bucket of everything.
// Contains app-wide state and functions. Triggers re-renders on the full tree often.

View File

@ -34,7 +34,7 @@ export const FederationContext = createContext<UseFederationStoreType>(initialFe
export const FederationContextProvider = ({
children,
}: FederationContextProviderProps): JSX.Element => {
}: FederationContextProviderProps): React.JSX.Element => {
const { settings, page, origin, hostUrl, open, torStatus, client, fav } =
useContext<UseAppStoreType>(AppContext);
const { setMaker, garage } = useContext<UseGarageStoreType>(GarageContext);
@ -63,7 +63,7 @@ export const FederationContextProvider = ({
const addNewCoordinator: (alias: string, url: string) => void = (alias, url) => {
if (!federation.getCoordinator(alias)) {
const attributes: Record<any, any> = {
const attributes: object = {
longAlias: alias,
shortAlias: alias,
federated: false,

View File

@ -62,7 +62,9 @@ const statusToDelay = [
export const GarageContext = createContext<UseGarageStoreType>(initialGarageContext);
export const GarageContextProvider = ({ children }: GarageContextProviderProps): JSX.Element => {
export const GarageContextProvider = ({
children,
}: GarageContextProviderProps): React.JSX.Element => {
// All garage data structured
const { settings, torStatus, open, page, client } = useContext<UseAppStoreType>(AppContext);
const pageRef = useRef(page);

View File

@ -122,7 +122,7 @@ function calculateSizeLimit(inputDate: Date): number {
}
export class Coordinator {
constructor(value: any, origin: Origin, settings: Settings, hostUrl: string) {
constructor(value: object, origin: Origin, settings: Settings, hostUrl: string) {
const established = new Date(value.established);
this.longAlias = value.longAlias;
this.shortAlias = value.shortAlias;

View File

@ -43,7 +43,7 @@ export const updateExchangeInfo = (federation: Federation): ExchangeInfo => {
highestVersion = getHigherVer(highestVersion, coordinator.info.version);
active_robots_today = Math.max(active_robots_today, coordinator.info.active_robots_today);
aggregations.forEach((key: any) => {
aggregations.forEach((key: string) => {
info[key] = Number(info[key]) + Number(coordinator.info[key]);
});
}

View File

@ -19,7 +19,7 @@ type FederationHooks = 'onFederationUpdate';
export class Federation {
constructor(origin: Origin, settings: Settings, hostUrl: string) {
const coordinators = Object.entries(defaultFederation).reduce(
(acc: Record<string, Coordinator>, [key, value]: [string, any]) => {
(acc: Record<string, Coordinator>, [key, value]: [string, object]) => {
if (getHost() !== '127.0.0.1:8000' && key === 'local') {
// Do not add `Local Dev` unless it is running on localhost
return acc;
@ -121,7 +121,7 @@ export class Federation {
origin: Origin,
settings: Settings,
hostUrl: string,
attributes: Record<any, any>,
attributes: object,
): void => {
const value = {
...coordinatorDefaultValues,

View File

@ -56,10 +56,10 @@ class Garage {
const slotsDump: string = systemClient.getItem('garage_slots') ?? '';
if (slotsDump !== '') {
const rawSlots: Record<any, any> = JSON.parse(slotsDump);
Object.values(rawSlots).forEach((rawSlot: Record<any, any>) => {
const rawSlots: Record<string, object> = JSON.parse(slotsDump);
Object.values(rawSlots).forEach((rawSlot: object) => {
if (rawSlot?.token) {
const robotAttributes = Object.values(rawSlot.robots)[0] as Record<any, any>;
const robotAttributes = Object.values(rawSlot.robots)[0] as object;
this.slots[rawSlot.token] = new Slot(
rawSlot.token,
Object.keys(rawSlot.robots),

Some files were not shown because too many files have changed in this diff Show More