This commit is contained in:
Robert 2024-03-13 01:15:56 +07:00
parent 583f2d9e02
commit 56acc53561
No known key found for this signature in database
GPG Key ID: F631C7FD957D5F22

View File

@ -58,13 +58,16 @@ export default function ActionEditor({
onClose, onClose,
canExit = false, canExit = false,
}: ActionEditorProps) { }: ActionEditorProps) {
const [value, setValue] = useState(0);
const [loading, setLoading] = useState(false);
const attachmentType = initialAction const attachmentType = initialAction
? getActionAttachmentType(initialAction) ? getActionAttachmentType(initialAction)
: "empty"; : "empty";
const [value, setValue] = useState(
attachmentType === "empty" ? 0 : attachmentType === "image" ? 1 : 2,
);
const [loading, setLoading] = useState(false);
const [imageUrl, setImageUrl] = useState<string | null>( const [imageUrl, setImageUrl] = useState<string | null>(
initialAction && attachmentType === "image" initialAction && attachmentType === "image"
? initialAction.fileUrls[0]! ? initialAction.fileUrls[0]!
@ -193,7 +196,7 @@ export default function ActionEditor({
multiline multiline
minRows={8} minRows={8}
maxRows={8} maxRows={8}
value={action.text} value={action.text ?? ""}
onChange={(event) => onChange={(event) =>
setAction((currentAction) => ({ setAction((currentAction) => ({
...currentAction, ...currentAction,