Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve validator state display #256

Merged
merged 1 commit into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/renderer/auto-imports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export {}
declare global {
const IconMdiAnchor: typeof import('~icons/mdi/anchor.jsx')['default']
const IconMdiBookOpenOutline: typeof import('~icons/mdi/book-open-outline.jsx')['default']
const IconMdiBroadcastOff: typeof import('~icons/mdi/broadcast-off.jsx')['default']
const IconMdiCheck: typeof import('~icons/mdi/check.jsx')['default']
const IconMdiChevronDown: typeof import('~icons/mdi/chevron-down.jsx')['default']
const IconMdiCircle: typeof import('~icons/mdi/circle.jsx')['default']
Expand Down
4 changes: 1 addition & 3 deletions src/renderer/components/LogView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ function LogView() {

return (
<pre className="text-xs bg-surface-600 h-full p-2 whitespace-pre-wrap break-all overflow-auto">
{logs.length > 0
? logs.join('\n')
: 'Logs will appear here once transactions are processed.'}
{logs.length > 0 ? logs.join('\n') : ''}
</pre>
);
}
Expand Down
22 changes: 20 additions & 2 deletions src/renderer/components/ProgramChangeView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { useWallet } from '@solana/wallet-adapter-react';
import { useEffect, useState } from 'react';
import { Button } from 'react-bootstrap';
import { NavLink } from 'react-router-dom';
import { toast } from 'react-toastify';
import { css } from 'vite-plugin-inline-css-modules';
import {
Expand All @@ -26,6 +27,7 @@ import {
NetStatus,
selectValidatorNetworkState,
} from '../data/ValidatorNetwork/validatorNetworkState';
import { Net } from '../../types/types';
import { useAppDispatch, useAppSelector, useInterval } from '../hooks';
import Chip from './base/Chip';
import EditableText from './base/EditableText';
Expand Down Expand Up @@ -171,8 +173,24 @@ function ProgramChangeView() {
transform="translate(100 100)"
/>
</svg>
<IconMdiWarning className="text-6xl z-1" />
<span className="z-2">Network Not Available</span>
{status === NetStatus.Unknown ? (
<p>Loading...</p>
) : (
<IconMdiBroadcastOff className="text-6xl z-1" />
)}{' '}
{net === Net.Localhost && (
<div>
<span className="z-2 italic">Validator Not Available</span>
<div className="text-center">
Run one using the
<br />{' '}
<NavLink className="underline" to="/validator">
Validator page
</NavLink>
.
</div>
</div>
)}
</div>
</div>
);
Expand Down
9 changes: 8 additions & 1 deletion src/renderer/nav/Account.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import Split from 'react-split';
import {
NetStatus,
selectValidatorNetworkState,
} from '../data/ValidatorNetwork/validatorNetworkState';
import AccountView from '../components/AccountView';
import LogView from '../components/LogView';
import ProgramChangeView from '../components/ProgramChangeView';
Expand All @@ -7,6 +11,7 @@ import { useAppSelector } from '../hooks';

function Account() {
const accounts = useAppSelector(selectAccountsListState);
const validator = useAppSelector(selectValidatorNetworkState);
const { selectedAccount } = accounts;

return (
Expand All @@ -25,7 +30,9 @@ function Account() {
<ProgramChangeView />
<div className="overflow-auto">
<div className="flex-1 p-3">
<AccountView pubKey={selectedAccount} />
{validator.status === NetStatus.Running && (
<AccountView pubKey={selectedAccount} />
)}
</div>
</div>
</Split>
Expand Down