Skip to content

Commit

Permalink
feat: new permissions menus
Browse files Browse the repository at this point in the history
closes #322
  • Loading branch information
insertish committed Apr 22, 2022
1 parent 4aad049 commit eee1d40
Show file tree
Hide file tree
Showing 41 changed files with 9,788 additions and 5,811 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ dist-ssr
*.log
/.idea

.yarn/cache
.yarn/install-state.gz

public/assets
public/assets_*
!public/assets_default
Expand Down
546 changes: 546 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-typescript.cjs

Large diffs are not rendered by default.

785 changes: 785 additions & 0 deletions .yarn/releases/yarn-3.2.0.cjs

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: "@yarnpkg/plugin-typescript"

yarnPath: .yarn/releases/yarn-3.2.0.cjs
2 changes: 1 addition & 1 deletion external/lang
Submodule lang updated 81 files
+200 −0 Languages.ts
+145 −91 ang.json
+795 −737 ar.json
+788 −792 az.json
+787 −719 be.json
+788 −774 bg.json
+733 −737 bn.json
+1 −1 bottom.json
+793 −790 br.json
+788 −787 ca.json
+183 −183 [email protected]
+793 −0 ckb.json
+784 −700 cs.json
+222 −222 cy.json
+740 −740 da.json
+816 −809 de.json
+248 −192 de_CH.json
+799 −739 el.json
+117 −75 en.json
+788 −774 en_US.json
+1 −1 enchantment.json
+196 −196 enm.json
+755 −756 eo.json
+814 −811 es.json
+770 −774 et.json
+727 −731 eu.json
+788 −774 fa.json
+804 −784 fi.json
+788 −774 fil.json
+814 −811 fr.json
+707 −423 frm.json
+771 −774 ga.json
+28 −28 got.json
+787 −731 he.json
+611 −484 hi.json
+784 −759 hr.json
+815 −812 hu.json
+788 −787 id.json
+793 −779 it.json
+794 −791 ja.json
+794 −791 ko.json
+173 −170 la.json
+490 −490 lb.json
+1 −1 leet.json
+81 −81 li.json
+811 −810 lt.json
+794 −315 lv.json
+131 −131 mk.json
+94 −94 ml.json
+713 −717 ms.json
+29 −0 mt.json
+787 −718 nb_NO.json
+810 −803 nl.json
+816 −804 owo.json
+504 −445 peo.json
+801 −751 piglatin.json
+817 −810 pl.json
+433 −371 pr.json
+810 −807 pt_BR.json
+794 −787 pt_PT.json
+41 −0 restructurize.ts
+807 −806 ro.json
+713 −717 ro_MD.json
+821 −814 ru.json
+588 −592 si.json
+768 −772 sk.json
+418 −422 sl.json
+511 −486 sq.json
+770 −774 sr.json
+811 −779 sv.json
+404 −404 ta.json
+135 −135 te.json
+794 −739 th.json
+15 −8 tlh-qaak.json
+611 −611 tokipona.json
+814 −807 tr.json
+814 −807 uk.json
+78 −0 vec.json
+793 −718 vi.json
+807 −804 zh_Hans.json
+788 −774 zh_Hant.json
17 changes: 9 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
"dependencies": {
"@fontsource/bitter": "^4.5.0",
"@insertish/vite-plugin-babel-macros": "^1.0.5",
"color-rgba": "^2.3.0",
"fs-extra": "^10.0.0",
"klaw": "^3.0.0",
"react-beautiful-dnd": "^13.1.0",
Expand Down Expand Up @@ -90,16 +89,16 @@
"@fontsource/ubuntu-mono": "^4.4.5",
"@hcaptcha/react-hcaptcha": "^0.3.6",
"@preact/preset-vite": "^2.0.0",
"@revoltchat/ui": "1.0.27",
"@rollup/plugin-replace": "^2.4.2",
"@styled-icons/boxicons-logos": "^10.34.0",
"@styled-icons/boxicons-regular": "^10.34.0",
"@styled-icons/boxicons-solid": "^10.37.0",
"@styled-icons/boxicons-logos": "^10.38.0",
"@styled-icons/boxicons-regular": "^10.38.0",
"@styled-icons/boxicons-solid": "^10.38.0",
"@styled-icons/simple-icons": "^10.33.0",
"@tippyjs/react": "^4.2.5",
"@traptitech/markdown-it-katex": "^3.4.3",
"@traptitech/markdown-it-spoiler": "^1.1.6",
"@trivago/prettier-plugin-sort-imports": "^2.0.2",
"@types/color-rgba": "^2.1.0",
"@types/lodash.defaultsdeep": "^4.6.6",
"@types/lodash.isequal": "^4.5.5",
"@types/markdown-it": "^12.0.2",
Expand All @@ -116,6 +115,7 @@
"@typescript-eslint/eslint-plugin": "^4.27.0",
"@typescript-eslint/parser": "^4.27.0",
"classnames": "^2.3.1",
"color-rgba": "^2.4.0",
"dayjs": "^1.10.6",
"detect-browser": "^5.2.0",
"eslint": "^7.28.0",
Expand All @@ -133,7 +133,7 @@
"markdown-it-sup": "^1.0.0",
"mediasoup-client": "npm:@insertish/[email protected]",
"mobx": "^6.3.2",
"mobx-react-lite": "^3.2.0",
"mobx-react-lite": "^3.3.0",
"preact": "^10.5.14",
"preact-context-menu": "^0.2.1",
"preact-i18n": "^2.4.0-preactx",
Expand All @@ -147,7 +147,7 @@
"react-scroll": "^1.8.2",
"react-virtualized-auto-sizer": "^1.0.5",
"react-virtuoso": "^1.10.4",
"revolt.js": "6.0.0-rc.13",
"revolt.js": "6.0.0-rc.15",
"rimraf": "^3.0.2",
"sass": "^1.35.1",
"shade-blend-color": "^1.0.0",
Expand All @@ -163,5 +163,6 @@
"main": "index.js",
"repository": "https://github.com/revoltchat/revite.git",
"author": "Paul <[email protected]>",
"license": "MIT"
"license": "MIT",
"packageManager": "[email protected]"
}
2 changes: 1 addition & 1 deletion src/components/common/IconBase.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { API } from "revolt.js";
import { Nullable } from "revolt.js/dist/util/null";
import { Nullable } from "revolt.js/esm/util/null";
import styled, { css } from "styled-components/macro";

export interface IconBaseProps<T> {
Expand Down
79 changes: 0 additions & 79 deletions src/components/settings/roles/OverrideSwitch.tsx

This file was deleted.

11 changes: 10 additions & 1 deletion src/components/settings/roles/PermissionList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ export function PermissionList({ value, onChange, filter }: Props) {
{(Object.keys(Permission) as (keyof typeof Permission)[])
.filter(
(key) =>
key !== "GrantAllSafe" &&
![
"GrantAllSafe",
"TimeoutMembers",
"ReadMessageHistory",
"Speak",
"Video",
"MuteMembers",
"DeafenMembers",
"MoveMembers",
].includes(key) &&
(!filter || filter.includes(key)),
)
.map((x) => (
Expand Down
8 changes: 4 additions & 4 deletions src/components/settings/roles/PermissionSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import { Text } from "preact-i18n";
import { useMemo } from "preact/hooks";

import Checkbox from "../../ui/Checkbox";

import { OverrideSwitch } from "./OverrideSwitch";
import { OverrideSwitch } from "@revoltchat/ui";

interface PermissionSelectProps {
id: keyof typeof Permission;
Expand All @@ -20,6 +19,7 @@ interface PermissionSelectProps {
type State = "Allow" | "Neutral" | "Deny";

const PermissionEntry = styled.label`
gap: 8px;
width: 100%;
margin: 8px 0;
display: flex;
Expand Down Expand Up @@ -100,9 +100,9 @@ export function PermissionSelect({
return (
<PermissionEntry>
<span class="title">
<Text id={`permissions.server.${id}.t`}>{id}</Text>
<Text id={`permissions.${id}.t`}>{id}</Text>
<span class="description">
<Text id={`permissions.server.${id}.d`} />
<Text id={`permissions.${id}.d`} />
</span>
</span>
{typeof value === "object" ? (
Expand Down
12 changes: 12 additions & 0 deletions src/components/settings/roles/RoleSelection.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { API } from "revolt.js";

export type RoleOrDefault = (
| API.Role
| {
name: string;
permissions: number;
colour?: string;
hoist?: boolean;
rank?: number;
}
) & { id: string };
35 changes: 0 additions & 35 deletions src/components/settings/roles/RoleSelection.tsx

This file was deleted.

22 changes: 0 additions & 22 deletions src/components/settings/roles/UnsavedChanges.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/context/revoltjs/SyncManager.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* This file monitors changes to settings and syncs them to the server.
*/
import { ClientboundNotification } from "revolt.js/dist/websocket/notifications";
import { ClientboundNotification } from "revolt.js/esm/websocket/notifications";

import { useEffect } from "preact/hooks";

Expand Down
2 changes: 1 addition & 1 deletion src/lib/ContextMenus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
import { Cog, UserVoice } from "@styled-icons/boxicons-solid";
import { useHistory } from "react-router-dom";
import { Channel, Message, Server, User, API } from "revolt.js";
import { Permission, UserPermission } from "revolt.js/dist/api/permissions";
import { Permission, UserPermission } from "revolt.js/esm/api/permissions";

import {
ContextMenuWithData,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/contextmenu/CMNotifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
LeftArrowAlt,
} from "@styled-icons/boxicons-regular";
import { observer } from "mobx-react-lite";
import { Channel } from "revolt.js/dist/maps/Channels";
import { Server } from "revolt.js/dist/maps/Servers";
import { Channel } from "revolt.js/esm/maps/Channels";
import { Server } from "revolt.js/esm/maps/Servers";

import { ContextMenuWithData, MenuItem } from "preact-context-menu";
import { Text } from "preact-i18n";
Expand Down
6 changes: 3 additions & 3 deletions src/lib/renderer/Singleton.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable react-hooks/rules-of-hooks */
import { action, makeAutoObservable } from "mobx";
import { Channel } from "revolt.js/dist/maps/Channels";
import { Message } from "revolt.js/dist/maps/Messages";
import { Nullable } from "revolt.js/dist/util/null";
import { Channel } from "revolt.js/esm/maps/Channels";
import { Message } from "revolt.js/esm/maps/Messages";
import { Nullable } from "revolt.js/esm/util/null";

import { SimpleRenderer } from "./simple/SimpleRenderer";
import { RendererRoutines, ScrollState } from "./types";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/renderer/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Message } from "revolt.js/dist/maps/Messages";
import { Message } from "revolt.js/esm/maps/Messages";

import { ChannelRenderer } from "./Singleton";

Expand Down
4 changes: 2 additions & 2 deletions src/lib/vortex/VoiceState.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { action, makeAutoObservable, runInAction } from "mobx";
import { Channel } from "revolt.js/dist/maps/Channels";
import { Nullable, toNullable } from "revolt.js/dist/util/null";
import { Channel } from "revolt.js/esm/maps/Channels";
import { Nullable, toNullable } from "revolt.js/esm/util/null";

import type { ProduceType, VoiceUser } from "./Types";
import type VoiceClient from "./VoiceClient";
Expand Down
2 changes: 1 addition & 1 deletion src/mobx/stores/Auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { action, computed, makeAutoObservable, ObservableMap } from "mobx";
import { API } from "revolt.js";
import { Nullable } from "revolt.js/dist/util/null";
import { Nullable } from "revolt.js/esm/util/null";

import { mapToRecord } from "../../lib/conversion";

Expand Down
6 changes: 3 additions & 3 deletions src/mobx/stores/NotificationOptions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { action, computed, makeAutoObservable, ObservableMap } from "mobx";
import { Channel } from "revolt.js/dist/maps/Channels";
import { Message } from "revolt.js/dist/maps/Messages";
import { Server } from "revolt.js/dist/maps/Servers";
import { Channel } from "revolt.js/esm/maps/Channels";
import { Message } from "revolt.js/esm/maps/Messages";
import { Server } from "revolt.js/esm/maps/Servers";

import { mapToRecord } from "../../lib/conversion";

Expand Down
2 changes: 1 addition & 1 deletion src/mobx/stores/ServerConfig.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { action, computed, makeAutoObservable } from "mobx";
import { API } from "revolt.js";
import { Client } from "revolt.js";
import { Nullable } from "revolt.js/dist/util/null";
import { Nullable } from "revolt.js/esm/util/null";

import { isDebug } from "../../revision";
import Persistent from "../interfaces/Persistent";
Expand Down
2 changes: 1 addition & 1 deletion src/pages/channels/Channel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Ghost } from "@styled-icons/boxicons-solid";
import { reaction } from "mobx";
import { observer } from "mobx-react-lite";
import { Redirect, useParams } from "react-router-dom";
import { Channel as ChannelI } from "revolt.js/dist/maps/Channels";
import { Channel as ChannelI } from "revolt.js/esm/maps/Channels";
import styled from "styled-components/macro";

import { Text } from "preact-i18n";
Expand Down
4 changes: 2 additions & 2 deletions src/pages/channels/ChannelHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
} from "@styled-icons/boxicons-regular";
import { Notepad, Group } from "@styled-icons/boxicons-solid";
import { observer } from "mobx-react-lite";
import { Channel } from "revolt.js/dist/maps/Channels";
import { User } from "revolt.js/dist/maps/Users";
import { Channel } from "revolt.js/esm/maps/Channels";
import { User } from "revolt.js/esm/maps/Users";
import styled, { css } from "styled-components/macro";

import { isTouchscreenDevice } from "../../lib/isTouchscreenDevice";
Expand Down
Loading

2 comments on commit eee1d40

@insertish
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

**** Actually closes #578

@sussycatgirl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Please sign in to comment.