-
Notifications
You must be signed in to change notification settings - Fork 789
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from hamster1963/new-server-page
feat: merge details and network pages
- Loading branch information
Showing
11 changed files
with
119 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
"use client"; | ||
|
||
import { NetworkChartClient } from "@/app/[locale]/(main)/ClientComponents/NetworkChart"; | ||
import ServerDetailChartClient from "@/app/[locale]/(main)/ClientComponents/ServerDetailChartClient"; | ||
import ServerDetailClient from "@/app/[locale]/(main)/ClientComponents/ServerDetailClient"; | ||
import TabSwitch from "@/components/TabSwitch"; | ||
import { Separator } from "@/components/ui/separator"; | ||
import { useTranslations } from "next-intl"; | ||
import { useState } from "react"; | ||
|
||
export default function Page({ params }: { params: { id: string } }) { | ||
const t = useTranslations("TabSwitch"); | ||
|
||
const tabs = [t("Detail"), t("Network")]; | ||
const [currentTab, setCurrentTab] = useState(tabs[0]); | ||
return ( | ||
<div className="mx-auto grid w-full max-w-5xl gap-2"> | ||
<ServerDetailClient server_id={Number(params.id)} /> | ||
<section className="flex items-center my-2 w-full"> | ||
<Separator className="flex-1" /> | ||
<div className="flex justify-center w-full max-w-[200px]"> | ||
<TabSwitch | ||
tabs={tabs} | ||
currentTab={currentTab} | ||
setCurrentTab={setCurrentTab} | ||
/> | ||
</div> | ||
<Separator className="flex-1" /> | ||
</section> | ||
{currentTab === tabs[0] && ( | ||
<ServerDetailChartClient server_id={Number(params.id)} show={true} /> | ||
)} | ||
{currentTab === tabs[1] && ( | ||
<NetworkChartClient server_id={Number(params.id)} show={true} /> | ||
)} | ||
</div> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"use client"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
import { motion } from "framer-motion"; | ||
import React, { useState } from "react"; | ||
|
||
export default function TabSwitch({ | ||
tabs, | ||
currentTab, | ||
setCurrentTab, | ||
}: { | ||
tabs: string[]; | ||
currentTab: string; | ||
setCurrentTab: (tab: string) => void; | ||
}) { | ||
return ( | ||
<div className="z-50 flex flex-col items-start overflow-x-scroll rounded-[50px]"> | ||
<div className="flex items-center gap-1 rounded-[50px] bg-stone-100 p-[3px] dark:bg-stone-800"> | ||
{tabs.map((tab: string) => ( | ||
<div | ||
key={tab} | ||
onClick={() => setCurrentTab(tab)} | ||
className={cn( | ||
"relative cursor-pointer rounded-3xl px-2.5 py-[8px] text-[13px] font-[600] transition-all duration-500", | ||
currentTab === tab | ||
? "text-black dark:text-white" | ||
: "text-stone-400 dark:text-stone-500", | ||
)} | ||
> | ||
{currentTab === tab && ( | ||
<motion.div | ||
layoutId="tab-switch" | ||
className="absolute inset-0 z-10 h-full w-full content-center bg-white shadow-lg shadow-black/5 dark:bg-stone-700 dark:shadow-white/5" | ||
style={{ | ||
originY: "0px", | ||
borderRadius: 46, | ||
}} | ||
/> | ||
)} | ||
<div className="relative z-20 flex items-center gap-1"> | ||
<p className="whitespace-nowrap">{tab}</p> | ||
</div> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters