feat(Translate): add toggle for chat bar icon (#2418)

This commit is contained in:
Cats 2024-05-11 20:44:06 -04:00 committed by GitHub
parent d6507947f5
commit a99354503f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View file

@ -40,9 +40,9 @@ export function TranslateIcon({ height = 24, width = 24, className }: { height?:
} }
export const TranslateChatBarIcon: ChatBarButton = ({ isMainChat }) => { export const TranslateChatBarIcon: ChatBarButton = ({ isMainChat }) => {
const { autoTranslate } = settings.use(["autoTranslate"]); const { autoTranslate, showChatBarButton } = settings.use(["autoTranslate", "showChatBarButton"]);
if (!isMainChat) return null; if (!isMainChat || !showChatBarButton) return null;
const toggle = () => { const toggle = () => {
const newState = !autoTranslate; const newState = !autoTranslate;

View file

@ -48,6 +48,11 @@ export const settings = definePluginSettings({
type: OptionType.BOOLEAN, type: OptionType.BOOLEAN,
description: "Automatically translate your messages before sending. You can also shift/right click the translate button to toggle this", description: "Automatically translate your messages before sending. You can also shift/right click the translate button to toggle this",
default: false default: false
},
showChatBarButton: {
type: OptionType.BOOLEAN,
description: "Show translate button in chat bar",
default: true
} }
}).withPrivateSettings<{ }).withPrivateSettings<{
showAutoTranslateAlert: boolean; showAutoTranslateAlert: boolean;