fix(ui): some uxt f

This commit is contained in:
nick-delirium 2023-12-11 10:54:41 +01:00
parent 67cc593ea7
commit a7684156fe
2 changed files with 20 additions and 6 deletions

View file

@ -1,11 +1,21 @@
import { UxTask } from "App/services/UxtestingService";
import React from 'react'
import { Button, Input, Switch, Typography } from 'antd'
import { UxTask } from 'App/services/UxtestingService';
import React from 'react';
import { Button, Input, Switch, Typography } from 'antd';
function StepsModal({ onAdd, onHide, editTask }: { onAdd: (step: UxTask) => void; onHide: () => void, editTask?: UxTask }) {
function StepsModal({
onAdd,
onHide,
editTask,
typingEnabled,
}: {
onAdd: (step: UxTask) => void;
onHide: () => void;
editTask?: UxTask;
typingEnabled?: boolean;
}) {
const [title, setTitle] = React.useState(editTask?.title ?? '');
const [description, setDescription] = React.useState(editTask?.description ?? '');
const [isAnswerEnabled, setIsAnswerEnabled] = React.useState(editTask?.allowTyping ?? false);
const [isAnswerEnabled, setIsAnswerEnabled] = React.useState(editTask?.allowTyping ?? typingEnabled);
const save = () => {
onAdd({
@ -15,6 +25,7 @@ function StepsModal({ onAdd, onHide, editTask }: { onAdd: (step: UxTask) => void
});
onHide();
};
return (
<div className={'h-screen p-4 bg-white flex flex-col gap-4'}>
<Typography.Title style={{ marginBottom: 0 }} level={4}>
@ -63,4 +74,4 @@ function StepsModal({ onAdd, onHide, editTask }: { onAdd: (step: UxTask) => void
);
}
export default StepsModal;
export default StepsModal;

View file

@ -36,6 +36,7 @@ function TestEdit() {
// @ts-ignore
const { siteId, testId } = useParams();
const [hasChanged, setHasChanged] = React.useState(testId === 'new');
const [typingEnabled, setTypingEnabled] = React.useState(false);
const { uxtestingStore } = useStore();
const [newTestTitle, setNewTestTitle] = React.useState('');
const [newTestDescription, setNewTestDescription] = React.useState('');
@ -328,9 +329,11 @@ function TestEdit() {
onClick={() =>
showModal(
<StepsModal
typingEnabled={typingEnabled}
onHide={hideModal}
onAdd={(task) => {
setHasChanged(true);
setTypingEnabled(task.allowTyping);
uxtestingStore.instance!.setProperty('tasks', [
...uxtestingStore.instance!.tasks,
task,