mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-10 09:56:24 +00:00
add usermention component for dms
This commit is contained in:
parent
f36e5a3a81
commit
60219b3b0b
1 changed files with 21 additions and 10 deletions
|
@ -173,6 +173,24 @@ export function SettingArrayComponent({
|
||||||
channels[channel.guild_id].push(channel);
|
channels[channel.guild_id].push(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const userMention = channel => {
|
||||||
|
return <UserMentionComponent
|
||||||
|
userId={channel.recipients[0]}
|
||||||
|
className="mention"
|
||||||
|
/>;
|
||||||
|
};
|
||||||
|
|
||||||
|
const gdmComponent = channel => {
|
||||||
|
return <span style={{ display: "inline-flex", alignItems: "center" }}>
|
||||||
|
{channel.recipients.length >= 2 && channel.icon == null ? (
|
||||||
|
<GroupDMAvatars recipients={channel.recipients} size="SIZE_16" />
|
||||||
|
) : (
|
||||||
|
<Avatar src={getDMChannelIcon(channel)} size="SIZE_16" />
|
||||||
|
)}
|
||||||
|
<Text variant="text-sm/semibold" style={{ marginLeft: "4px" }}>{channel.name}</Text>
|
||||||
|
</span>;
|
||||||
|
};
|
||||||
|
|
||||||
if (dmChannels.length > 0) {
|
if (dmChannels.length > 0) {
|
||||||
elements.push(
|
elements.push(
|
||||||
<details>
|
<details>
|
||||||
|
@ -187,15 +205,8 @@ export function SettingArrayComponent({
|
||||||
marginBottom: "8px",
|
marginBottom: "8px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<span style={{ display: "inline-flex", alignItems: "center" }}>
|
{channel.recipients.length === 1 ? userMention(channel) : gdmComponent(channel)}
|
||||||
{channel.recipients.length >= 2 && channel.icon == null ? (
|
|
||||||
<GroupDMAvatars recipients={channel.recipients} size="SIZE_16" />
|
|
||||||
) : (
|
|
||||||
<Avatar src={getDMChannelIcon(channel)} size="SIZE_16" />
|
|
||||||
)}
|
|
||||||
<Text variant="text-sm/semibold" style={{ marginLeft: "4px" }}>{channel.name}</Text>
|
|
||||||
{removeButton(index)}
|
{removeButton(index)}
|
||||||
</span>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue