Skip to content

Commit

Permalink
fix(overview): text display
Browse files Browse the repository at this point in the history
  • Loading branch information
hamster1963 committed Dec 3, 2024
1 parent 8515674 commit 8010b69
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 44 deletions.
34 changes: 18 additions & 16 deletions src/components/ServerDetailOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,22 +221,24 @@ export default function ServerDetailOverview({
</section>
</CardContent>
</Card>
{server?.state.temperatures && server?.state.temperatures.length > 0 && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
<p className="text-xs text-muted-foreground">{"温度"}</p>
<section className="flex items-start gap-2">
{server?.state.temperatures.map((item,index) => (
<div className="text-xs flex items-center" key={index}>
<p className=" font-semibold">{item.Name}</p>: {item.Temperature.toFixed(2)} °C
</div>
))}
</section>
</section>
</CardContent>
</Card>
)}
{server?.state.temperatures &&
server?.state.temperatures.length > 0 && (
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
<p className="text-xs text-muted-foreground">{"温度"}</p>
<section className="flex items-start gap-2">
{server?.state.temperatures.map((item, index) => (
<div className="text-xs flex items-center" key={index}>
<p className=" font-semibold">{item.Name}</p>:{" "}
{item.Temperature.toFixed(2)} °C
</div>
))}
</section>
</section>
</CardContent>
</Card>
)}
<Card className="rounded-[10px] bg-transparent border-none shadow-none">
<CardContent className="px-1.5 py-1">
<section className="flex flex-col items-start gap-0.5">
Expand Down
48 changes: 24 additions & 24 deletions src/components/ServerOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import { Card, CardContent } from "@/components/ui/card";
import { cn } from "@/lib/utils";
import { useTranslation } from "react-i18next";
import { formatBytes } from "@/lib/format";
import { Separator } from "./ui/separator";
import {
ArrowDownCircleIcon,
ArrowUpCircleIcon,
} from "@heroicons/react/20/solid";

type ServerOverviewProps = {
online: number;
Expand Down Expand Up @@ -90,33 +93,30 @@ export default function ServerOverview({
)}
>
<CardContent className="flex h-full items-center relative px-6 py-3">
<section className="flex flex-col gap-1">
<div className="flex items-center gap-1">
<p className="text-sm font-medium md:text-base">
{t("serverOverview.totalBandwidth")}
</p>
<Separator
orientation="vertical"
className="h-4 w-[1px]"
/>
<section className="flex flex-col gap-1 w-full">
<div className="flex items-center w-full justify-between">
<p className="text-sm font-medium md:text-base">
{t("serverOverview.speed")}
{t("serverOverview.network")}
</p>
<section className="flex flex-row z-[999] sm:items-center items-start pr-2 sm:pr-0 gap-1 ml-auto">
<p className="sm:text-[12px] text-[10px] text-nowrap font-semibold">
{formatBytes(up)}
</p>
<p className="sm:text-[12px] text-[10px] text-nowrap font-semibold">
{formatBytes(down)}
</p>
</section>
</div>
<section className="flex flex-row sm:items-center items-start gap-1">
<p className="sm:text-[12px] text-[10px] text-nowrap font-semibold">
{formatBytes(up)}
</p>
<p className="sm:text-[12px] text-[10px] text-nowrap font-semibold">
{formatBytes(down)}
</p>
</section>
<section className="flex flex-row sm:items-center items-start gap-1">
<p className="sm:text-[12px] text-[10px] text-nowrap font-semibold">
{formatBytes(upSpeed)}/s
<section className="flex flex-row mt-1.5 -mr-1 sm:items-center items-start gap-1">
<p className="sm:text-[12px] flex items-center text-[10px] text-nowrap font-bold">
<ArrowUpCircleIcon className="size-3 mr-0.5 sm:mb-[1.1px]" />
{formatBytes(
upSpeed,
)}/s
</p>
<p className="sm:text-[12px] text-[10px] text-nowrap font-semibold">
{formatBytes(downSpeed)}/s
<p className="sm:text-[12px] flex items-center text-[10px] text-nowrap font-bold">
<ArrowDownCircleIcon className="size-3 mr-0.5" />
{formatBytes(downSpeed)}/s
</p>
</section>
</section>
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"onlineServers": "Online Servers",
"offlineServers": "Offline Servers",
"totalBandwidth": "Total Bandwidth",
"speed": "Speed"
"speed": "Speed",
"network": "Network"
},
"serverCard": {
"mem": "MEM",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/zh-CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"onlineServers": "在线服务器",
"offlineServers": "离线服务器",
"totalBandwidth": "总流量",
"speed": "速率"
"speed": "速率",
"network": "网络"
},
"serverCard": {
"mem": "内存",
Expand Down
3 changes: 2 additions & 1 deletion src/locales/zh-TW/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"onlineServers": "線上服務器",
"offlineServers": "離線服務器",
"totalBandwidth": "總帶寬",
"speed": "速率"
"speed": "速率",
"network": "網路"
},
"serverCard": {
"mem": "內存",
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export default defineConfig({
server: {
proxy: {
"/api/v1/ws/server": {
target: "ws://localhost:8080",
target: "ws://localhost:8008",
changeOrigin: true,
ws: true,
},
Expand Down

0 comments on commit 8010b69

Please sign in to comment.