Translate: Add auto translate enable alert
somehow people accidently enable it then get confused why vencord has "auto correct". this should hopefully solve the issue
This commit is contained in:
parent
2c198e547c
commit
e58aa5dbab
3 changed files with 26 additions and 4 deletions
|
@ -80,8 +80,6 @@ const buttonFactories = new Map<string, ChatBarButton>();
|
|||
const logger = new Logger("ChatButtons");
|
||||
|
||||
export function _injectButtons(buttons: ReactNode[], props: ChatBarProps) {
|
||||
if (props.type.analyticsName !== "normal") return;
|
||||
|
||||
for (const [key, makeButton] of buttonFactories) {
|
||||
try {
|
||||
const res = makeButton(props, props.type.analyticsName === "normal");
|
||||
|
|
|
@ -17,8 +17,10 @@
|
|||
*/
|
||||
|
||||
import { ChatBarButton } from "@api/ChatButtons";
|
||||
import { Margins } from "@utils/margins";
|
||||
import { classes } from "@utils/misc";
|
||||
import { openModal } from "@utils/modal";
|
||||
import { Alerts, Forms } from "@webpack/common";
|
||||
|
||||
import { settings } from "./settings";
|
||||
import { TranslateModal } from "./TranslateModal";
|
||||
|
@ -42,7 +44,27 @@ export const TranslateChatBarIcon: ChatBarButton = (props, isMainChat) => {
|
|||
|
||||
if (!isMainChat) return null;
|
||||
|
||||
const toggle = () => settings.store.autoTranslate = !autoTranslate;
|
||||
const toggle = () => {
|
||||
const newState = !autoTranslate;
|
||||
settings.store.autoTranslate = newState;
|
||||
if (newState && settings.store.showAutoTranslateAlert !== false)
|
||||
Alerts.show({
|
||||
title: "Vencord Auto-Translate Enabled",
|
||||
body: <>
|
||||
<Forms.FormText>
|
||||
You just enabled auto translate (by right clicking the Translate icon). Any message you send will automatically be translated before being sent.
|
||||
</Forms.FormText>
|
||||
<Forms.FormText className={Margins.top16}>
|
||||
If this was an accident, disable it again, or it will change your message content before sending.
|
||||
</Forms.FormText>
|
||||
</>,
|
||||
cancelText: "Disable Auto-Translate",
|
||||
confirmText: "Got it",
|
||||
secondaryConfirmText: "Don't show again",
|
||||
onConfirmSecondary: () => settings.store.showAutoTranslateAlert = false,
|
||||
onCancel: () => settings.store.autoTranslate = false
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<ChatBarButton
|
||||
|
|
|
@ -49,4 +49,6 @@ export const settings = definePluginSettings({
|
|||
description: "Automatically translate your messages before sending. You can also shift/right click the translate button to toggle this",
|
||||
default: false
|
||||
}
|
||||
});
|
||||
}).withPrivateSettings<{
|
||||
showAutoTranslateAlert: boolean;
|
||||
}>();
|
||||
|
|
Loading…
Reference in a new issue