mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-08 14:13:01 -04:00
Merge remote-tracking branch 'upstream/dev' into dev
This commit is contained in:
commit
b0ea6e838c
10 changed files with 35 additions and 45 deletions
|
@ -21,25 +21,14 @@ import { Channel, User } from "discord-types/general/index.js";
|
||||||
import { JSX } from "react";
|
import { JSX } from "react";
|
||||||
|
|
||||||
interface DecoratorProps {
|
interface DecoratorProps {
|
||||||
activities: any[];
|
type: "guild" | "dm";
|
||||||
channel: Channel;
|
|
||||||
/**
|
|
||||||
* Only for DM members
|
|
||||||
*/
|
|
||||||
channelName?: string;
|
|
||||||
/**
|
|
||||||
* Only for server members
|
|
||||||
*/
|
|
||||||
currentUser?: User;
|
|
||||||
guildId?: string;
|
|
||||||
isMobile: boolean;
|
|
||||||
isOwner?: boolean;
|
|
||||||
isTyping: boolean;
|
|
||||||
selected: boolean;
|
|
||||||
status: string;
|
|
||||||
user: User;
|
user: User;
|
||||||
[key: string]: any;
|
/** only present when this is a DM list item */
|
||||||
|
channel: Channel;
|
||||||
|
/** only present when this is a guild list item */
|
||||||
|
isOwner: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MemberListDecoratorFactory = (props: DecoratorProps) => JSX.Element | null;
|
export type MemberListDecoratorFactory = (props: DecoratorProps) => JSX.Element | null;
|
||||||
type OnlyIn = "guilds" | "dms";
|
type OnlyIn = "guilds" | "dms";
|
||||||
|
|
||||||
|
@ -53,18 +42,16 @@ export function removeMemberListDecorator(identifier: string) {
|
||||||
decoratorsFactories.delete(identifier);
|
decoratorsFactories.delete(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function __getDecorators(props: DecoratorProps): JSX.Element {
|
export function __getDecorators(props: DecoratorProps, type: "guild" | "dm"): JSX.Element {
|
||||||
const isInGuild = !!(props.guildId);
|
|
||||||
|
|
||||||
const decorators = Array.from(
|
const decorators = Array.from(
|
||||||
decoratorsFactories.entries(),
|
decoratorsFactories.entries(),
|
||||||
([key, { render: Decorator, onlyIn }]) => {
|
([key, { render: Decorator, onlyIn }]) => {
|
||||||
if ((onlyIn === "guilds" && !isInGuild) || (onlyIn === "dms" && isInGuild))
|
if ((onlyIn === "guilds" && type !== "guild") || (onlyIn === "dms" && type !== "dm"))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ErrorBoundary noop key={key} message={`Failed to render ${key} Member List Decorator`}>
|
<ErrorBoundary noop key={key} message={`Failed to render ${key} Member List Decorator`}>
|
||||||
<Decorator {...props} />
|
<Decorator {...props} type={type} />
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ export default definePlugin({
|
||||||
required: true,
|
required: true,
|
||||||
patches: [
|
patches: [
|
||||||
{
|
{
|
||||||
find: ".FULL_SIZE]:26",
|
find: ".MODAL]:26",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /(?=;return 0===(\i)\.length\?)(?<=(\i)\.useMemo.+?)/,
|
match: /(?=;return 0===(\i)\.length\?)(?<=(\i)\.useMemo.+?)/,
|
||||||
replace: ";$1=$2.useMemo(()=>[...$self.getBadges(arguments[0].displayProfile),...$1],[$1])"
|
replace: ";$1=$2.useMemo(()=>[...$self.getBadges(arguments[0].displayProfile),...$1],[$1])"
|
||||||
|
|
|
@ -32,25 +32,17 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: ".lostPermission)",
|
find: ".lostPermission)",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
|
||||||
match: /let\{[^}]*lostPermissionTooltipText:\i[^}]*\}=(\i),/,
|
|
||||||
replace: "$&vencordProps=$1,"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
match: /decorators:.{0,100}?(?=user:)/,
|
|
||||||
replace: "$&vencordProps:typeof vencordProps!=='undefined'?vencordProps:void 0,"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
match: /children:\[(?=.{0,300},lostPermissionTooltipText:)/,
|
match: /children:\[(?=.{0,300},lostPermissionTooltipText:)/,
|
||||||
replace: "children:[(arguments[0]?.vencordProps&&Vencord.Api.MemberListDecorators.__getDecorators(arguments[0].vencordProps)),"
|
replace: "children:[Vencord.Api.MemberListDecorators.__getDecorators(arguments[0],'guild'),"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "PrivateChannel.renderAvatar",
|
find: "PrivateChannel.renderAvatar",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /decorators:(\i\.isSystemDM\(\))\?(.+?):null/,
|
match: /decorators:(\i\.isSystemDM\(\)\?.+?:null)/,
|
||||||
replace: "decorators:[Vencord.Api.MemberListDecorators.__getDecorators(arguments[0]),$1?$2:null]"
|
replace: "decorators:[Vencord.Api.MemberListDecorators.__getDecorators(arguments[0],'dm'),$1]"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -32,14 +32,14 @@ export default definePlugin({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: "#{intl::SERVERS}),gap:\"xs\",children:",
|
find: ".setGuildsTree(",
|
||||||
replacement: [
|
replacement: [
|
||||||
{
|
{
|
||||||
match: /(?<=#{intl::SERVERS}\),gap:"xs",children:)(\i\.map\(.{10,50}?)(}\))/,
|
match: /(?<=#{intl::SERVERS}\),gap:"xs",children:)\i\.map\(.{0,50}\.length\)/,
|
||||||
replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($1)$2"
|
replace: "Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.In).concat($&)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match: /children:.{0,2000}?\{\}\)\]/,
|
match: /lastTargetNode.{0,50}\{\}\)\]/,
|
||||||
replace: "$&.concat(Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.Below))"
|
replace: "$&.concat(Vencord.Api.ServerList.renderAll(Vencord.Api.ServerList.ServerListRenderPosition.Below))"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -19,7 +19,7 @@ interface UserProfileProps {
|
||||||
originalRenderPopout: () => React.ReactNode;
|
originalRenderPopout: () => React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
const UserProfile = findComponentByCodeLazy(".BITE_SIZE,user:");
|
const UserProfile = findComponentByCodeLazy(".POPOUT,user");
|
||||||
|
|
||||||
let openAlternatePopout = false;
|
let openAlternatePopout = false;
|
||||||
let accountPanelRef: React.RefObject<Record<PropertyKey, any> | null> = { current: null };
|
let accountPanelRef: React.RefObject<Record<PropertyKey, any> | null> = { current: null };
|
||||||
|
|
|
@ -29,9 +29,8 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: "#{intl::GUILD_OWNER}),children:",
|
find: "#{intl::GUILD_OWNER}),children:",
|
||||||
replacement: {
|
replacement: {
|
||||||
// The isOwner prop is used in more tha one component in this module. Make sure we patch the right one
|
match: /(?<=decorators:.{0,200}?isOwner:)\i/,
|
||||||
match: /,isOwner:(\i),(?=[^}]+guildId)/,
|
replace: "$self.isGuildOwner(arguments[0])"
|
||||||
replace: ",_isOwner:$1=$self.isGuildOwner(e),"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default definePlugin({
|
||||||
patches: [
|
patches: [
|
||||||
// DM User Sidebar
|
// DM User Sidebar
|
||||||
{
|
{
|
||||||
find: ".PANEL}),nicknameIcons",
|
find: ".SIDEBAR}),nicknameIcons",
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /#{intl::USER_PROFILE_MEMBER_SINCE}\),.{0,100}userId:(\i\.id)}\)}\)/,
|
match: /#{intl::USER_PROFILE_MEMBER_SINCE}\),.{0,100}userId:(\i\.id)}\)}\)/,
|
||||||
replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:true})"
|
replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:true})"
|
||||||
|
|
|
@ -67,8 +67,8 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
find: '="SYSTEM_TAG"',
|
find: '="SYSTEM_TAG"',
|
||||||
replacement: {
|
replacement: {
|
||||||
match: /\i.gradientClassName]\),style:/,
|
match: /(?<=\.username.{0,50}?)style:/,
|
||||||
replace: "$&{color:$self.calculateNameColorForMessageContext(arguments[0])},_style:"
|
replace: "style:{color:$self.calculateNameColorForMessageContext(arguments[0])},_style:"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import "./style.css";
|
||||||
|
|
||||||
import ErrorBoundary from "@components/ErrorBoundary";
|
import ErrorBoundary from "@components/ErrorBoundary";
|
||||||
import { Devs } from "@utils/constants";
|
import { Devs } from "@utils/constants";
|
||||||
import { isNonNullish } from "@utils/guards";
|
import { isNonNullish } from "@utils/guards";
|
||||||
|
@ -95,6 +97,12 @@ export default definePlugin({
|
||||||
{
|
{
|
||||||
match: /\(0,\i\.jsx\)\(\i,\{items:\i,section:(\i)/,
|
match: /\(0,\i\.jsx\)\(\i,\{items:\i,section:(\i)/,
|
||||||
replace: "$1==='MUTUAL_GDMS'?$self.renderMutualGDMs(arguments[0]):$&"
|
replace: "$1==='MUTUAL_GDMS'?$self.renderMutualGDMs(arguments[0]):$&"
|
||||||
|
},
|
||||||
|
// Discord adds spacing between each item which pushes our tab off screen.
|
||||||
|
// set the gap to zero to ensure ours stays on screen
|
||||||
|
{
|
||||||
|
match: /className:\i\.tabBar/,
|
||||||
|
replace: "$& + ' vc-mutual-gdms-tab-bar'"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
4
src/plugins/mutualGroupDMs/style.css
Normal file
4
src/plugins/mutualGroupDMs/style.css
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
.vc-mutual-gdms-tab-bar {
|
||||||
|
gap: 0;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue