Skip to content

Commit

Permalink
feat: add version display
Browse files Browse the repository at this point in the history
  • Loading branch information
hamster1963 committed Dec 4, 2024
1 parent 1f9b667 commit 97b5ff3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
Binary file modified bun.lockb
Binary file not shown.
16 changes: 13 additions & 3 deletions src/components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
// src/components/Footer.tsx
import { fetchSetting } from "@/lib/nezha-api";
import { useQuery } from "@tanstack/react-query";
import React from "react";
import { useTranslation } from "react-i18next";

const Footer: React.FC = () => {
const { t } = useTranslation();

const { data: settingData } = useQuery({
queryKey: ["setting"],
queryFn: () => fetchSetting(),
refetchOnMount: true,
refetchOnWindowFocus: true,
});

return (
<footer className="mx-auto w-full max-w-5xl px-4 lg:px-0 pb-4">
<section className="flex flex-col">
<section className="mt-1 flex items-center justify-between gap-2 text-[13px] font-light tracking-tight text-neutral-600/50 dark:text-neutral-300/50">
<p>
<div className="flex items-center gap-1">
&copy;2020-{new Date().getFullYear()}{" "}
<a href={"https://github.com/naiba/nezha"} target="_blank">
Nezha
</a>
</p>
<p>{settingData?.data?.version || ""}</p>
</div>
<p>
{t("footer.themeBy")}
<a
Expand Down
8 changes: 2 additions & 6 deletions src/components/ServerOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,11 @@ export default function ServerOverview({
<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-semibold">
<ArrowUpCircleIcon className="size-3 mr-0.5 sm:mb-[1px]" />
{formatBytes(
upSpeed,
)}/s
{formatBytes(upSpeed)}/s
</p>
<p className="sm:text-[12px] flex items-center text-[10px] text-nowrap font-semibold">
<ArrowDownCircleIcon className="size-3 mr-0.5" />
{formatBytes(
downSpeed,
)}/s
{formatBytes(downSpeed)}/s
</p>
</section>
</section>
Expand Down
1 change: 1 addition & 0 deletions src/types/nezha-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,5 +163,6 @@ export interface SettingResponse {
language: string;
site_name: string;
custom_code: string;
version: string;
};
}

0 comments on commit 97b5ff3

Please sign in to comment.