Skip to content

Commit 3138fd0

Browse files
committed
fix: add openrpc check circle and tooltip
1 parent a4f4605 commit 3138fd0

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/containers/Inspector.tsx

+17-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import JSONRPCRequestEditor from "./JSONRPCRequestEditor";
44
import PlayCircle from "@material-ui/icons/PlayCircleFilled";
55
import CloseIcon from "@material-ui/icons/Close";
66
import PlusIcon from "@material-ui/icons/Add";
7-
import { IconButton, AppBar, Toolbar, Typography, Button, InputBase, Tab, Tabs } from "@material-ui/core";
7+
import CheckCircle from "@material-ui/icons/CheckCircle";
8+
import { IconButton, AppBar, Toolbar, Typography, Button, InputBase, Tab, Tabs, Tooltip } from "@material-ui/core";
89
import { Client, RequestManager, HTTPTransport, WebSocketTransport } from "@open-rpc/client-js";
910
import Brightness3Icon from "@material-ui/icons/Brightness3";
1011
import WbSunnyIcon from "@material-ui/icons/WbSunny";
@@ -13,6 +14,7 @@ import { MethodObject } from "@open-rpc/meta-schema";
1314
import MonacoEditor from "@etclabscore/react-monaco-editor";
1415
import useTabs from "../hooks/useTabs";
1516
import { useDebounce } from "use-debounce";
17+
import { green } from "@material-ui/core/colors";
1618

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

191193
useEffect(() => {
192194
refreshOpenRpcDocument();
193-
// eslint-disable-next-line react-hooks/exhaustive-deps
195+
// eslint-disable-next-line react-hooks/exhaustive-deps
194196
}, [debouncedUrl]);
195197

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

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

0 commit comments

Comments
 (0)