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">
<ActionEditor
actionIndex={actionToEdit ?? 0}
initialAction={
actionToEdit !== null
? (chain.actions?.[actionToEdit] as CommentAction)
@ -75,14 +76,16 @@ export default function ChainEditor({ chain }: ChainEditorProps) {
await upsertChain(chain);
navigate({ to: "/$namespace/$chainId" });
setTimeout(
() =>
actionsListRef.current?.scrollTo({
behavior: "smooth",
top: actionsListRef.current.scrollHeight,
}),
0,
);
if (addingNewAction) {
setTimeout(
() =>
actionsListRef.current?.scrollTo({
behavior: "smooth",
top: actionsListRef.current.scrollHeight,
}),
0,
);
}
}}
onClose={() => {
if (addingNewAction) setAddingNewAction(false);
@ -120,7 +123,9 @@ export default function ChainEditor({ chain }: ChainEditorProps) {
chain={chain}
action={action}
actionIndex={index}
onEdit={setActionToEdit}
onEdit={(actionIndex) => {
setActionToEdit(actionIndex);
}}
/>
))}