This commit is contained in:
Robert 2024-03-13 01:11:49 +07:00
parent 02078fcaa2
commit 49332e4e68
No known key found for this signature in database
GPG Key ID: F631C7FD957D5F22

View File

@ -58,6 +58,7 @@ export default function ChainEditor({ chain }: ChainEditorProps) {
<div className="flex grow flex-col items-center justify-center"> <div className="flex grow flex-col items-center justify-center">
<ActionEditor <ActionEditor
actionIndex={actionToEdit ?? 0}
initialAction={ initialAction={
actionToEdit !== null actionToEdit !== null
? (chain.actions?.[actionToEdit] as CommentAction) ? (chain.actions?.[actionToEdit] as CommentAction)
@ -75,6 +76,7 @@ export default function ChainEditor({ chain }: ChainEditorProps) {
await upsertChain(chain); await upsertChain(chain);
navigate({ to: "/$namespace/$chainId" }); navigate({ to: "/$namespace/$chainId" });
if (addingNewAction) {
setTimeout( setTimeout(
() => () =>
actionsListRef.current?.scrollTo({ actionsListRef.current?.scrollTo({
@ -83,6 +85,7 @@ export default function ChainEditor({ chain }: ChainEditorProps) {
}), }),
0, 0,
); );
}
}} }}
onClose={() => { onClose={() => {
if (addingNewAction) setAddingNewAction(false); if (addingNewAction) setAddingNewAction(false);
@ -120,7 +123,9 @@ export default function ChainEditor({ chain }: ChainEditorProps) {
chain={chain} chain={chain}
action={action} action={action}
actionIndex={index} actionIndex={index}
onEdit={setActionToEdit} onEdit={(actionIndex) => {
setActionToEdit(actionIndex);
}}
/> />
))} ))}