Skip to content

Commit

Permalink
fix: add openrpc check circle and tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejonas committed Mar 6, 2020
1 parent a4f4605 commit 3138fd0
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/containers/Inspector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import JSONRPCRequestEditor from "./JSONRPCRequestEditor";
import PlayCircle from "@material-ui/icons/PlayCircleFilled";
import CloseIcon from "@material-ui/icons/Close";
import PlusIcon from "@material-ui/icons/Add";
import { IconButton, AppBar, Toolbar, Typography, Button, InputBase, Tab, Tabs } from "@material-ui/core";
import CheckCircle from "@material-ui/icons/CheckCircle";
import { IconButton, AppBar, Toolbar, Typography, Button, InputBase, Tab, Tabs, Tooltip } from "@material-ui/core";
import { Client, RequestManager, HTTPTransport, WebSocketTransport } from "@open-rpc/client-js";
import Brightness3Icon from "@material-ui/icons/Brightness3";
import WbSunnyIcon from "@material-ui/icons/WbSunny";
Expand All @@ -13,6 +14,7 @@ import { MethodObject } from "@open-rpc/meta-schema";
import MonacoEditor from "@etclabscore/react-monaco-editor";
import useTabs from "../hooks/useTabs";
import { useDebounce } from "use-debounce";
import { green } from "@material-ui/core/colors";

const errorToJSON = (error: JSONRPCError | undefined): any => {
if (!error) {
Expand Down Expand Up @@ -190,7 +192,7 @@ const Inspector: React.FC<IProps> = (props) => {

useEffect(() => {
refreshOpenRpcDocument();
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [debouncedUrl]);

useEffect(() => {
Expand All @@ -200,7 +202,7 @@ const Inspector: React.FC<IProps> = (props) => {
setOpenRpcDocument(tabs[tabIndex].openrpcDocument);
setResults(tabs[tabIndex].results);
}
// eslint-disable-next-line react-hooks/exhaustive-deps
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [tabIndex]);

const handleTabIndexChange = (event: React.ChangeEvent<{}>, newValue: number) => {
Expand Down Expand Up @@ -267,6 +269,18 @@ const Inspector: React.FC<IProps> = (props) => {
<PlayCircle />
</IconButton>
<InputBase
startAdornment={openrpcDocument
?
<Tooltip title={
<div style={{textAlign: "center"}}>
<Typography>Valid OpenRPC Endpoint.</Typography>
<Typography variant="caption">The JSON-RPC endpoint responds to the rpc.discover method. This adds features like auto completion to the inspector.</Typography>
</div>
} onClick={() => window.open("https://spec.open-rpc.org/#service-discovery-method")}>
<CheckCircle style={{ color: green[500], marginRight: "5px", cursor: "pointer" }} scale={0.1} />
</Tooltip>
: null
}
value={url}
placeholder="Enter a JSON-RPC server URL"
onChange={
Expand Down

0 comments on commit 3138fd0

Please sign in to comment.