previewMessage: Hide the button once a message is sent (#1692)
Co-authored-by: V <vendicated@riseup.net>
This commit is contained in:
parent
0d18b44ba7
commit
faeb4fb585
@ -20,7 +20,7 @@ import { sendBotMessage } from "@api/Commands";
|
||||
import ErrorBoundary from "@components/ErrorBoundary";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { Button, ButtonLooks, ButtonWrapperClasses, DraftStore, DraftType, SelectedChannelStore, Tooltip, UserStore } from "@webpack/common";
|
||||
import { Button, ButtonLooks, ButtonWrapperClasses, DraftStore, DraftType, SelectedChannelStore, Tooltip, UserStore, useStateFromStores } from "@webpack/common";
|
||||
|
||||
interface Props {
|
||||
type: {
|
||||
@ -31,10 +31,9 @@ interface Props {
|
||||
const getDraft = (channelId: string) => DraftStore.getDraft(channelId, DraftType.ChannelMessage);
|
||||
|
||||
export function PreviewButton(chatBoxProps: Props) {
|
||||
if (chatBoxProps.type.analyticsName !== "normal") return null;
|
||||
const channelId = SelectedChannelStore.getChannelId();
|
||||
const draft = getDraft(channelId);
|
||||
|
||||
const draft = useStateFromStores([DraftStore], () => getDraft(channelId));
|
||||
if (chatBoxProps.type.analyticsName !== "normal") return null;
|
||||
if (!draft) return null;
|
||||
|
||||
return (
|
||||
|
Loading…
x
Reference in New Issue
Block a user