mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-10 07:03:06 -04:00
feat(voiceChannelLog): display username on profile picture hover
This commit is contained in:
parent
40ba524206
commit
5585d4cd94
4 changed files with 18 additions and 7 deletions
|
@ -32,7 +32,8 @@
|
|||
text-align: center;
|
||||
margin-top: 10px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px
|
||||
padding-right: 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.vc-voice-channel-log-icon {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
import "./VoiceChannelLogEntryComponent.css";
|
||||
|
||||
import { classes } from "@utils/misc";
|
||||
import { React, Timestamp, UserStore } from "@webpack/common";
|
||||
import { React, Timestamp, Tooltip, UserStore } from "@webpack/common";
|
||||
import { Channel } from "discord-types/general";
|
||||
import { Util } from "Vencord";
|
||||
|
||||
|
@ -20,11 +20,16 @@ export function VoiceChannelLogEntryComponent({ logEntry, channel }: { logEntry:
|
|||
return <li className="vc-voice-channel-log">
|
||||
<Timestamp className={cl("timestamp")} timestamp={new Date(logEntry.timestamp)} compact isInline={false} cozyAlt></Timestamp>
|
||||
<Icon logEntry={logEntry} channel={channel} className={cl("icon")} />
|
||||
<img
|
||||
className={classes(cl("avatar"))}
|
||||
onClick={() => Util.openUserProfile(logEntry.userId)}
|
||||
src={user.getAvatarURL(channel.getGuildId())}
|
||||
/>
|
||||
<Tooltip text={logEntry.username}>
|
||||
{(tooltipProps: any) => (
|
||||
<img
|
||||
{...tooltipProps}
|
||||
className={classes(cl("avatar"))}
|
||||
onClick={() => Util.openUserProfile(logEntry.userId)}
|
||||
src={user.getAvatarURL(channel.getGuildId())}
|
||||
/>
|
||||
)}
|
||||
</Tooltip>
|
||||
<div className={cl("content")}>
|
||||
{ }
|
||||
</div>
|
||||
|
|
|
@ -119,7 +119,10 @@ export default definePlugin({
|
|||
const clientUserId = UserStore.getCurrentUser().id;
|
||||
voiceStates.forEach(state => {
|
||||
// mmmm hacky workaround
|
||||
console.log(state);
|
||||
const { userId, channelId } = state;
|
||||
const user = UserStore.getUser(userId) as User & { globalName: string; };
|
||||
const username = user.globalName || user.username;
|
||||
let { oldChannelId } = state;
|
||||
if (userId === clientUserId && channelId !== clientOldChannelId) {
|
||||
oldChannelId = clientOldChannelId;
|
||||
|
@ -131,6 +134,7 @@ export default definePlugin({
|
|||
|
||||
const logEntry = {
|
||||
userId,
|
||||
username,
|
||||
oldChannel: oldChannelId || null,
|
||||
newChannel: channelId || null,
|
||||
timestamp: new Date()
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
export interface VoiceChannelLogEntry {
|
||||
userId: string;
|
||||
username: string;
|
||||
oldChannel: string | null;
|
||||
newChannel: string | null;
|
||||
timestamp: Date;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue