diff --git a/src/webpage/jsontypes.ts b/src/webpage/jsontypes.ts index b9304bc..1c18757 100644 --- a/src/webpage/jsontypes.ts +++ b/src/webpage/jsontypes.ts @@ -341,6 +341,8 @@ export type highMemberJSON = mainuserjson & { id: string; nick: null | string; }[]; + //Only reason this is optional is due to the fact that this is really new and I want to make sure the type checker checks this for me :3 + mutual_friends?: userjson[]; }; type emojijson = { name: string; diff --git a/src/webpage/member.ts b/src/webpage/member.ts index 3ab077b..fefd76b 100644 --- a/src/webpage/member.ts +++ b/src/webpage/member.ts @@ -441,7 +441,7 @@ class Member extends SnowFlake { this.info.api + "/users/" + this.id + - "/profile?with_mutual_guilds=true&with_mutual_friends_count=true&guild_id=" + + "/profile?with_mutual_guilds=true&with_mutual_friends=true&guild_id=" + this.guild.id, {headers: this.guild.headers}, ) diff --git a/src/webpage/style.css b/src/webpage/style.css index 06219d7..5a821ae 100644 --- a/src/webpage/style.css +++ b/src/webpage/style.css @@ -12,6 +12,19 @@ body { height: 100svh; background: var(--primary-bg); } +.mutFriends { + display: flex; + flex-direction: column; + align-items: stretch; + + .createdWebhook { + flex-grow: 1; + background: var(--primary-bg); + margin-bottom: 6px; + width: 100%; + box-sizing: border-box; + } +} .createdWebhook { display: flex; align-items: center; @@ -23,9 +36,9 @@ body { cursor: pointer; .pfp { - width: 0.5in; - height: 0.5in; - margin-right: 0.15in; + width: 0.5in !important; + height: 0.5in !important; + margin-right: 0.15in !important; } } .Mplayer { diff --git a/src/webpage/user.ts b/src/webpage/user.ts index f3f1cd4..a1e178e 100644 --- a/src/webpage/user.ts +++ b/src/webpage/user.ts @@ -493,7 +493,8 @@ class User extends SnowFlake { } return pfp; } - createWidget(guild: Guild) { + createWidget(guild?: Guild) { + guild = this.localuser.guildids.get("@me") as Guild; const div = document.createElement("div"); div.classList.add("flexltr", "createdWebhook"); //TODO make sure this is something I can actually do here @@ -508,7 +509,7 @@ class User extends SnowFlake { if (_) { name.textContent = _.name; pfp.src = _.getpfpsrc(); - } else { + } else if (guild.id !== "@me") { const notFound = document.createElement("span"); notFound.textContent = I18n.webhooks.notFound(); nameBox.append(notFound); @@ -921,6 +922,25 @@ class User extends SnowFlake { .filter((_) => _ !== undefined), ); mut.addHTMLArea(mutDiv); + + if (high.mutual_friends) { + const friends = buttons.add(I18n.profile.mutFriends()); + const div = document.createElement("div"); + div.classList.add("mutFriends"); + div.append( + ...high.mutual_friends + .map((_) => new User(_, this.localuser)) + .map((user) => { + const html = user.createWidget(this.localuser.lookingguild); + html.onclick = (e) => { + e.stopImmediatePropagation(); + e.preventDefault(); + }; + return html; + }), + ); + friends.addHTMLArea(div); + } })(); const fhtml = float.generateHTML(); fhtml.style.overflow = "auto"; diff --git a/translations/en.json b/translations/en.json index f70acd3..69498fa 100644 --- a/translations/en.json +++ b/translations/en.json @@ -185,7 +185,8 @@ "userInfo": "User Info", "bio": "About me:", "permInfo": "Permissions", - "mut": "Mutual guilds", + "mut": "Mutual Guilds", + "mutFriends":"Mutual Friends", "joined":"Account made: $1", "joinedMember":"Joined $1: $2" },