From e72c732d58a7bc38dab1ceb7ec4906879974b4d5 Mon Sep 17 00:00:00 2001
From: Nuckyz <61953774+Nuckyz@users.noreply.github.com>
Date: Fri, 17 May 2024 23:03:44 -0300
Subject: [PATCH] FriendsSince: Show in user profile modal
---
src/plugins/friendsSince/index.tsx | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/plugins/friendsSince/index.tsx b/src/plugins/friendsSince/index.tsx
index fb431b52b..b2501023e 100644
--- a/src/plugins/friendsSince/index.tsx
+++ b/src/plugins/friendsSince/index.tsx
@@ -7,6 +7,7 @@
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import { getCurrentChannel } from "@utils/discord";
+import { classes } from "@utils/misc";
import definePlugin from "@utils/types";
import { findByPropsLazy } from "@webpack";
import { Heading, React, RelationshipStore, Text } from "@webpack/common";
@@ -22,6 +23,7 @@ export default definePlugin({
description: "Shows when you became friends with someone in the user popout",
authors: [Devs.Elvyra],
patches: [
+ // User popup
{
find: ".AnalyticsSections.USER_PROFILE}",
replacement: {
@@ -29,16 +31,25 @@ export default definePlugin({
replace: "$&,$self.friendsSince({ userId: $1 })"
}
},
+ // User DMs "User Profile" popup in the right
{
find: ".UserPopoutUpsellSource.PROFILE_PANEL,",
replacement: {
match: /\i.default,\{userId:(\i)}\)/,
replace: "$&,$self.friendsSince({ userId: $1 })"
}
+ },
+ // User Profile Modal
+ {
+ find: ".userInfoSectionHeader,",
+ replacement: {
+ match: /(\.Messages\.USER_PROFILE_MEMBER_SINCE.+?userId:(.+?)),textClassName:(\i\.userInfoText)}\)/,
+ replace: (_, rest, userId, textClassName) => `${rest}}),$self.friendsSince({ userId: ${userId}, textClassName: ${textClassName} })`
+ }
}
],
- friendsSince: ErrorBoundary.wrap(({ userId }: { userId: string; }) => {
+ friendsSince: ErrorBoundary.wrap(({ userId, textClassName }: { userId: string; textClassName?: string; }) => {
const friendsSince = RelationshipStore.getSince(userId);
if (!friendsSince) return null;
@@ -61,7 +72,7 @@ export default definePlugin({
)}
-
+
{getCreatedAtDate(friendsSince, locale.getLocale())}