mirror of
https://github.com/Sevichecc/raycast-akkoma-extension.git
synced 2025-04-30 14:49:29 +08:00
refactor: remove StatusContent component
This commit is contained in:
parent
46451ac343
commit
190b7a75af
2 changed files with 10 additions and 29 deletions
|
@ -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<string>(draftStatus || "");
|
||||
|
||||
return (
|
||||
<>
|
||||
<Form.TextArea
|
||||
id="status"
|
||||
title="Content"
|
||||
placeholder={`Write something down ${isMarkdown ? "with Markdown" : ""}`}
|
||||
enableMarkdown={isMarkdown}
|
||||
autoFocus={true}
|
||||
value={statusContent}
|
||||
onChange={setStatusContent}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default StatusContent;
|
|
@ -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}
|
||||
/>
|
||||
)}
|
||||
<StatusContent isMarkdown={state.isMarkdown} draftStatus={draftValues?.status} />
|
||||
<Form.TextArea
|
||||
id="status"
|
||||
title="Content"
|
||||
placeholder={`Write something down ${state.isMarkdown ? "with Markdown" : ""}`}
|
||||
enableMarkdown={state.isMarkdown}
|
||||
autoFocus={true}
|
||||
value={state.content}
|
||||
onChange={(value) => setState((prevState) => ({ ...prevState, content: value }))}
|
||||
/>
|
||||
{!props.children && <VisibilityDropdown />}
|
||||
{props.children}
|
||||
<Form.Checkbox
|
||||
|
|
Loading…
Reference in a new issue