Fix plugins for new V2 User Profile Modal

This commit is contained in:
Nuckyz 2025-05-04 16:25:13 -03:00
parent b0b616d92a
commit 0a2d4a2ab2
No known key found for this signature in database
GPG key ID: 440BF8296E1C4AD9
6 changed files with 44 additions and 7 deletions

View file

@ -32,7 +32,15 @@ export default definePlugin({
},
// User Profile Modal
{
find: "action:\"PRESS_APP_CONNECTION\"",
find: ".connections,userId:",
replacement: {
match: /#{intl::USER_PROFILE_MEMBER_SINCE}\),.{0,100}userId:(\i\.id),.{0,100}}\)}\),/,
replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:false}),"
}
},
// User Profile Modal v2
{
find: ".MODAL_V2,onClose:",
replacement: {
match: /#{intl::USER_PROFILE_MEMBER_SINCE}\),.{0,100}userId:(\i\.id),.{0,100}}\)}\),/,
replace: "$&,$self.FriendsSinceComponent({userId:$1,isSidebar:false}),"

View file

@ -87,6 +87,7 @@ export default definePlugin({
authors: [Devs.amia],
patches: [
// User Profile Modal
{
find: ".BOT_DATA_ACCESS?(",
replacement: [
@ -102,7 +103,31 @@ export default definePlugin({
// set the gap to zero to ensure ours stays on screen
{
match: /className:\i\.tabBar/,
replace: "$& + ' vc-mutual-gdms-tab-bar'"
replace: '$& + " vc-mutual-gdms-modal-tab-bar"'
}
]
},
// User Profile Modal v2
{
find: ".tabBarPanel,children:",
replacement: [
{
match: /items:(\i),.+?(?=return\(0,\i\.jsxs?\)\("div)/,
replace: "$&$self.pushSection($1,arguments[0].user);"
},
{
match: /\.tabBarPanel,children:(?=.+?section:(\i))/,
replace: "$&$1==='MUTUAL_GDMS'?$self.renderMutualGDMs(arguments[0]):"
},
// Make the gap between each item smaller so our tab can fit.
{
match: /className:\i\.tabBar/,
replace: '$& + " vc-mutual-gdms-modal-v2-tab-bar"'
},
// Make the tab bar item text smaller so our tab can fit.
{
match: /(\.tabBarItem.+?variant:)"heading-lg\/medium"/,
replace: '$1"heading-md/medium"'
}
]
},
@ -138,8 +163,8 @@ export default definePlugin({
sections[IS_PATCHED] = true;
sections.push({
text: getMutualGDMCountText(user),
section: "MUTUAL_GDMS",
text: getMutualGDMCountText(user)
});
} catch (e) {
new Logger("MutualGroupDMs").error("Failed to push mutual group dms section:", e);

View file

@ -1,3 +1,7 @@
.vc-mutual-gdms-tab-bar {
.vc-mutual-gdms-modal-tab-bar {
gap: 0;
}
.vc-mutual-gdms-modal-v2-tab-bar {
gap: 6px;
}

View file

@ -55,7 +55,7 @@ export default definePlugin({
settings,
patches: [
// User Popout, Full Size Profile, Direct Messages Side Profile
// User Popout, User Profile Modal, Direct Messages Side Profile
{
find: "#{intl::USER_PROFILE_LOAD_ERROR}",
replacement: {

View file

@ -190,7 +190,7 @@ export default definePlugin({
},
patches: [
// Avatar component used in User DMs "User Profile" popup in the right and Profiles Modal pfp
// Avatar component used in User DMs "User Profile" popup in the right and User Profile Modal pfp
{
find: ".overlay:void 0,status:",
replacement: [

View file

@ -140,7 +140,7 @@ export type MediaModalProps = {
shouldHideMediaOptions?: boolean;
};
// modal key: "Media Viewer Modal"
// Modal key: "Media Viewer Modal"
export const openMediaModal: (props: MediaModalProps) => void = findByCodeLazy("hasMediaOptions", "shouldHideMediaOptions");
interface ModalAPI {