diff --git a/src/api/ChatButtons.tsx b/src/api/ChatButtons.tsx
index 52052a528..c2a1a1982 100644
--- a/src/api/ChatButtons.tsx
+++ b/src/api/ChatButtons.tsx
@@ -79,7 +79,7 @@ export interface ChatBarProps {
};
}
-export type ChatBarButtonFactory = (props: ChatBarProps & { isMainChat: boolean; }) => JSX.Element | null;
+export type ChatBarButtonFactory = (props: ChatBarProps & { isMainChat: boolean; isAnyChat: boolean; }) => JSX.Element | null;
export type ChatBarButtonData = {
render: ChatBarButtonFactory;
/**
@@ -98,13 +98,14 @@ const logger = new Logger("ChatButtons");
function VencordChatBarButtons(props: ChatBarProps) {
const { chatBarButtons } = useSettings(["uiElements.chatBarButtons.*"]).uiElements;
+ const { analyticsName } = props.type;
return (
<>
{Array.from(ChatBarButtonMap)
.filter(([key]) => chatBarButtons[key]?.enabled !== false)
.map(([key, { render: Button }]) => (
logger.error(`Failed to render ${key}`, e.error)}>
-
+
))}
>
diff --git a/src/plugins/previewMessage/index.tsx b/src/plugins/previewMessage/index.tsx
index 9b6c9e82b..aa52a5061 100644
--- a/src/plugins/previewMessage/index.tsx
+++ b/src/plugins/previewMessage/index.tsx
@@ -22,7 +22,7 @@ import { Devs } from "@utils/constants";
import definePlugin, { IconComponent, StartAt } from "@utils/types";
import { CloudUpload, MessageAttachment } from "@vencord/discord-types";
import { findByPropsLazy } from "@webpack";
-import { DraftStore, DraftType, SelectedChannelStore, UserStore, useStateFromStores } from "@webpack/common";
+import { DraftStore, DraftType, UserStore, useStateFromStores } from "@webpack/common";
const UploadStore = findByPropsLazy("getUploads");
@@ -89,11 +89,10 @@ const PreviewIcon: IconComponent = ({ height = 20, width = 20, className }) => {
);
};
-const PreviewButton: ChatBarButtonFactory = ({ isMainChat, isEmpty, type: { attachments } }) => {
- const channelId = SelectedChannelStore.getChannelId();
+const PreviewButton: ChatBarButtonFactory = ({ isAnyChat, isEmpty, type: { attachments }, channel: { id: channelId } }) => {
const draft = useStateFromStores([DraftStore], () => getDraft(channelId));
- if (!isMainChat) return null;
+ if (!isAnyChat) return null;
const hasAttachments = attachments && UploadStore.getUploads(channelId, DraftType.ChannelMessage).length > 0;
const hasContent = !isEmpty && draft?.length > 0;
diff --git a/src/plugins/sendTimestamps/index.tsx b/src/plugins/sendTimestamps/index.tsx
index 579656c45..4e7b8bf00 100644
--- a/src/plugins/sendTimestamps/index.tsx
+++ b/src/plugins/sendTimestamps/index.tsx
@@ -144,8 +144,8 @@ const SendTimestampIcon: IconComponent = ({ height = 20, width = 20, className }
);
};
-const SendTimestampButton: ChatBarButtonFactory = ({ isMainChat }) => {
- if (!isMainChat) return null;
+const SendTimestampButton: ChatBarButtonFactory = ({ isAnyChat }) => {
+ if (!isAnyChat) return null;
return (
void);
export const TranslateChatBarIcon: ChatBarButtonFactory = ({ isMainChat }) => {
- const { autoTranslate, showChatBarButton } = settings.use(["autoTranslate", "showChatBarButton"]);
+ const { autoTranslate } = settings.use(["autoTranslate"]);
const [shouldShowTranslateEnabledTooltip, setter] = useState(false);
useEffect(() => {
@@ -50,7 +50,7 @@ export const TranslateChatBarIcon: ChatBarButtonFactory = ({ isMainChat }) => {
return () => setShouldShowTranslateEnabledTooltip = undefined;
}, []);
- if (!isMainChat || !showChatBarButton) return null;
+ if (!isMainChat) return null;
const toggle = () => {
const newState = !autoTranslate;
diff --git a/src/plugins/translate/settings.ts b/src/plugins/translate/settings.ts
index 916c70bd2..a29e7d84c 100644
--- a/src/plugins/translate/settings.ts
+++ b/src/plugins/translate/settings.ts
@@ -45,11 +45,6 @@ export const settings = definePluginSettings({
hidden: true
},
- showChatBarButton: {
- type: OptionType.BOOLEAN,
- description: "Show translate button in chat bar",
- default: true
- },
service: {
type: OptionType.SELECT,
description: IS_WEB ? "Translation service (Not supported on Web!)" : "Translation service",