From 190b7a75af647cb23ce1839754eeeaee2146e7ce Mon Sep 17 00:00:00 2001 From: sevichecc <91365763+Sevichecc@users.noreply.github.com> Date: Sun, 16 Apr 2023 20:41:15 +0800 Subject: [PATCH] refactor: remove StatusContent component --- src/components/StatusContent.tsx | 27 --------------------------- src/simple-status.tsx | 12 ++++++++++-- 2 files changed, 10 insertions(+), 29 deletions(-) delete mode 100644 src/components/StatusContent.tsx diff --git a/src/components/StatusContent.tsx b/src/components/StatusContent.tsx deleted file mode 100644 index af8984f..0000000 --- a/src/components/StatusContent.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { useState } from "react"; -import { Form } from "@raycast/api"; - -interface statusProps { - isMarkdown: boolean; - draftStatus: string | undefined; -} - -const StatusContent = ({ isMarkdown, draftStatus }: statusProps) => { - const [statusContent, setStatusContent] = useState(draftStatus || ""); - - return ( - <> - - - ); -}; - -export default StatusContent; diff --git a/src/simple-status.tsx b/src/simple-status.tsx index 214d4a6..cf2aaf4 100644 --- a/src/simple-status.tsx +++ b/src/simple-status.tsx @@ -17,7 +17,6 @@ import { AkkomaError, StatusResponse, Preference, Status } from "./types"; import { authorize } from "./oauth"; import VisibilityDropdown from "./components/VisibilityDropdown"; -import StatusContent from "./components/StatusContent"; const cache = new Cache(); @@ -51,6 +50,7 @@ export default function SimpleCommand(props: CommandProps) { sensitive: false, openActionText: "Open the last published status", fqn: "", + content: draftValues?.status || "", }); const cached = cache.get("latest_published_status"); @@ -143,7 +143,15 @@ export default function SimpleCommand(props: CommandProps) { ref={cwRef} /> )} - + setState((prevState) => ({ ...prevState, content: value }))} + /> {!props.children && } {props.children}