Skip to content

Commit

Permalink
fix: overview error
Browse files Browse the repository at this point in the history
  • Loading branch information
hamster1963 committed Oct 19, 2024
1 parent 3ac6124 commit 1c71d37
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
18 changes: 17 additions & 1 deletion app/[locale]/(main)/ClientComponents/ServerOverviewClient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,24 @@ import useSWR from "swr";

export default function ServerOverviewClient() {
const t = useTranslations("ServerOverviewClient");
const { data } = useSWR<ServerApi>("/api/server", nezhaFetcher);
const { data, error } = useSWR<ServerApi>("/api/server", nezhaFetcher);
const disableCartoon = getEnv("NEXT_PUBLIC_DisableCartoon") === "true";

if (error)
return (
<div className="flex flex-col items-center justify-center">
<p className="text-sm font-medium opacity-40">{error.message}</p>
<p className="text-sm font-medium opacity-40">{t("error_message")}</p>
</div>
);

if (!data?.result)
return (
<div className="flex flex-col items-center justify-center">
<p className="text-sm font-medium opacity-40">{t("no_data_message")}</p>
</div>
);

return (
<section className="grid grid-cols-2 gap-4 lg:grid-cols-4">
<Card>
Expand Down
4 changes: 3 additions & 1 deletion messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"p_816-881_Totalservers": "Total servers",
"p_1610-1676_Onlineservers": "Online servers",
"p_2532-2599_Offlineservers": "Offline servers",
"p_3463-3530_Totalbandwidth": "Total bandwidth"
"p_3463-3530_Totalbandwidth": "Total bandwidth",
"error_message": "Please check your environment variables and review the server console",
"no_data_message": "No data"
},
"ServerListClient": {
"error_message": "Please check your environment variables and review the server console",
Expand Down
4 changes: 3 additions & 1 deletion messages/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"p_816-881_Totalservers": "サーバーの総数",
"p_1610-1676_Onlineservers": "オンラインサーバー",
"p_2532-2599_Offlineservers": "オフラインサーバー",
"p_3463-3530_Totalbandwidth": "総流量"
"p_3463-3530_Totalbandwidth": "総流量",
"error_message": "環境変数を確認し、サーバーコンソールを確認してください",
"no_data_message": "データなし"
},
"ServerListClient": {
"error_message": "環境変数を確認し、サーバーコンソールを確認してください",
Expand Down
4 changes: 3 additions & 1 deletion messages/zh-t.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"p_816-881_Totalservers": "伺服器總數",
"p_1610-1676_Onlineservers": "在線伺服器",
"p_2532-2599_Offlineservers": "離線伺服器",
"p_3463-3530_Totalbandwidth": "總流量"
"p_3463-3530_Totalbandwidth": "總流量",
"error_message": "請檢查您的環境變數並檢查伺服器控制台",
"no_data_message": "無資料"
},
"ServerListClient": {
"error_message": "請檢查您的環境變數並檢查伺服器控制台",
Expand Down
4 changes: 3 additions & 1 deletion messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
"p_816-881_Totalservers": "服务器总数",
"p_1610-1676_Onlineservers": "在线服务器",
"p_2532-2599_Offlineservers": "离线服务器",
"p_3463-3530_Totalbandwidth": "总流量"
"p_3463-3530_Totalbandwidth": "总流量",
"error_message": "请检查您的环境变量并检查服务器控制台",
"no_data_message": "无数据"
},
"ServerListClient": {
"error_message": "请检查您的环境变量并检查服务器控制台",
Expand Down

0 comments on commit 1c71d37

Please sign in to comment.