mirror of
https://github.com/Vendicated/Vencord.git
synced 2024-09-19 22:20:34 +00:00
Compare commits
3 commits
628e3a877b
...
59a3917156
Author | SHA1 | Date | |
---|---|---|---|
|
59a3917156 | ||
|
b875ebf92d | ||
|
7109185fd3 |
4 changed files with 59 additions and 7 deletions
47
src/plugins/replyMentionToggle/index.tsx
Normal file
47
src/plugins/replyMentionToggle/index.tsx
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Vencord, a Discord client mod
|
||||
* Copyright (c) 2024 Vendicated and contributors
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
import { findStoreLazy } from "@webpack";
|
||||
import { FluxDispatcher, SelectedChannelStore } from "@webpack/common";
|
||||
|
||||
const isMac = navigator.platform.includes("Mac");
|
||||
const PendingReplyStore = findStoreLazy("PendingReplyStore");
|
||||
|
||||
export default definePlugin({
|
||||
name: "ReplyMentionToggle",
|
||||
description: "Quickly toggle reply mentions by pressing alt+backspace",
|
||||
authors: [Devs.katlyn],
|
||||
|
||||
start() {
|
||||
document.addEventListener("keydown", onKeyDown);
|
||||
},
|
||||
stop() {
|
||||
document.removeEventListener("keydown", onKeyDown);
|
||||
}
|
||||
});
|
||||
|
||||
function onKeyDown(e: KeyboardEvent) {
|
||||
const isBackspace = e.key === "Backspace";
|
||||
const altPressed = e.altKey || (!isMac && e.metaKey);
|
||||
if (altPressed && isBackspace) {
|
||||
toggleReplyMention();
|
||||
}
|
||||
}
|
||||
|
||||
function toggleReplyMention(shouldMention?: boolean) {
|
||||
const channelId = SelectedChannelStore.getChannelId();
|
||||
const reply = PendingReplyStore.getPendingReply(channelId);
|
||||
|
||||
if (!reply) return;
|
||||
|
||||
FluxDispatcher.dispatch({
|
||||
type: "SET_PENDING_REPLY_SHOULD_MENTION",
|
||||
channelId,
|
||||
shouldMention: shouldMention === undefined ? !reply.shouldMention : shouldMention
|
||||
});
|
||||
}
|
|
@ -103,7 +103,7 @@ function VoiceChannelTooltip({ channel }: VoiceChannelTooltipProps) {
|
|||
<UserSummaryItem
|
||||
users={users}
|
||||
renderIcon={false}
|
||||
max={7}
|
||||
max={14}
|
||||
size={18}
|
||||
/>
|
||||
</div>
|
||||
|
@ -159,6 +159,7 @@ export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId }: VoiceChanne
|
|||
<Tooltip
|
||||
text={<VoiceChannelTooltip channel={channel} />}
|
||||
tooltipClassName={cl("tooltip-container")}
|
||||
tooltipContentClassName={cl("tooltip-content")}
|
||||
>
|
||||
{props =>
|
||||
isLocked ?
|
||||
|
|
|
@ -32,7 +32,7 @@ const settings = definePluginSettings({
|
|||
default: true,
|
||||
restartNeeded: true
|
||||
},
|
||||
showInVoiceMemberList: {
|
||||
showInMemberList: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Show a user's Voice Channel indicator in the member and DMs list",
|
||||
default: true,
|
||||
|
@ -82,12 +82,12 @@ export default definePlugin({
|
|||
match: /\.subtext,children:.+?}\)\]}\)(?=])/,
|
||||
replace: "$&,$self.VoiceChannelIndicator({userId:arguments[0]?.user?.id})"
|
||||
},
|
||||
predicate: () => settings.store.showInVoiceMemberList
|
||||
predicate: () => settings.store.showInMemberList
|
||||
}
|
||||
],
|
||||
|
||||
start() {
|
||||
if (settings.store.showInVoiceMemberList) {
|
||||
if (settings.store.showInMemberList) {
|
||||
addDecorator("UserVoiceShow", ({ user }) => user == null ? null : <VoiceChannelIndicator userId={user.id} />);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -15,7 +15,13 @@
|
|||
}
|
||||
|
||||
.vc-uvs-tooltip-container {
|
||||
max-width: 200px;
|
||||
max-width: 300px;
|
||||
}
|
||||
|
||||
.vc-uvs-tooltip-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.vc-uvs-guild-name {
|
||||
|
@ -31,7 +37,5 @@
|
|||
|
||||
.vc-uvs-vc-members {
|
||||
display: flex;
|
||||
margin: 8px 0;
|
||||
flex-direction: row;
|
||||
gap: 6px;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue