Allow raw display of non-decodable inputs

This commit is contained in:
Willian Mitsuda 2021-11-08 14:53:23 -03:00
parent b9a9495c61
commit d905afd75d
3 changed files with 13 additions and 6 deletions

View File

@ -1,13 +1,20 @@
import React from "react"; import React from "react";
import { Tab } from "@headlessui/react"; import { Tab } from "@headlessui/react";
const ModeTab: React.FC = ({ children }) => ( type ModeTabProps = {
disabled?: boolean | undefined;
};
const ModeTab: React.FC<ModeTabProps> = ({ disabled, children }) => (
<Tab <Tab
className={({ selected }) => className={({ selected }) =>
`border rounded-lg px-2 py-1 bg-gray-100 hover:bg-gray-200 hover:shadow text-xs text-gray-500 hover:text-gray-600 ${ `border rounded-lg px-2 py-1 bg-gray-100 ${
selected ? "border-blue-300" : "" disabled
}` ? "text-gray-300"
: "hover:bg-gray-200 hover:shadow text-gray-500 hover:text-gray-600"
} text-xs ${selected ? "border-blue-300" : ""}`
} }
disabled={disabled}
> >
{children} {children}
</Tab> </Tab>

View File

@ -72,7 +72,7 @@ const TraceInput: React.FC<TraceInputProps> = ({
{(!hasParams || !expanded) && <>)</>} {(!hasParams || !expanded) && <>)</>}
</span> </span>
</div> </div>
{hasParams && expanded && fourBytesTxDesc && ( {hasParams && expanded && (
<> <>
<div className="ml-5 mr-1 my-2"> <div className="ml-5 mr-1 my-2">
<InputDecoder <InputDecoder

View File

@ -39,7 +39,7 @@ const InputDecoder: React.FC<InputDecoderProps> = ({
return ( return (
<Tab.Group> <Tab.Group>
<Tab.List className="flex space-x-1 mb-1"> <Tab.List className="flex space-x-1 mb-1">
<ModeTab>Decoded</ModeTab> <ModeTab disabled={!resolvedTxDesc}>Decoded</ModeTab>
<ModeTab>Raw</ModeTab> <ModeTab>Raw</ModeTab>
<ModeTab>UTF-8</ModeTab> <ModeTab>UTF-8</ModeTab>
</Tab.List> </Tab.List>