diff options
author | Vendicated <vendicated@riseup.net> | 2023-03-28 18:43:45 +0200 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2023-03-28 18:43:45 +0200 |
commit | ab911b48b5608d0a6781c325a123138815282f74 (patch) | |
tree | c5ba5c272ffdd5cb2d03644b1c82470b95b13aaf /src/plugins | |
parent | 8cb349108629d735a03f746c4ac44de05666285a (diff) | |
download | Vencord-ab911b48b5608d0a6781c325a123138815282f74.tar.gz Vencord-ab911b48b5608d0a6781c325a123138815282f74.tar.bz2 Vencord-ab911b48b5608d0a6781c325a123138815282f74.zip |
TypingTweaks: Make names open profile on click
Closes #718
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/typingTweaks.tsx | 65 | ||||
-rw-r--r-- | src/plugins/uwuify.ts | 2 |
2 files changed, 48 insertions, 19 deletions
diff --git a/src/plugins/typingTweaks.tsx b/src/plugins/typingTweaks.tsx index 3eb4fad..0d72ca0 100644 --- a/src/plugins/typingTweaks.tsx +++ b/src/plugins/typingTweaks.tsx @@ -21,10 +21,11 @@ import ErrorBoundary from "@components/ErrorBoundary"; import { Devs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { findByCodeLazy } from "@webpack"; -import { GuildMemberStore, React, RelationshipStore } from "@webpack/common"; +import { GuildMemberStore, React, RelationshipStore, SelectedChannelStore } from "@webpack/common"; import { User } from "discord-types/general"; const Avatar = findByCodeLazy('"top",spacing:'); +const openProfile = findByCodeLazy("friendToken", "USER_PROFILE_MODAL_OPEN"); const settings = definePluginSettings({ showAvatars: { @@ -53,6 +54,46 @@ export function buildSeveralUsers({ a, b, c }: { a: string, b: string, c: number ]; } +interface Props { + user: User; + guildId: string; +} + +const TypingUser = ErrorBoundary.wrap(function ({ user, guildId }: Props) { + return ( + <strong + role="button" + onClick={() => { + openProfile({ + userId: user.id, + guildId, + channelId: SelectedChannelStore.getChannelId(), + analyticsLocation: { + page: guildId ? "Guild Channel" : "DM Channel", + section: "Profile Popout" + } + }); + }} + style={{ + display: "grid", + gridAutoFlow: "column", + gap: "4px", + color: settings.store.showRoleColors ? GuildMemberStore.getMember(guildId, user.id)?.colorString : undefined, + cursor: "pointer" + }} + > + {settings.store.showAvatars && ( + <div style={{ marginTop: "4px" }}> + <Avatar + size="SIZE_16" + src={user.getAvatarURL(guildId, 128)} /> + </div> + )} + {GuildMemberStore.getNick(guildId!, user.id) || !guildId && RelationshipStore.getNickname(user.id) || user.username} + </strong> + ); +}, { noop: true }); + export default definePlugin({ name: "TypingTweaks", description: "Show avatars and role colours in the typing indicator", @@ -93,22 +134,10 @@ export default definePlugin({ let element = 0; - return children.map(c => c.type === "strong" ? <this.TypingUser {...props} user={users[element++]} /> : c); + return children.map(c => + c.type === "strong" + ? <TypingUser {...props} user={users[element++]} /> + : c + ); }, - - TypingUser: ErrorBoundary.wrap(({ user, guildId }: { user: User, guildId: string; }) => { - return <strong style={{ - display: "grid", - gridAutoFlow: "column", - gap: "4px", - color: settings.store.showRoleColors ? GuildMemberStore.getMember(guildId, user.id)?.colorString : undefined - }}> - {settings.store.showAvatars && <div style={{ marginTop: "4px" }}> - <Avatar - size="SIZE_16" - src={user.getAvatarURL(guildId, 128)} /> - </div>} - {GuildMemberStore.getNick(guildId!, user.id) || !guildId && RelationshipStore.getNickname(user.id) || user.username} - </strong>; - }, { noop: true }) }); diff --git a/src/plugins/uwuify.ts b/src/plugins/uwuify.ts index e4b10e8..c3a879c 100644 --- a/src/plugins/uwuify.ts +++ b/src/plugins/uwuify.ts @@ -94,7 +94,7 @@ function uwuify(message: string): string { export default definePlugin({ name: "UwUifier", description: "Simply uwuify commands", - authors: [Devs.echo], + authors: [Devs.echo, Devs.skyevg], dependencies: ["CommandsAPI"], commands: [ |