diff --git a/package.json b/package.json
index 5cf1afb3..ddc93912 100644
--- a/package.json
+++ b/package.json
@@ -73,7 +73,7 @@
"@hcaptcha/react-hcaptcha": "^0.3.6",
"@insertish/vite-plugin-babel-macros": "^1.0.5",
"@preact/preset-vite": "^2.0.0",
- "@revoltchat/ui": "1.0.63",
+ "@revoltchat/ui": "1.0.65",
"@rollup/plugin-replace": "^2.4.2",
"@styled-icons/boxicons-logos": "^10.38.0",
"@styled-icons/boxicons-regular": "^10.38.0",
diff --git a/src/controllers/modals/ModalController.tsx b/src/controllers/modals/ModalController.tsx
index cbb0dbb9..b2667f98 100644
--- a/src/controllers/modals/ModalController.tsx
+++ b/src/controllers/modals/ModalController.tsx
@@ -21,6 +21,7 @@ import Changelog from "./components/Changelog";
import ChannelInfo from "./components/ChannelInfo";
import Clipboard from "./components/Clipboard";
import Confirmation from "./components/Confirmation";
+import CreateCategory from "./components/CreateCategory";
import CreateChannel from "./components/CreateChannel";
import CreateGroup from "./components/CreateGroup";
import CreateInvite from "./components/CreateInvite";
@@ -251,6 +252,7 @@ export const modalController = new ModalControllerExtended({
delete_bot: Confirmation,
block_user: Confirmation,
unfriend_user: Confirmation,
+ create_category: CreateCategory,
create_channel: CreateChannel,
create_group: CreateGroup,
create_invite: CreateInvite,
diff --git a/src/controllers/modals/components/CreateCategory.tsx b/src/controllers/modals/components/CreateCategory.tsx
new file mode 100644
index 00000000..23cf7298
--- /dev/null
+++ b/src/controllers/modals/components/CreateCategory.tsx
@@ -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 (
+ }
+ schema={{
+ name: "text",
+ }}
+ data={{
+ name: {
+ field: (
+
+ ) as React.ReactChild,
+ },
+ }}
+ callback={async ({ name }) => {
+ await target.edit({
+ categories: [
+ ...(target.categories ?? []),
+ {
+ id: ulid(),
+ title: name,
+ channels: [],
+ },
+ ],
+ });
+ }}
+ />
+ );
+}
diff --git a/src/controllers/modals/components/CreateChannel.tsx b/src/controllers/modals/components/CreateChannel.tsx
index 14d2e696..c9ffbdad 100644
--- a/src/controllers/modals/components/CreateChannel.tsx
+++ b/src/controllers/modals/components/CreateChannel.tsx
@@ -50,6 +50,9 @@ export default function CreateChannel({
],
},
}}
+ defaults={{
+ type: "Text",
+ }}
callback={async ({ name, type }) => {
const channel = await target.createChannel({
type: type as "Text" | "Voice",
diff --git a/yarn.lock b/yarn.lock
index 621d8370..5d8aca1b 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2231,9 +2231,9 @@ __metadata:
languageName: node
linkType: hard
-"@revoltchat/ui@npm:1.0.63":
- version: 1.0.63
- resolution: "@revoltchat/ui@npm:1.0.63"
+"@revoltchat/ui@npm:1.0.65":
+ version: 1.0.65
+ resolution: "@revoltchat/ui@npm:1.0.65"
dependencies:
"@styled-icons/boxicons-logos": ^10.38.0
"@styled-icons/boxicons-regular": ^10.38.0
@@ -2247,7 +2247,7 @@ __metadata:
react-virtuoso: ^2.12.0
peerDependencies:
revolt.js: "*"
- checksum: 4e785798d31b503bb7777da7661656cbbeb17734257aa4578357e6acf2d053abeb40e406f1e04c7b1338822260d5614ffb8262cb64ae95ce3b1c7edda0c2125b
+ checksum: 34a52672aa3aca1c62d884c62f2c85c0100b6adb21b7d01053e74e96cfa95cb76f125e1ca1f46afc586a8730b273746486525199f66969338e6c84ab1f21e7cd
languageName: node
linkType: hard
@@ -3554,7 +3554,7 @@ __metadata:
"@hcaptcha/react-hcaptcha": ^0.3.6
"@insertish/vite-plugin-babel-macros": ^1.0.5
"@preact/preset-vite": ^2.0.0
- "@revoltchat/ui": 1.0.63
+ "@revoltchat/ui": 1.0.65
"@rollup/plugin-replace": ^2.4.2
"@styled-icons/boxicons-logos": ^10.38.0
"@styled-icons/boxicons-regular": ^10.38.0