Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade the version of aelf-smartcontract-viewer #67

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions components/contract-viewer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"use client";

import { useEffect, useState } from "react";
import { useSearchParams } from "react-router-dom";
import { useWallet } from "@/data/wallet";
import { ContractView } from "aelf-smartcontract-viewer";
Expand All @@ -13,21 +12,13 @@ const ContractViewer = ({ name }: { name: string }) => {
const wallet = useWallet();
const { resolvedTheme } = useTheme();
const contractViewerAddress = searchParams.get("contract-viewer-address");
const [key, setKey] = useState("0");

useEffect(() => {
setTimeout(() => {
setKey(prev => parseInt(prev) + 1 + "");
}, 1000);
}, [contractViewerAddress]);

if (!contractViewerAddress || !wallet?.wallet) {
return;
}

return (
<ContractView
key={key}
wallet={wallet.wallet}
address={contractViewerAddress}
headerTitle={"Contract View"}
Expand Down
1 change: 1 addition & 0 deletions components/left-side.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const LeftSide = ({ name }: { name: string }) => {
bottom={<ContractViewer name={name} />}
topDefaultSize={30}
bottomDefaultSize={70}
bottomClassName="contract-viewer-container"
/>
) : (
<TopSections />
Expand Down
8 changes: 6 additions & 2 deletions components/top-bottom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,27 @@ export default function TopBottom({
bottom,
topDefaultSize = 70,
bottomDefaultSize = 30,
topClassName = "",
bottomClassName = "",
}: {
top: ReactNode;
bottom: ReactNode;
topDefaultSize?: number;
bottomDefaultSize?: number;
topClassName?: string;
bottomClassName?: string
}) {
return (
<div className="h-[calc(100vh-40px)]">
<ResizablePanelGroup direction="vertical">
<ResizablePanel
defaultSize={topDefaultSize}
className="overflow-y-auto"
className={`overflow-y-auto ${topClassName}`}
>
{top}
</ResizablePanel>
<ResizableHandle />
<ResizablePanel defaultSize={bottomDefaultSize}>
<ResizablePanel defaultSize={bottomDefaultSize} className={bottomClassName}>
{bottom}
</ResizablePanel>
</ResizablePanelGroup>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@xterm/addon-fit": "^0.10.0",
"@xterm/xterm": "^5.5.0",
"aelf-sdk": "^3.4.15",
"aelf-smartcontract-viewer": "^1.0.6",
"aelf-smartcontract-viewer": "^1.1.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"cmdk": "^1.0.0",
Expand Down
3 changes: 3 additions & 0 deletions src/routes/workspace.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.contract-viewer-container {
overflow-y: auto !important;
}
1 change: 1 addition & 0 deletions src/routes/workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
import Cli from "@/components/workspace/cli";
import LeftSide from "@/components/left-side";
import { Outlet, useParams } from "react-router-dom";
import './workspace.scss';

export function Component() {
let { id } = useParams();
Expand Down