Skip to content

Commit

Permalink
feature: add checklist modal
Browse files Browse the repository at this point in the history
  • Loading branch information
maparr committed Sep 27, 2023
1 parent 95e066f commit e403e3f
Show file tree
Hide file tree
Showing 6 changed files with 130 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/components/NetworkStatus/NetworkStatus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const NetworkStatus = ({
isRestarting
? 'Restarting node...'
: isShowMissingLibsMessage
? 'Please install libs and restart node'
? 'Please install required libraries and restart node'
: 'Please restart node'
}
</ProgressLabel>
Expand Down
4 changes: 4 additions & 0 deletions app/redux/ui/reducer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { UiState, CustomAction } from '../../types';
import { isDarkBackground } from '../../theme';
import { IPC_BATCH_SYNC, reduceChunkUpdate } from '../ipcBatchSync';
import {
SET_OS_THEME,
// THEME_SWITCHER,
Expand All @@ -18,6 +19,7 @@ const initialState: UiState = {
skinId: null,
error: null,
warnings: [],
osPlatform: '',
};

const reducer = (state: UiState = initialState, action: CustomAction) => {
Expand Down Expand Up @@ -52,6 +54,8 @@ const reducer = (state: UiState = initialState, action: CustomAction) => {
};
case SHOW_CLOSING_APP_MODAL:
return { ...state, isClosingApp: true };
case IPC_BATCH_SYNC:
return reduceChunkUpdate('ui', action.payload, state);
default:
return state;
}
Expand Down
116 changes: 116 additions & 0 deletions app/screens/modal/ErrorCheckListModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
import React from 'react';
import styled from 'styled-components';
import { useSelector } from 'react-redux';
import { ExternalLinks } from '../../../shared/constants';
import { eventsService } from '../../infra/eventsService';
import Modal from '../../components/common/Modal';
import { Button, Link } from '../../basicComponents';
import {
isWindows as isWindowsSelector,
isLinux as isLinuxSelector,
isMacOS as isMacOSSelector,
} from '../../redux/ui/selectors';

const ListContainer = styled.ol`
padding: 20px;
list-style: decimal;
li {
padding: 5px 0;
line-height: 21px;
}
`;

const ModalFooterContainer = styled.div`
display: flex;
justify-content: flex-end;
margin: 10px;
`;

const ErrorCheckListModal = ({ onClose }: { onClose: () => void }) => {
const isWindows = useSelector(isWindowsSelector);
const isLinux = useSelector(isLinuxSelector);
const isMacOS = useSelector(isMacOSSelector);
const openDiscord = () => window.open(ExternalLinks.Discord);
const openSmappIssuePage = () =>
window.open(ExternalLinks.GithubSMAppIssuePage);

const navigateToOpenWindowsCLInstallationGuide = () =>
window.open(ExternalLinks.OpenCLWindowsInstallGuide);
const navigateToOpenUbuntuCLInstallationGuide = () =>
window.open(ExternalLinks.OpenCLUbuntuInstallGuide);
const navigateToRedistInstallationGuide = () =>
window.open(ExternalLinks.RedistWindowsInstallOfficialSite);
const openLogFile = () => {
eventsService.showFileInFolder({ isLogFile: true });
};
return (
<Modal header="NODE ERROR CHECKLIST" width={650} height={450}>
<ListContainer>
{!isMacOS && (
<li>
Please ensure that you have installed:{' '}
{isLinux && (
<Link
onClick={navigateToOpenUbuntuCLInstallationGuide}
text="OPEN CL"
style={{ display: 'inline-block' }}
/>
)}
{isWindows && (
<>
<Link
onClick={navigateToOpenWindowsCLInstallationGuide}
text="OPEN CL"
style={{ display: 'inline-block' }}
/>{' '}
and{' '}
<Link
onClick={navigateToRedistInstallationGuide}
text="REDIST PACKAGE"
style={{ display: 'inline-block' }}
/>
</>
)}
</li>
)}
<li>
Check your firewall settings and ensure that your ports are open.
</li>
<li>Update your GPU drivers.</li>
<li>
Please check for ERROR and FATAL messages and investigate them on your
end{' '}
<Link
onClick={openLogFile}
text="BROWSE LOG FILE."
style={{ display: 'inline-block' }}
/>
</li>
</ListContainer>
<p>
If none of these solutions have worked, please do not hesitate to report
the error or seek help on{' '}
<Link
onClick={openDiscord}
text="DISCORD."
style={{ display: 'inline-block' }}
/>
</p>
<p>
Alternatively, you can submit your logs on GitHub if you have an account
there{' '}
<Link
onClick={openSmappIssuePage}
text="OPEN ISSUE."
style={{ display: 'inline-block' }}
/>
</p>
<ModalFooterContainer>
<Button onClick={onClose} text="CLOSE" />
</ModalFooterContainer>
</Modal>
);
};

export default ErrorCheckListModal;
5 changes: 4 additions & 1 deletion desktop/main/reactions/syncToRenderer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os from 'os';
import { BrowserWindow } from 'electron';
import * as R from 'ramda';
import {
Expand All @@ -10,6 +11,7 @@ import {
map,
merge,
Observable,
of,
scan,
shareReplay,
skipUntil,
Expand Down Expand Up @@ -217,6 +219,7 @@ export default (
})
),
$rootHash.pipe(map((rootHash) => ({ network: { rootHash } }))),
$currentLayer.pipe(map((currentLayer) => ({ network: { currentLayer } })))
$currentLayer.pipe(map((currentLayer) => ({ network: { currentLayer } }))),
of({ ui: { osPlatform: os.platform() } })
);
};
7 changes: 4 additions & 3 deletions shared/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@ export enum ExternalLinks {
RestoreMnemoGuide = 'https://testnet.spacemesh.io/#/backup?id=restoring-from-a-12-words-list',
Help = 'https://testnet.spacemesh.io/#/help',
DiscordTapAccount = 'https://discord.gg/ASpy52C',
redistWindowsInstallOfficialSite = 'https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2015-2017-2019-and-2022',
openCLWindowsInstallGuide = 'https://sasview.org/docs/old_docs/4.1.2/user/opencl_installation.html',
goSpacemeshNodeGuide = 'https://github.com/spacemeshos/go-spacemesh',
RedistWindowsInstallOfficialSite = 'https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170#visual-studio-2015-2017-2019-and-2022',
OpenCLWindowsInstallGuide = 'https://sasview.org/docs/old_docs/4.1.2/user/opencl_installation.html',
OpenCLUbuntuInstallGuide = 'https://saturncloud.io/blog/how-to-install-cudaopencl-on-ubuntu-installed-on-a-usb-drive/#installing-opencl',
GithubSMAppIssuePage = 'https://github.com/spacemeshos/smapp/issues/new?assignees=&labels=&projects=&template=bug_report.md&title=',
}

export const BITS_PER_LABEL = 128;
2 changes: 1 addition & 1 deletion shared/types/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export enum NodeErrorType {
NOT_SPECIFIED = 0,
OPEN_CL_NOT_INSTALLED,
REDIST_NOT_INSTALLED,
API_NOT_RESPONDING = 4,
API_NOT_RESPONDING,
SPAWN,
LOG_SYSERROR,
LOG_FATAL,
Expand Down

0 comments on commit e403e3f

Please sign in to comment.