mirror of
https://github.com/revoltchat/revite.git
synced 2025-02-22 00:00:56 -05:00
feat: port CreateCategory
/ fix Channel
This commit is contained in:
parent
29fb8e0064
commit
f7ff7d0dfe
5 changed files with 55 additions and 6 deletions
|
@ -73,7 +73,7 @@
|
||||||
"@hcaptcha/react-hcaptcha": "^0.3.6",
|
"@hcaptcha/react-hcaptcha": "^0.3.6",
|
||||||
"@insertish/vite-plugin-babel-macros": "^1.0.5",
|
"@insertish/vite-plugin-babel-macros": "^1.0.5",
|
||||||
"@preact/preset-vite": "^2.0.0",
|
"@preact/preset-vite": "^2.0.0",
|
||||||
"@revoltchat/ui": "1.0.63",
|
"@revoltchat/ui": "1.0.65",
|
||||||
"@rollup/plugin-replace": "^2.4.2",
|
"@rollup/plugin-replace": "^2.4.2",
|
||||||
"@styled-icons/boxicons-logos": "^10.38.0",
|
"@styled-icons/boxicons-logos": "^10.38.0",
|
||||||
"@styled-icons/boxicons-regular": "^10.38.0",
|
"@styled-icons/boxicons-regular": "^10.38.0",
|
||||||
|
|
|
@ -21,6 +21,7 @@ import Changelog from "./components/Changelog";
|
||||||
import ChannelInfo from "./components/ChannelInfo";
|
import ChannelInfo from "./components/ChannelInfo";
|
||||||
import Clipboard from "./components/Clipboard";
|
import Clipboard from "./components/Clipboard";
|
||||||
import Confirmation from "./components/Confirmation";
|
import Confirmation from "./components/Confirmation";
|
||||||
|
import CreateCategory from "./components/CreateCategory";
|
||||||
import CreateChannel from "./components/CreateChannel";
|
import CreateChannel from "./components/CreateChannel";
|
||||||
import CreateGroup from "./components/CreateGroup";
|
import CreateGroup from "./components/CreateGroup";
|
||||||
import CreateInvite from "./components/CreateInvite";
|
import CreateInvite from "./components/CreateInvite";
|
||||||
|
@ -251,6 +252,7 @@ export const modalController = new ModalControllerExtended({
|
||||||
delete_bot: Confirmation,
|
delete_bot: Confirmation,
|
||||||
block_user: Confirmation,
|
block_user: Confirmation,
|
||||||
unfriend_user: Confirmation,
|
unfriend_user: Confirmation,
|
||||||
|
create_category: CreateCategory,
|
||||||
create_channel: CreateChannel,
|
create_channel: CreateChannel,
|
||||||
create_group: CreateGroup,
|
create_group: CreateGroup,
|
||||||
create_invite: CreateInvite,
|
create_invite: CreateInvite,
|
||||||
|
|
44
src/controllers/modals/components/CreateCategory.tsx
Normal file
44
src/controllers/modals/components/CreateCategory.tsx
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
import { ulid } from "ulid";
|
||||||
|
|
||||||
|
import { Text } from "preact-i18n";
|
||||||
|
|
||||||
|
import { ModalForm } from "@revoltchat/ui";
|
||||||
|
|
||||||
|
import { ModalProps } from "../types";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Category creation modal
|
||||||
|
*/
|
||||||
|
export default function CreateCategory({
|
||||||
|
target,
|
||||||
|
...props
|
||||||
|
}: ModalProps<"create_category">) {
|
||||||
|
return (
|
||||||
|
<ModalForm
|
||||||
|
{...props}
|
||||||
|
title={<Text id="app.context_menu.create_category" />}
|
||||||
|
schema={{
|
||||||
|
name: "text",
|
||||||
|
}}
|
||||||
|
data={{
|
||||||
|
name: {
|
||||||
|
field: (
|
||||||
|
<Text id="app.main.servers.channel_name" />
|
||||||
|
) as React.ReactChild,
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
callback={async ({ name }) => {
|
||||||
|
await target.edit({
|
||||||
|
categories: [
|
||||||
|
...(target.categories ?? []),
|
||||||
|
{
|
||||||
|
id: ulid(),
|
||||||
|
title: name,
|
||||||
|
channels: [],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
|
@ -50,6 +50,9 @@ export default function CreateChannel({
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
|
defaults={{
|
||||||
|
type: "Text",
|
||||||
|
}}
|
||||||
callback={async ({ name, type }) => {
|
callback={async ({ name, type }) => {
|
||||||
const channel = await target.createChannel({
|
const channel = await target.createChannel({
|
||||||
type: type as "Text" | "Voice",
|
type: type as "Text" | "Voice",
|
||||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -2231,9 +2231,9 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"@revoltchat/ui@npm:1.0.63":
|
"@revoltchat/ui@npm:1.0.65":
|
||||||
version: 1.0.63
|
version: 1.0.65
|
||||||
resolution: "@revoltchat/ui@npm:1.0.63"
|
resolution: "@revoltchat/ui@npm:1.0.65"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@styled-icons/boxicons-logos": ^10.38.0
|
"@styled-icons/boxicons-logos": ^10.38.0
|
||||||
"@styled-icons/boxicons-regular": ^10.38.0
|
"@styled-icons/boxicons-regular": ^10.38.0
|
||||||
|
@ -2247,7 +2247,7 @@ __metadata:
|
||||||
react-virtuoso: ^2.12.0
|
react-virtuoso: ^2.12.0
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
revolt.js: "*"
|
revolt.js: "*"
|
||||||
checksum: 4e785798d31b503bb7777da7661656cbbeb17734257aa4578357e6acf2d053abeb40e406f1e04c7b1338822260d5614ffb8262cb64ae95ce3b1c7edda0c2125b
|
checksum: 34a52672aa3aca1c62d884c62f2c85c0100b6adb21b7d01053e74e96cfa95cb76f125e1ca1f46afc586a8730b273746486525199f66969338e6c84ab1f21e7cd
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
@ -3554,7 +3554,7 @@ __metadata:
|
||||||
"@hcaptcha/react-hcaptcha": ^0.3.6
|
"@hcaptcha/react-hcaptcha": ^0.3.6
|
||||||
"@insertish/vite-plugin-babel-macros": ^1.0.5
|
"@insertish/vite-plugin-babel-macros": ^1.0.5
|
||||||
"@preact/preset-vite": ^2.0.0
|
"@preact/preset-vite": ^2.0.0
|
||||||
"@revoltchat/ui": 1.0.63
|
"@revoltchat/ui": 1.0.65
|
||||||
"@rollup/plugin-replace": ^2.4.2
|
"@rollup/plugin-replace": ^2.4.2
|
||||||
"@styled-icons/boxicons-logos": ^10.38.0
|
"@styled-icons/boxicons-logos": ^10.38.0
|
||||||
"@styled-icons/boxicons-regular": ^10.38.0
|
"@styled-icons/boxicons-regular": ^10.38.0
|
||||||
|
|
Loading…
Add table
Reference in a new issue