我的应用
-
+
@@ -123,7 +123,7 @@ export default async function DashboardPage() {
-
+
diff --git a/src/components/admin/client-status-toggle.tsx b/src/components/admin/client-status-toggle.tsx
index 96f70b7..50b456c 100644
--- a/src/components/admin/client-status-toggle.tsx
+++ b/src/components/admin/client-status-toggle.tsx
@@ -15,8 +15,8 @@ import {
AlertDialogHeader,
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
-import { Badge } from "@/components/ui/badge";
-import { Button } from "@/components/ui/button";
+import { Label } from "@/components/ui/label";
+import { Switch } from "@/components/ui/switch";
interface ClientStatusToggleProps {
client: Client | ExtendedClient;
@@ -26,6 +26,7 @@ export function ClientStatusToggle({ client }: ClientStatusToggleProps) {
const router = useRouter();
const [isLoading, setIsLoading] = useState(false);
const [showDialog, setShowDialog] = useState(false);
+ const [pendingState, setPendingState] = useState
(null);
const handleToggle = async () => {
try {
@@ -36,7 +37,7 @@ export function ClientStatusToggle({ client }: ClientStatusToggleProps) {
"Content-Type": "application/json",
},
body: JSON.stringify({
- enabled: !client.enabled,
+ enabled: pendingState,
}),
});
@@ -50,43 +51,53 @@ export function ClientStatusToggle({ client }: ClientStatusToggleProps) {
} finally {
setIsLoading(false);
setShowDialog(false);
+ setPendingState(null);
}
};
return (
- <>
- setShowDialog(true)}
- >
- {client.enabled ? "启用" : "禁用"}
-
+
+
{
+ setPendingState(checked);
+ setShowDialog(true);
+ }}
+ />
+
- 确定要{client.enabled ? "禁用" : "启用"}该应用吗?
+ 确定要{pendingState ? "启用" : "禁用"}该应用吗?
- {client.enabled
- ? "禁用后,该应用将无法使用 OAuth 服务,所有已授权的用户将无法访问。"
- : "启用后,该应用将恢复使用 OAuth 服务的权限。"}
+ {pendingState
+ ? "启用后,该应用将恢复使用 OAuth 服务的权限。"
+ : "禁用后,该应用将无法使用 OAuth 服务,所有已授权的用户将无法访问。"}
- 取消
+ setPendingState(null)}
+ >
+ 取消
+
确定
- >
+
);
}
diff --git a/src/components/clients/edit-client.tsx b/src/components/clients/edit-client.tsx
index 2200f53..332337f 100644
--- a/src/components/clients/edit-client.tsx
+++ b/src/components/clients/edit-client.tsx
@@ -160,11 +160,14 @@ export function EditClientForm({ client }: EditClientFormProps) {
允许登录的用户
-
+
留空表示允许所有 Q58
- 论坛用户登录。如需限制,请输入用户名列表,用逗号分隔。
+ 论坛用户登录。如需限制,请输入用户名列表(注意:必须是用户名,不是显示名称),用逗号分隔。
diff --git a/src/components/ui/switch.tsx b/src/components/ui/switch.tsx
index b73edee..8fbbe90 100644
--- a/src/components/ui/switch.tsx
+++ b/src/components/ui/switch.tsx
@@ -11,7 +11,7 @@ const Switch = React.forwardRef<
>(({ className, ...props }, ref) => (