Skip to content

Commit

Permalink
feat: block page advanced (#98)
Browse files Browse the repository at this point in the history
Co-authored-by: Luiz Estácio | stacio.eth <luizstacio@gmail.com>
  • Loading branch information
matt-user and luizstacio authored Nov 7, 2023
1 parent 85e5805 commit bfc0c16
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
18 changes: 18 additions & 0 deletions packages/app/src/systems/Block/components/BlockScreenAdvanced.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { Maybe, BlockItemFragment } from '@fuel-explorer/graphql';
import { VStack } from '@fuels/ui';
import { CodeBlock } from '~/systems/Core/components/CodeBlock/CodeBlock';

type BlockScreenAdvancedProps = {
block?: Maybe<BlockItemFragment & { producer: Maybe<string> }>;
};

export function BlockScreenAdvanced({ block }: BlockScreenAdvancedProps) {
if (!block) {
return null;
}
return (
<VStack gap="6">
<CodeBlock value={block} type="json" />
</VStack>
);
}
5 changes: 4 additions & 1 deletion packages/app/src/systems/Block/screens/BlockScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from '~/systems/Core/components/ViewMode/ViewMode';
import { isValidAddress } from '~/systems/Core/utils/address';

import { BlockScreenAdvanced } from '../components/BlockScreenAdvanced';
import { BlockScreenSimple } from '../components/BlockScreenSimple';

type BlockScreenProps = {
Expand Down Expand Up @@ -44,7 +45,9 @@ export function BlockScreen({
{viewMode === ViewModes.Simple && (
<BlockScreenSimple block={block} producer={producer} />
)}
{viewMode === ViewModes.Advanced && <div>Advanced</div>}
{viewMode === ViewModes.Advanced && (
<BlockScreenAdvanced block={block ? { ...block, producer } : null} />
)}
</VStack>
);
}

0 comments on commit bfc0c16

Please sign in to comment.