Skip to content

Commit

Permalink
update example bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
daoauth committed Dec 29, 2024
1 parent 1249dea commit f82c53b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
5 changes: 3 additions & 2 deletions packages/example/src/components/DragAndDrop.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { PTB_SCHEME } from '@zktx.io/ptb-builder';
import React, { useState } from 'react';

export const DragAndDrop = ({
onDrop,
onChancel,
}: {
onDrop: (data: object) => void;
onDrop: (data: PTB_SCHEME) => void;
onChancel: () => void;
}) => {
const [isVisible, setIsVisible] = useState(true);
Expand All @@ -26,7 +27,7 @@ export const DragAndDrop = ({
const json = JSON.parse(e.target?.result as string);
onDrop(json);
setIsVisible(false);
} catch (error) {
} catch {
setMessage('Invalid JSON file.');
}
};
Expand Down
11 changes: 6 additions & 5 deletions packages/example/src/pages/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ export const Editor = () => {
}
};

const handleDrop = (ptb: any) => {
setNetwork((ptb as any).network);
ctx.selectNetwork((ptb as any).network);
const handleDrop = (ptb: PTB_SCHEME) => {
setNetwork(ptb.network || NETWORK);
ctx.selectNetwork(ptb.network || NETWORK);
setPtb(JSON.stringify(ptb));
};

Expand All @@ -69,8 +69,9 @@ export const Editor = () => {
network={network}
excuteTx={excuteTx}
restore={ptb && JSON.parse(ptb)}
update={(value: PTB_SCHEME) => {
// console.log(value);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
update={(_value: PTB_SCHEME) => {
// console.log(_value);
}}
options={{
canEdit: true,
Expand Down
7 changes: 4 additions & 3 deletions packages/example/src/pages/viewer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useRef, useState } from 'react';

import { PTBBuilder } from '@zktx.io/ptb-builder';
import { PTB_SCHEME, PTBBuilder } from '@zktx.io/ptb-builder';
import { enqueueSnackbar } from 'notistack';
import queryString from 'query-string';
import { useLocation } from 'react-router-dom';
Expand Down Expand Up @@ -31,8 +31,9 @@ export const Viewer = () => {
canEdit: false,
themeSwitch: true,
}}
update={(value: any) => {
// console.log(value);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
update={(_value: PTB_SCHEME) => {
// console.log(_value);
}}
enqueueToast={(message, options) => enqueueSnackbar(message, options)}
/>
Expand Down

0 comments on commit f82c53b

Please sign in to comment.