mirror of
https://github.com/JetSprow/J-Board-Lite.git
synced 2026-05-01 01:14:10 +05:30
merge main into dev
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent } from "@/components/ui/card";
|
||||
import { getErrorMessage } from "@/lib/errors";
|
||||
|
||||
export default function AdminError({
|
||||
error,
|
||||
@@ -10,13 +11,18 @@ export default function AdminError({
|
||||
error: Error & { digest?: string };
|
||||
reset: () => void;
|
||||
}) {
|
||||
const message = getErrorMessage(error, "管理后台页面加载失败");
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-[60vh]">
|
||||
<Card className="w-full max-w-md">
|
||||
<CardContent className="py-10 text-center space-y-5">
|
||||
<h1 className="text-xl font-semibold tracking-tight">出了点问题</h1>
|
||||
<p className="text-sm text-destructive">
|
||||
{error.message || "页面加载失败,请稍后重试。"}
|
||||
<p className="text-sm leading-6 text-destructive break-words">
|
||||
{message}
|
||||
</p>
|
||||
<p className="text-xs leading-5 text-muted-foreground">
|
||||
如果重试后仍失败,请复制上面的错误详情给管理员排查。
|
||||
</p>
|
||||
<Button onClick={reset} className="h-10">重试</Button>
|
||||
</CardContent>
|
||||
|
||||
@@ -72,7 +72,7 @@ export function NodeActions({ node, siteUrl }: { node: NodeActionValue; siteUrl:
|
||||
try {
|
||||
const res = await testNodeConnection(node.id);
|
||||
if (res.success) toast.success(res.message);
|
||||
else toast.error(res.message);
|
||||
else toast.error(getErrorMessage(res.message, "节点测试失败"));
|
||||
} catch (error) {
|
||||
toast.error(getErrorMessage(error, "测试失败"));
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Button } from "@/components/ui/button";
|
||||
import { ConfirmActionButton } from "@/components/shared/confirm-action-button";
|
||||
import { deletePlanPermanently, togglePlan } from "@/actions/admin/plans";
|
||||
import { toast } from "sonner";
|
||||
import { getErrorMessage } from "@/lib/errors";
|
||||
import {
|
||||
PlanForm,
|
||||
type PlanFormValue,
|
||||
@@ -39,8 +40,7 @@ export function PlanActions({
|
||||
toast.success(isActive ? "套餐已下架" : "套餐已上架");
|
||||
router.refresh();
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : "切换失败";
|
||||
toast.error(message);
|
||||
toast.error(getErrorMessage(error, "切换套餐上下架状态失败"));
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -69,7 +69,7 @@ export function SettingsForm({ config, coupons }: { config: AppConfig; coupons:
|
||||
try {
|
||||
const result = await saveAppSettings(new FormData(form));
|
||||
if (!result.ok) {
|
||||
toast.error(result.error);
|
||||
toast.error(getErrorMessage(result.error, "保存设置失败"));
|
||||
return;
|
||||
}
|
||||
clearPasswordField(form);
|
||||
@@ -96,8 +96,8 @@ export function SettingsForm({ config, coupons }: { config: AppConfig; coupons:
|
||||
}
|
||||
toast.error(
|
||||
result.settingsSaved
|
||||
? `设置已保存,但测试邮件没有发出:${result.error}`
|
||||
: result.error,
|
||||
? `设置已保存,但测试邮件没有发出:${getErrorMessage(result.error, "测试邮件发送失败")}`
|
||||
: getErrorMessage(result.error, "测试邮件发送失败"),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -360,7 +360,7 @@ export function SettingsForm({ config, coupons }: { config: AppConfig; coupons:
|
||||
<option value="false">关闭</option>
|
||||
<option value="true">开启,注册后必须验证邮箱</option>
|
||||
</select>
|
||||
<p className="text-xs leading-5 text-muted-foreground">开启后,新用户注册会先收到验证邮件,完成验证后才能登录。</p>
|
||||
<p className="text-xs leading-5 text-muted-foreground">开启后,新用户注册会先收到验证邮件,完成验证后才能登录;关闭后注册成功即可登录。</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user