feat: show role id

This commit is contained in:
Ed L 2022-09-10 20:16:36 +01:00 committed by Paul Makles
parent d2264a2a43
commit 099f7a3116

View file

@ -1,6 +1,8 @@
import { HelpCircle } from "@styled-icons/boxicons-solid";
import isEqual from "lodash.isequal";
import { observer } from "mobx-react-lite";
import { Server } from "revolt.js";
import styled from "styled-components";
import { Text } from "preact-i18n";
import { useMemo, useState } from "preact/hooks";
@ -16,6 +18,7 @@ import {
Category,
} from "@revoltchat/ui";
import Tooltip from "../../../components/common/Tooltip";
import { PermissionList } from "../../../components/settings/roles/PermissionList";
import { RoleOrDefault } from "../../../components/settings/roles/RoleSelection";
import { modalController } from "../../../controllers/modals/ModalController";
@ -53,6 +56,20 @@ export const Roles = observer(({ server }: Props) => {
// Consolidate all permissions that we can change right now.
const currentRoles = useRoles(server);
const RoleId = styled.div`
gap: 4px;
display: flex;
align-items: center;
font-size: 12px;
font-weight: 600;
color: var(--tertiary-foreground);
a {
color: var(--tertiary-foreground);
}
`;
return (
<PermissionsLayout
server={server}
@ -147,6 +164,30 @@ export const Roles = observer(({ server }: Props) => {
/>
</p>
</section>
<section>
<Category>{"Role ID"}</Category>
<RoleId>
<Tooltip
content={
"This is a unique identifier for this role."
}>
<HelpCircle size={16} />
</Tooltip>
<Tooltip
content={
<Text id="app.special.copy" />
}>
<a
onClick={() =>
modalController.writeText(
currentRole.id,
)
}>
{currentRole.id}
</a>
</Tooltip>
</RoleId>
</section>
<section>
<Category>
<Text id="app.settings.permissions.role_colour" />