mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-10 09:56:24 +00:00
Merge branch 'dev' into immediate-finds
This commit is contained in:
commit
bbf924d16b
3 changed files with 32 additions and 11 deletions
|
@ -127,13 +127,13 @@ function VoiceChannelTooltip({ channel }: VoiceChannelTooltipProps) {
|
||||||
|
|
||||||
interface VoiceChannelIndicatorProps {
|
interface VoiceChannelIndicatorProps {
|
||||||
userId: string;
|
userId: string;
|
||||||
size?: number;
|
|
||||||
isActionButton?: boolean;
|
isActionButton?: boolean;
|
||||||
|
isMessageIndicator?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const clickTimers = {} as Record<string, any>;
|
const clickTimers = {} as Record<string, any>;
|
||||||
|
|
||||||
export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId, size, isActionButton }: VoiceChannelIndicatorProps) => {
|
export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId, isActionButton, isMessageIndicator }: VoiceChannelIndicatorProps) => {
|
||||||
const channelId = useStateFromStores([VoiceStateStore], () => VoiceStateStore.getVoiceStateForUser(userId)?.channelId as string | undefined);
|
const channelId = useStateFromStores([VoiceStateStore], () => VoiceStateStore.getVoiceStateForUser(userId)?.channelId as string | undefined);
|
||||||
|
|
||||||
const channel = channelId == null ? undefined : ChannelStore.getChannel(channelId);
|
const channel = channelId == null ? undefined : ChannelStore.getChannel(channelId);
|
||||||
|
@ -178,16 +178,18 @@ export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId, size, isActio
|
||||||
tooltipContentClassName={cl("tooltip-content")}
|
tooltipContentClassName={cl("tooltip-content")}
|
||||||
>
|
>
|
||||||
{props => {
|
{props => {
|
||||||
const iconProps = {
|
const iconProps: IconProps = {
|
||||||
...props,
|
...props,
|
||||||
onClick,
|
className: isActionButton ? cl("indicator-action-button") : cl("speaker-padding"),
|
||||||
size,
|
size: isActionButton ? 20 : undefined,
|
||||||
className: isActionButton ? cl("indicator-action-button") : cl("speaker-padding")
|
onClick
|
||||||
};
|
};
|
||||||
|
|
||||||
return isLocked ?
|
return <div className={isMessageIndicator ? cl("speaker-vertical-margin") : undefined}>
|
||||||
|
{isLocked ?
|
||||||
<LockedSpeakerIcon {...iconProps} />
|
<LockedSpeakerIcon {...iconProps} />
|
||||||
: <SpeakerIcon {...iconProps} />;
|
: <SpeakerIcon {...iconProps} />}
|
||||||
|
</div>;
|
||||||
}}
|
}}
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
import "./style.css";
|
import "./style.css";
|
||||||
|
|
||||||
import { addDecorator, removeDecorator } from "@api/MemberListDecorators";
|
import { addDecorator, removeDecorator } from "@api/MemberListDecorators";
|
||||||
|
import { addDecoration, removeDecoration } from "@api/MessageDecorations";
|
||||||
import { definePluginSettings } from "@api/Settings";
|
import { definePluginSettings } from "@api/Settings";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import definePlugin, { OptionType } from "@utils/types";
|
import definePlugin, { OptionType } from "@utils/types";
|
||||||
|
@ -37,13 +38,19 @@ const settings = definePluginSettings({
|
||||||
description: "Show a user's Voice Channel indicator in the member and DMs list",
|
description: "Show a user's Voice Channel indicator in the member and DMs list",
|
||||||
default: true,
|
default: true,
|
||||||
restartNeeded: true
|
restartNeeded: true
|
||||||
|
},
|
||||||
|
showInMessages: {
|
||||||
|
type: OptionType.BOOLEAN,
|
||||||
|
description: "Show a user's Voice Channel indicator in messages",
|
||||||
|
default: true,
|
||||||
|
restartNeeded: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default definePlugin({
|
export default definePlugin({
|
||||||
name: "UserVoiceShow",
|
name: "UserVoiceShow",
|
||||||
description: "Shows an indicator when a user is in a Voice Channel",
|
description: "Shows an indicator when a user is in a Voice Channel",
|
||||||
authors: [Devs.LordElias, Devs.Nuckyz],
|
authors: [Devs.Nuckyz, Devs.LordElias],
|
||||||
settings,
|
settings,
|
||||||
|
|
||||||
patches: [
|
patches: [
|
||||||
|
@ -80,7 +87,7 @@ export default definePlugin({
|
||||||
find: "null!=this.peopleListItemRef.current",
|
find: "null!=this.peopleListItemRef.current",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\.actions,children:\[/,
|
match: /\.actions,children:\[/,
|
||||||
replace: "$&$self.VoiceChannelIndicator({userId:this?.props?.user?.id,size:20,isActionButton:true}),"
|
replace: "$&$self.VoiceChannelIndicator({userId:this?.props?.user?.id,isActionButton:true}),"
|
||||||
},
|
},
|
||||||
predicate: () => settings.store.showInMemberList
|
predicate: () => settings.store.showInMemberList
|
||||||
}
|
}
|
||||||
|
@ -90,10 +97,14 @@ export default definePlugin({
|
||||||
if (settings.store.showInMemberList) {
|
if (settings.store.showInMemberList) {
|
||||||
addDecorator("UserVoiceShow", ({ user }) => user == null ? null : <VoiceChannelIndicator userId={user.id} />);
|
addDecorator("UserVoiceShow", ({ user }) => user == null ? null : <VoiceChannelIndicator userId={user.id} />);
|
||||||
}
|
}
|
||||||
|
if (settings.store.showInMessages) {
|
||||||
|
addDecoration("UserVoiceShow", ({ message }) => message?.author == null ? null : <VoiceChannelIndicator userId={message.author.id} isMessageIndicator />);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
removeDecorator("UserVoiceShow");
|
removeDecorator("UserVoiceShow");
|
||||||
|
removeDecoration("UserVoiceShow");
|
||||||
},
|
},
|
||||||
|
|
||||||
VoiceChannelIndicator
|
VoiceChannelIndicator
|
||||||
|
|
|
@ -17,6 +17,14 @@
|
||||||
padding: 0 4px;
|
padding: 0 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.vc-uvs-message-indicator {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
top: 2.5px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
.vc-uvs-indicator-action-button {
|
.vc-uvs-indicator-action-button {
|
||||||
background-color: var(--background-secondary);
|
background-color: var(--background-secondary);
|
||||||
border-radius: 100%;
|
border-radius: 100%;
|
||||||
|
|
Loading…
Reference in a new issue