Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
Fix a bunch of ESlint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
binarybaron committed Dec 14, 2023
1 parent f94ca18 commit 4da0828
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 30 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
'react/jsx-no-bind': 'off',
'promise/param-names': 'off',
'no-async-promise-executor': 'off',
'import/prefer-default-export': 'off',
'import/no-restricted-paths': [
'error',
{
Expand Down
3 changes: 2 additions & 1 deletion src/main/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import spawnListSellersCommand from './cli/commands/listSellersCommand';
import { getCliLogFile } from './cli/dirs';
import { spawnTor, stopTor } from './tor';
import logger from '../utils/logger';
import { mainWindow } from './main';
import { getMainWindow } from './main';

Check failure on line 11 in src/main/ipc.ts

View workflow job for this annotation

GitHub Actions / release (ubuntu-latest)

Dependency cycle detected

export default function registerIpcHandlers() {
ipcMain.handle('stop-cli', stopCli);
Expand Down Expand Up @@ -53,6 +53,7 @@ export function sendSnackbarAlertToRenderer(
{ message, variant, autoHideDuration, key },
'Attempting to send snackbar alert to renderer'
);
const mainWindow = getMainWindow();
if (mainWindow) {
if (
mainWindow.webContents.isDestroyed() ||
Expand Down
6 changes: 5 additions & 1 deletion src/main/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@ import initAutoUpdater from './updater';
import initStats from './stats';

Check failure on line 27 in src/main/main.ts

View workflow job for this annotation

GitHub Actions / release (ubuntu-latest)

Dependency cycle via ./socket:6=>./ipc:5
import registerIpcHandlers from './ipc';

Check failure on line 28 in src/main/main.ts

View workflow job for this annotation

GitHub Actions / release (ubuntu-latest)

Dependency cycle detected

export let mainWindow: BrowserWindow | null = null;
let mainWindow: BrowserWindow | null = null;

export function getMainWindow() {
return mainWindow;
}

async function installExtensions() {
const installer = require('electron-devtools-installer');
Expand Down
6 changes: 6 additions & 0 deletions src/renderer/components/IpcInvokeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,9 @@ export default function IpcInvokeButton({
/>
);
}

IpcInvokeButton.defaultProps = {
isLoadingOverride: false,
isIconButton: false,
loadIcon: null,
};
38 changes: 19 additions & 19 deletions src/renderer/components/pages/swap/SwapWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,31 +195,31 @@ function HasNoProvidersSwapWidget() {
const classes = useStyles();

const alertBox = isPublicRegistryDown ? (
<Alert severity="info">
<Box className={classes.noProvidersAlertOuter}>
<Typography>
Currently, the public registry of providers seems to be unreachable.
Here's what you can do:
<ul>
<li>
Try discovering a provider by connecting to a rendezvous point
</li>
<li>
Try again later when the public registry may be reachable again
</li>
</ul>
</Typography>
<Box>
<ListSellersDialogOpenButton />
</Box>
<Alert severity="info">
<Box className={classes.noProvidersAlertOuter}>
<Typography>
Currently, the public registry of providers seems to be unreachable.
Here&apos;s what you can do:
<ul>
<li>
Try discovering a provider by connecting to a rendezvous point
</li>
<li>
Try again later when the public registry may be reachable again
</li>
</ul>
</Typography>
<Box>
<ListSellersDialogOpenButton />
</Box>
</Alert>
</Box>
</Alert>
) : (
<Alert severity="info">
<Box className={classes.noProvidersAlertOuter}>
<Typography>
Currently, there are no providers (trading partners) available in the
official registry. Here's what you can do:
official registry. Here&apos;s what you can do:
<ul>
<li>
Try discovering a provider by connecting to a rendezvous point
Expand Down
21 changes: 12 additions & 9 deletions src/renderer/components/snackbar/GlobalSnackbarProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
MaterialDesignContent,
SnackbarKey,
SnackbarProvider,
useSnackbar,
} from 'notistack';
Expand All @@ -15,22 +16,24 @@ const StyledMaterialDesignContent = styled(MaterialDesignContent)(() => ({
},
}));

function CloseSnackbarButton({ snackbarId }: { snackbarId: SnackbarKey }) {
const { closeSnackbar } = useSnackbar();

return (
<IconButton onClick={() => closeSnackbar(snackbarId)}>
<Close />
</IconButton>
);
}

export default function GlobalSnackbarManager({
children,
}: {
children: ReactNode;
}) {
return (
<SnackbarProvider
action={(snackbarId) => {
const { closeSnackbar } = useSnackbar();

return (
<IconButton onClick={() => closeSnackbar(snackbarId)}>
<Close />
</IconButton>
);
}}
action={(snackbarId) => <CloseSnackbarButton snackbarId={snackbarId} />}
Components={{
success: StyledMaterialDesignContent,
error: StyledMaterialDesignContent,
Expand Down

0 comments on commit 4da0828

Please sign in to comment.