add change wait for

This commit is contained in:
Robert 2024-03-09 06:13:37 +07:00
parent 94a08efb22
commit f651e60e84
No known key found for this signature in database
GPG Key ID: F631C7FD957D5F22

View File

@ -5,6 +5,7 @@ import { useNavigate } from "@tanstack/react-router";
import { useState, useRef } from "react"; import { useState, useRef } from "react";
import humanizeDuration from "humanize-duration"; import humanizeDuration from "humanize-duration";
import { upsertChain } from "@/entities/chain/api/upsert"; import { upsertChain } from "@/entities/chain/api/upsert";
import { ChangeWaitForButton } from "@/features/change-wait-for";
import { ActionEditor } from "@/widgets/action-editor"; import { ActionEditor } from "@/widgets/action-editor";
import { RenameChainButton } from "@/features/rename-chain"; import { RenameChainButton } from "@/features/rename-chain";
@ -12,7 +13,6 @@ import { DeleteChainButton } from "@/features/delete-chain";
import { Typography, Button } from "@mui/material"; import { Typography, Button } from "@mui/material";
import Breadcrumbs from "@mui/material/Breadcrumbs"; import Breadcrumbs from "@mui/material/Breadcrumbs";
import SettingsIcon from "@mui/icons-material/Settings";
interface ChainEditorProps { interface ChainEditorProps {
chain: Chain; chain: Chain;
@ -96,14 +96,14 @@ export default function ChainEditor({ chain }: ChainEditorProps) {
<div <div
ref={actionsListRef} ref={actionsListRef}
className="no-scrollbar mt-8 flex grow flex-col items-center gap-y-24 overflow-y-scroll pb-20" className="no-scrollbar flex grow flex-col items-center gap-y-24 overflow-y-scroll pb-20 pt-8"
> >
{chain.actions.map((action, index) => { {chain.actions.map((action, index) => {
if (action.actionType === "comment") if (action.actionType === "comment")
return ( return (
<div <div
key={index} key={index}
className="relative w-[450px] select-none whitespace-pre-line rounded-md bg-white p-4 text-[#4C4E64DE] opacity-[84%] shadow-lg after:absolute after:left-1/2 after:top-20 after:h-8 after:w-1 after:-translate-x-1/2 after:rounded-md after:bg-[#666CFF] after:opacity-[12%]" className="relative w-[450px] select-none whitespace-pre-line rounded-md bg-white p-4 text-[#4C4E64DE] opacity-[84%] shadow-lg after:absolute after:-bottom-12 after:left-1/2 after:h-8 after:w-1 after:-translate-x-1/2 after:rounded-md after:bg-[#666CFF] after:opacity-[12%]"
> >
{action.text} {action.text}
</div> </div>
@ -115,13 +115,15 @@ export default function ChainEditor({ chain }: ChainEditorProps) {
className="relative flex select-none items-center gap-x-2 text-[#4C4E64DE] opacity-[84%] before:absolute before:-top-6 before:left-1/2 before:h-4 before:w-4 before:-translate-x-1/2 before:rounded-full before:border-[2.5px] before:border-primary after:absolute after:left-1/2 after:top-11 after:h-16 after:w-1 after:-translate-x-1/2 after:rounded-md after:bg-[#666CFF] after:opacity-[12%]" className="relative flex select-none items-center gap-x-2 text-[#4C4E64DE] opacity-[84%] before:absolute before:-top-6 before:left-1/2 before:h-4 before:w-4 before:-translate-x-1/2 before:rounded-full before:border-[2.5px] before:border-primary after:absolute after:left-1/2 after:top-11 after:h-16 after:w-1 after:-translate-x-1/2 after:rounded-md after:bg-[#666CFF] after:opacity-[12%]"
> >
<span> <span>
Ожидание:{" "} Задержка:{" "}
{humanizeDuration(action.waitFor * 1000, { language: "ru" })} {humanizeDuration(action.waitFor * 1000, { language: "ru" })}
</span> </span>
<button className="flex h-[20px] items-center justify-center rounded-sm bg-[#4C4E648A] bg-opacity-[54%] p-0"> <ChangeWaitForButton
<SettingsIcon sx={{ width: "20px", color: "white" }} /> chainId={chain._id!}
</button> actionIndex={index}
action={action}
/>
</div> </div>
); );
})} })}