From 71fbd6422b4a00607af4d03feee0f4406acdd57d Mon Sep 17 00:00:00 2001
From: Tristan Yang
Date: Tue, 17 Jun 2025 17:53:12 +0800
Subject: [PATCH] feat: onlyAdminCanInvite in blank page
---
package.json | 2 +-
src/app/config.ts | 4 ++--
src/components/BlankPlaceholder.tsx | 20 +++++++++++++-------
3 files changed, 16 insertions(+), 10 deletions(-)
diff --git a/package.json b/package.json
index cfc21226..86a2b991 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "vocechat-web",
- "version": "0.9.7",
+ "version": "0.9.9",
"homepage": "https://voce.chat",
"dependencies": {
"@metamask/onboarding": "^1.0.1",
diff --git a/src/app/config.ts b/src/app/config.ts
index 31f7eae3..1913999a 100644
--- a/src/app/config.ts
+++ b/src/app/config.ts
@@ -12,8 +12,8 @@ const prices: Price[] = [
},
];
const official_dev = `https://dev.voce.chat`;
-// const local_dev = `https://dev.voce.chat`;
-const local_dev = `http://chat.jcdl369.top:3009`;
+const local_dev = `https://dev.voce.chat`;
+// const local_dev = `http://chat.jcdl369.top:3009`;
const dev_origin = process.env.REACT_APP_OFFICIAL_DEMO ? official_dev : local_dev;
// const local_dev = `https://im.ttt.td`;
diff --git a/src/components/BlankPlaceholder.tsx b/src/components/BlankPlaceholder.tsx
index e4cad348..fb760055 100644
--- a/src/components/BlankPlaceholder.tsx
+++ b/src/components/BlankPlaceholder.tsx
@@ -13,6 +13,8 @@ import ChannelModal from "./ChannelModal";
import InviteModal from "./InviteModal";
import UsersModal from "./UsersModal";
import { shallowEqual } from "react-redux";
+import { KEY_ADMIN_ONLY_INVITE } from "../app/config";
+import useServerExtSetting from "../hooks/useServerExtSetting";
interface Props {
type?: "chat" | "user";
@@ -20,9 +22,11 @@ interface Props {
const classes = {
box: "w-[220px] md:w-[200px] h-[100px] md:h-[200px] cursor-pointer bg-gray-50 dark:bg-gray-800 rounded-3xl flex-center flex-col gap-4",
boxIcon: "w-7 h-7 md:w-10 md:h-10",
- boxTip: "px-5 text-xs md:text-sm text-slate-600 dark:text-gray-100 font-bold text-center"
+ boxTip: "px-5 text-xs md:text-sm text-slate-600 dark:text-gray-100 font-bold text-center",
};
const BlankPlaceholder: FC = ({ type = "chat" }) => {
+ const { getExtSetting } = useServerExtSetting();
+ const onlyAdminCanInvite = getExtSetting(KEY_ADMIN_ONLY_INVITE);
const { t } = useTranslation("welcome");
const server = useAppSelector((store) => store.server, shallowEqual);
const isAdmin = useAppSelector((store) => store.authData.user?.is_admin, shallowEqual);
@@ -64,8 +68,8 @@ const BlankPlaceholder: FC = ({ type = "chat" }) => {
>
);
- }
- }
+ },
+ },
}}
>
{server.description ? server.description : t("desc")}
@@ -81,10 +85,12 @@ const BlankPlaceholder: FC = ({ type = "chat" }) => {
-
+ {(isAdmin || !onlyAdminCanInvite) && (
+
+ )}