Skip to content
Snippets Groups Projects
Commit b73dff19 authored by Lukas's avatar Lukas
Browse files

Add include virtual operations toggle to block details section

parent b09074a1
No related branches found
No related tags found
2 merge requests!481bring recent develop changes to mater to match the backend,!463Lbudginas/#340 add virtual ops block and transaction pages
Pipeline #109244 failed
...@@ -13,6 +13,8 @@ interface BlockDetailsProps { ...@@ -13,6 +13,8 @@ interface BlockDetailsProps {
virtualOperationLength: number; virtualOperationLength: number;
nonVirtualOperationLength: number; nonVirtualOperationLength: number;
blockDetails?: Hive.BlockDetails; blockDetails?: Hive.BlockDetails;
enableRawVirtualOperations: boolean;
handleEnableVirtualOperations: () => void;
} }
const BlockDetails: React.FC<BlockDetailsProps> = ({ const BlockDetails: React.FC<BlockDetailsProps> = ({
...@@ -21,6 +23,8 @@ const BlockDetails: React.FC<BlockDetailsProps> = ({ ...@@ -21,6 +23,8 @@ const BlockDetails: React.FC<BlockDetailsProps> = ({
blockDetails, blockDetails,
virtualOperationLength, virtualOperationLength,
nonVirtualOperationLength, nonVirtualOperationLength,
enableRawVirtualOperations,
handleEnableVirtualOperations,
}) => { }) => {
return ( return (
<Card <Card
...@@ -85,6 +89,8 @@ const BlockDetails: React.FC<BlockDetailsProps> = ({ ...@@ -85,6 +89,8 @@ const BlockDetails: React.FC<BlockDetailsProps> = ({
nonVirtualOperationLength={nonVirtualOperationLength} nonVirtualOperationLength={nonVirtualOperationLength}
virtualOperationsTypesCounters={virtualOperationsTypesCounters} virtualOperationsTypesCounters={virtualOperationsTypesCounters}
nonVirtualOperationsTypesCounters={nonVirtualOperationsTypesCounters} nonVirtualOperationsTypesCounters={nonVirtualOperationsTypesCounters}
enableRawVirtualOperations={enableRawVirtualOperations}
handleEnableVirtualOperations={handleEnableVirtualOperations}
/> />
</CardContent> </CardContent>
</Card> </Card>
......
import Explorer from "@/types/Explorer"; import Explorer from "@/types/Explorer";
import { getOperationTypeForDisplay } from "@/utils/UI"; import { getOperationTypeForDisplay } from "@/utils/UI";
import { getOperationColor } from "../OperationsTable"; import { getOperationColor } from "../OperationsTable";
import { Toggle } from "../ui/toggle";
import { useUserSettingsContext } from "@/contexts/UserSettingsContext";
interface BlockPageOperationCountProps { interface BlockPageOperationCountProps {
virtualOperationsTypesCounters?: Explorer.OperationCounter[]; virtualOperationsTypesCounters?: Explorer.OperationCounter[];
nonVirtualOperationsTypesCounters?: Explorer.OperationCounter[]; nonVirtualOperationsTypesCounters?: Explorer.OperationCounter[];
virtualOperationLength: number; virtualOperationLength: number;
nonVirtualOperationLength: number; nonVirtualOperationLength: number;
enableRawVirtualOperations: boolean;
handleEnableVirtualOperations: () => void;
} }
const BlockPageOperationCount: React.FC<BlockPageOperationCountProps> = ({ const BlockPageOperationCount: React.FC<BlockPageOperationCountProps> = ({
...@@ -14,7 +18,12 @@ const BlockPageOperationCount: React.FC<BlockPageOperationCountProps> = ({ ...@@ -14,7 +18,12 @@ const BlockPageOperationCount: React.FC<BlockPageOperationCountProps> = ({
nonVirtualOperationLength, nonVirtualOperationLength,
virtualOperationsTypesCounters, virtualOperationsTypesCounters,
nonVirtualOperationsTypesCounters, nonVirtualOperationsTypesCounters,
enableRawVirtualOperations,
handleEnableVirtualOperations,
}) => { }) => {
const { settings } = useUserSettingsContext();
const isRawView = settings.rawJsonView || settings.prettyJsonView;
return ( return (
<section className="w-full flex flex-col items-center text-md px-4 mb-2 md:mb-4"> <section className="w-full flex flex-col items-center text-md px-4 mb-2 md:mb-4">
<div className="w-full py-4"> <div className="w-full py-4">
...@@ -44,6 +53,16 @@ const BlockPageOperationCount: React.FC<BlockPageOperationCountProps> = ({ ...@@ -44,6 +53,16 @@ const BlockPageOperationCount: React.FC<BlockPageOperationCountProps> = ({
</div> </div>
<div className="my-5 flex justify-center"> <div className="my-5 flex justify-center">
Virtual operations: {virtualOperationLength} Virtual operations: {virtualOperationLength}
{isRawView && (
<div className="flex justify-center items-center">
<span className="ml-2">
<Toggle
checked={enableRawVirtualOperations}
onClick={handleEnableVirtualOperations}
/>
</span>
</div>
)}
</div> </div>
<div className="flex flex-wrap justify-center text-sm"> <div className="flex flex-wrap justify-center text-sm">
{virtualOperationsTypesCounters && {virtualOperationsTypesCounters &&
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment