mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-13 16:43:04 -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;
|
text-align: center;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
padding-left: 10px;
|
padding-left: 10px;
|
||||||
padding-right: 10px
|
padding-right: 10px;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vc-voice-channel-log-icon {
|
.vc-voice-channel-log-icon {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
import "./VoiceChannelLogEntryComponent.css";
|
import "./VoiceChannelLogEntryComponent.css";
|
||||||
|
|
||||||
import { classes } from "@utils/misc";
|
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 { Channel } from "discord-types/general";
|
||||||
import { Util } from "Vencord";
|
import { Util } from "Vencord";
|
||||||
|
|
||||||
|
@ -20,11 +20,16 @@ export function VoiceChannelLogEntryComponent({ logEntry, channel }: { logEntry:
|
||||||
return <li className="vc-voice-channel-log">
|
return <li className="vc-voice-channel-log">
|
||||||
<Timestamp className={cl("timestamp")} timestamp={new Date(logEntry.timestamp)} compact isInline={false} cozyAlt></Timestamp>
|
<Timestamp className={cl("timestamp")} timestamp={new Date(logEntry.timestamp)} compact isInline={false} cozyAlt></Timestamp>
|
||||||
<Icon logEntry={logEntry} channel={channel} className={cl("icon")} />
|
<Icon logEntry={logEntry} channel={channel} className={cl("icon")} />
|
||||||
|
<Tooltip text={logEntry.username}>
|
||||||
|
{(tooltipProps: any) => (
|
||||||
<img
|
<img
|
||||||
|
{...tooltipProps}
|
||||||
className={classes(cl("avatar"))}
|
className={classes(cl("avatar"))}
|
||||||
onClick={() => Util.openUserProfile(logEntry.userId)}
|
onClick={() => Util.openUserProfile(logEntry.userId)}
|
||||||
src={user.getAvatarURL(channel.getGuildId())}
|
src={user.getAvatarURL(channel.getGuildId())}
|
||||||
/>
|
/>
|
||||||
|
)}
|
||||||
|
</Tooltip>
|
||||||
<div className={cl("content")}>
|
<div className={cl("content")}>
|
||||||
{ }
|
{ }
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -119,7 +119,10 @@ export default definePlugin({
|
||||||
const clientUserId = UserStore.getCurrentUser().id;
|
const clientUserId = UserStore.getCurrentUser().id;
|
||||||
voiceStates.forEach(state => {
|
voiceStates.forEach(state => {
|
||||||
// mmmm hacky workaround
|
// mmmm hacky workaround
|
||||||
|
console.log(state);
|
||||||
const { userId, channelId } = state;
|
const { userId, channelId } = state;
|
||||||
|
const user = UserStore.getUser(userId) as User & { globalName: string; };
|
||||||
|
const username = user.globalName || user.username;
|
||||||
let { oldChannelId } = state;
|
let { oldChannelId } = state;
|
||||||
if (userId === clientUserId && channelId !== clientOldChannelId) {
|
if (userId === clientUserId && channelId !== clientOldChannelId) {
|
||||||
oldChannelId = clientOldChannelId;
|
oldChannelId = clientOldChannelId;
|
||||||
|
@ -131,6 +134,7 @@ export default definePlugin({
|
||||||
|
|
||||||
const logEntry = {
|
const logEntry = {
|
||||||
userId,
|
userId,
|
||||||
|
username,
|
||||||
oldChannel: oldChannelId || null,
|
oldChannel: oldChannelId || null,
|
||||||
newChannel: channelId || null,
|
newChannel: channelId || null,
|
||||||
timestamp: new Date()
|
timestamp: new Date()
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
export interface VoiceChannelLogEntry {
|
export interface VoiceChannelLogEntry {
|
||||||
userId: string;
|
userId: string;
|
||||||
|
username: string;
|
||||||
oldChannel: string | null;
|
oldChannel: string | null;
|
||||||
newChannel: string | null;
|
newChannel: string | null;
|
||||||
timestamp: Date;
|
timestamp: Date;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue