iRememberYou: Server ID (#1310)
* feat(iRememberYou): show server and DM group ID next to name in menu * feat(iRememberYou): add tt to authors list * fix(iRememberYou): only render server ID on guilds (oops: thought DM collections had valid group IDs)
This commit is contained in:
parent
b18b723cac
commit
69d6962a9b
5 changed files with 59 additions and 12 deletions
|
|
@ -89,7 +89,7 @@ export class Data {
|
|||
const groupKey = source?.id ?? "dm";
|
||||
const group = (target[groupKey] ||= {
|
||||
name: source?.name || "dm",
|
||||
id: source?.id || user.id,
|
||||
id: source?.id ?? "dm",
|
||||
users: {},
|
||||
inviteLink: undefined
|
||||
});
|
||||
|
|
|
|||
|
|
@ -33,18 +33,48 @@ function UsersCollectionRows({ usersCollection }: { usersCollection: Data["users
|
|||
return (
|
||||
<>
|
||||
{Object.entries(usersCollection)
|
||||
.map(([_key, { users, name }]) => ({ name, users: Object.values(users) }))
|
||||
.map(([key, { users, name, id }]) => ({ key, id: id || key, name, users: Object.values(users) }))
|
||||
.sort((a, b) => b.users.length - a.users.length)
|
||||
.map(({ name, users }) => (
|
||||
<aside key={name}>
|
||||
<div className={cl("header-container")}>
|
||||
<HeadingPrimary className={cl("header-name")}>{name}</HeadingPrimary>
|
||||
<div className={cl("header-btns")}>
|
||||
{users.map(u => <UserRow key={u.id} user={u} />)}
|
||||
.map(({ key, id, name, users }) => {
|
||||
const isGuild = key !== "dm" && id !== "dm";
|
||||
return (
|
||||
<aside key={key}>
|
||||
<div className={cl("header-container")}>
|
||||
<HeadingPrimary className={cl("header-name")}>
|
||||
{name}
|
||||
{isGuild && (
|
||||
<span
|
||||
className={cl("header-id")}
|
||||
onContextMenu={e => {
|
||||
e.preventDefault();
|
||||
ContextMenuApi.openContextMenu(e, () => (
|
||||
<Menu.Menu
|
||||
navId="guild-id-context-menu"
|
||||
onClose={ContextMenuApi.closeContextMenu}
|
||||
aria-label="Server Options"
|
||||
>
|
||||
<Menu.MenuItem
|
||||
id="copy-server-id"
|
||||
label="Copy Server ID"
|
||||
action={() => copyWithToast(id, "Server ID copied to clipboard")}
|
||||
/>
|
||||
</Menu.Menu>
|
||||
));
|
||||
}}
|
||||
>
|
||||
<Clickable onClick={() => copyWithToast(id, "Server ID copied to clipboard")}>
|
||||
({id})
|
||||
</Clickable>
|
||||
</span>
|
||||
)}
|
||||
</HeadingPrimary>
|
||||
<div className={cl("header-btns")}>
|
||||
{users.map(u => <UserRow key={u.id} user={u} />)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
))}
|
||||
</aside>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ export default definePlugin({
|
|||
name: "IRememberYou",
|
||||
description: "Locally saves everyone you've been communicating with (including servers), in case of lose",
|
||||
tags: ["Chat", "Servers"],
|
||||
authors: [EquicordDevs.zoodogood, EquicordDevs.keircn],
|
||||
authors: [EquicordDevs.zoodogood, EquicordDevs.keircn, EquicordDevs.tt],
|
||||
dependencies: ["MessageEventsAPI"],
|
||||
|
||||
patches: [],
|
||||
|
|
|
|||
|
|
@ -9,6 +9,19 @@
|
|||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.vc-i-remember-you-header-id {
|
||||
display: inline-block;
|
||||
font-size: 0.8em;
|
||||
font-weight: normal;
|
||||
opacity: 0.75;
|
||||
cursor: pointer;
|
||||
margin-left: 6px;
|
||||
}
|
||||
|
||||
.vc-i-remember-you-header-id:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.vc-i-remember-you-header-btns {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 350px));
|
||||
|
|
|
|||
|
|
@ -777,6 +777,10 @@ export const EquicordDevs = Object.freeze({
|
|||
name: "Balaclava",
|
||||
id: 854886148455399436n
|
||||
},
|
||||
tt: {
|
||||
name: "_.tt",
|
||||
id: 497966466617049089n
|
||||
},
|
||||
dat_insanity: {
|
||||
name: "dat_insanity",
|
||||
id: 0n
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue