mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-10 01:46:23 +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 {
|
||||
userId: string;
|
||||
size?: number;
|
||||
isActionButton?: boolean;
|
||||
isMessageIndicator?: boolean;
|
||||
}
|
||||
|
||||
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 channel = channelId == null ? undefined : ChannelStore.getChannel(channelId);
|
||||
|
@ -178,16 +178,18 @@ export const VoiceChannelIndicator = ErrorBoundary.wrap(({ userId, size, isActio
|
|||
tooltipContentClassName={cl("tooltip-content")}
|
||||
>
|
||||
{props => {
|
||||
const iconProps = {
|
||||
const iconProps: IconProps = {
|
||||
...props,
|
||||
onClick,
|
||||
size,
|
||||
className: isActionButton ? cl("indicator-action-button") : cl("speaker-padding")
|
||||
className: isActionButton ? cl("indicator-action-button") : cl("speaker-padding"),
|
||||
size: isActionButton ? 20 : undefined,
|
||||
onClick
|
||||
};
|
||||
|
||||
return isLocked ?
|
||||
return <div className={isMessageIndicator ? cl("speaker-vertical-margin") : undefined}>
|
||||
{isLocked ?
|
||||
<LockedSpeakerIcon {...iconProps} />
|
||||
: <SpeakerIcon {...iconProps} />;
|
||||
: <SpeakerIcon {...iconProps} />}
|
||||
</div>;
|
||||
}}
|
||||
</Tooltip>
|
||||
);
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
import "./style.css";
|
||||
|
||||
import { addDecorator, removeDecorator } from "@api/MemberListDecorators";
|
||||
import { addDecoration, removeDecoration } from "@api/MessageDecorations";
|
||||
import { definePluginSettings } from "@api/Settings";
|
||||
import { Devs } from "@utils/constants";
|
||||
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",
|
||||
default: true,
|
||||
restartNeeded: true
|
||||
},
|
||||
showInMessages: {
|
||||
type: OptionType.BOOLEAN,
|
||||
description: "Show a user's Voice Channel indicator in messages",
|
||||
default: true,
|
||||
restartNeeded: true
|
||||
}
|
||||
});
|
||||
|
||||
export default definePlugin({
|
||||
name: "UserVoiceShow",
|
||||
description: "Shows an indicator when a user is in a Voice Channel",
|
||||
authors: [Devs.LordElias, Devs.Nuckyz],
|
||||
authors: [Devs.Nuckyz, Devs.LordElias],
|
||||
settings,
|
||||
|
||||
patches: [
|
||||
|
@ -80,7 +87,7 @@ export default definePlugin({
|
|||
find: "null!=this.peopleListItemRef.current",
|
||||
replacement: {
|
||||
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
|
||||
}
|
||||
|
@ -90,10 +97,14 @@ export default definePlugin({
|
|||
if (settings.store.showInMemberList) {
|
||||
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() {
|
||||
removeDecorator("UserVoiceShow");
|
||||
removeDecoration("UserVoiceShow");
|
||||
},
|
||||
|
||||
VoiceChannelIndicator
|
||||
|
|
|
@ -17,6 +17,14 @@
|
|||
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 {
|
||||
background-color: var(--background-secondary);
|
||||
border-radius: 100%;
|
||||
|
|
Loading…
Reference in a new issue