slight change
This commit is contained in:
+27
-10
@@ -1,7 +1,14 @@
|
|||||||
"use client"
|
"use client";
|
||||||
|
|
||||||
import { TrendingUp } from "lucide-react"
|
import { TrendingUp } from "lucide-react";
|
||||||
import { Area, AreaChart, CartesianGrid, ResponsiveContainer, XAxis, YAxis } from "recharts"
|
import {
|
||||||
|
Area,
|
||||||
|
AreaChart,
|
||||||
|
CartesianGrid,
|
||||||
|
ResponsiveContainer,
|
||||||
|
XAxis,
|
||||||
|
YAxis,
|
||||||
|
} from "recharts";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
@@ -10,13 +17,13 @@ import {
|
|||||||
CardFooter,
|
CardFooter,
|
||||||
CardHeader,
|
CardHeader,
|
||||||
CardTitle,
|
CardTitle,
|
||||||
} from "@/components/ui/card"
|
} from "@/components/ui/card";
|
||||||
import {
|
import {
|
||||||
ChartConfig,
|
ChartConfig,
|
||||||
ChartContainer,
|
ChartContainer,
|
||||||
ChartTooltip,
|
ChartTooltip,
|
||||||
ChartTooltipContent,
|
ChartTooltipContent,
|
||||||
} from "@/components/ui/chart"
|
} from "@/components/ui/chart";
|
||||||
|
|
||||||
const chartConfig = {
|
const chartConfig = {
|
||||||
cpu: {
|
cpu: {
|
||||||
@@ -27,9 +34,13 @@ const chartConfig = {
|
|||||||
label: "RAM",
|
label: "RAM",
|
||||||
color: "var(--chart-1)",
|
color: "var(--chart-1)",
|
||||||
},
|
},
|
||||||
} satisfies ChartConfig
|
} satisfies ChartConfig;
|
||||||
|
|
||||||
export function ChartAreaGradient({chartData}: {chartData: {hour: number, cpu: number, ram: number}[]}) {
|
export function ChartAreaGradient({
|
||||||
|
chartData,
|
||||||
|
}: {
|
||||||
|
chartData: { hour: number; cpu: number; ram: number }[];
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<Card className="w-full h-96 sm:h-full">
|
<Card className="w-full h-96 sm:h-full">
|
||||||
<CardHeader>
|
<CardHeader>
|
||||||
@@ -52,11 +63,17 @@ export function ChartAreaGradient({chartData}: {chartData: {hour: number, cpu: n
|
|||||||
tickLine={false}
|
tickLine={false}
|
||||||
axisLine={false}
|
axisLine={false}
|
||||||
tickMargin={8}
|
tickMargin={8}
|
||||||
tickFormatter={(value) => value+"h"}
|
tickFormatter={(value) => value + "h"}
|
||||||
height={34}
|
height={34}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<YAxis domain={[0, 200]} tickLine={false} axisLine={false} tickMargin={8} width={34} />
|
<YAxis
|
||||||
|
domain={[0, 200]}
|
||||||
|
tickLine={false}
|
||||||
|
axisLine={false}
|
||||||
|
tickMargin={8}
|
||||||
|
width={34}
|
||||||
|
/>
|
||||||
<ChartTooltip cursor={false} content={<ChartTooltipContent />} />
|
<ChartTooltip cursor={false} content={<ChartTooltipContent />} />
|
||||||
<defs>
|
<defs>
|
||||||
<linearGradient id="fillCPU" x1="0" y1="0" x2="0" y2="1">
|
<linearGradient id="fillCPU" x1="0" y1="0" x2="0" y2="1">
|
||||||
@@ -105,5 +122,5 @@ export function ChartAreaGradient({chartData}: {chartData: {hour: number, cpu: n
|
|||||||
</ChartContainer>
|
</ChartContainer>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-11
@@ -17,7 +17,6 @@ export function generateHourlyData() {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export function SummaryCard({
|
export function SummaryCard({
|
||||||
children,
|
children,
|
||||||
value,
|
value,
|
||||||
@@ -36,16 +35,18 @@ export function SummaryCard({
|
|||||||
<Label className="text-md font-bold text-foreground">{children}</Label>
|
<Label className="text-md font-bold text-foreground">{children}</Label>
|
||||||
<Label className={cn("text-2xl font-bold", className)}>{value}</Label>
|
<Label className={cn("text-2xl font-bold", className)}>{value}</Label>
|
||||||
</div>
|
</div>
|
||||||
<Icon
|
<Icon className={cn("shrink-0", className)} size={32} />
|
||||||
className={cn("shrink-0", className)}
|
|
||||||
size={32}
|
|
||||||
/>
|
|
||||||
</Card>
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function Summary({
|
||||||
export function Summary({value, children}: {value: number, children: React.ReactNode}) {
|
value,
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
value: number;
|
||||||
|
children: React.ReactNode;
|
||||||
|
}) {
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col gap-2 w-full">
|
<div className="flex flex-col gap-2 w-full">
|
||||||
<div className="justify-between flex">
|
<div className="justify-between flex">
|
||||||
@@ -67,7 +68,9 @@ export default async function Dashboard() {
|
|||||||
<span className="hidden sm:inline">Online Servers</span>
|
<span className="hidden sm:inline">Online Servers</span>
|
||||||
<span className="inline sm:hidden">Online</span>
|
<span className="inline sm:hidden">Online</span>
|
||||||
</SummaryCard>
|
</SummaryCard>
|
||||||
<SummaryCard className="text-chart-4" value="2" icon={TriangleAlert}>Issues</SummaryCard>
|
<SummaryCard className="text-chart-4" value="2" icon={TriangleAlert}>
|
||||||
|
Issues
|
||||||
|
</SummaryCard>
|
||||||
<SummaryCard className="text-chart-2" value="52%" icon={Cpu}>
|
<SummaryCard className="text-chart-2" value="52%" icon={Cpu}>
|
||||||
<span className="hidden sm:inline">Avg CPU Usage</span>
|
<span className="hidden sm:inline">Avg CPU Usage</span>
|
||||||
<span className="inline sm:hidden">CPU</span>
|
<span className="inline sm:hidden">CPU</span>
|
||||||
@@ -85,11 +88,13 @@ export default async function Dashboard() {
|
|||||||
<CardTitle>System Overview</CardTitle>
|
<CardTitle>System Overview</CardTitle>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="flex flex-col gap-6 w-full md:w-96">
|
<CardContent className="flex flex-col gap-6 w-full md:w-96">
|
||||||
<Summary value={20}>Average CPU Usage</Summary>
|
<Summary value={20}>Average CPU</Summary>
|
||||||
<Summary value={69}>Average Memory Usage</Summary>
|
<Summary value={69}>Average Memory</Summary>
|
||||||
|
<Summary value={69}>Storage</Summary>
|
||||||
|
<Summary value={69}>Average Network</Summary>
|
||||||
</CardContent>
|
</CardContent>
|
||||||
</Card>
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,11 @@ export default function Login() {
|
|||||||
return (
|
return (
|
||||||
<div className="min-h-screen flex items-center justify-center">
|
<div className="min-h-screen flex items-center justify-center">
|
||||||
<Card className="h-max w-[25rem] px-8 pb-8">
|
<Card className="h-max w-[25rem] px-8 pb-8">
|
||||||
<form ref={formRef} onSubmit={(e) => e.preventDefault()} className="flex flex-col gap-2">
|
<form
|
||||||
|
ref={formRef}
|
||||||
|
onSubmit={(e) => e.preventDefault()}
|
||||||
|
className="flex flex-col gap-2"
|
||||||
|
>
|
||||||
<h1 className="text-4xl font-bold text-center mt-5">Login</h1>
|
<h1 className="text-4xl font-bold text-center mt-5">Login</h1>
|
||||||
|
|
||||||
<Label>Username</Label>
|
<Label>Username</Label>
|
||||||
|
|||||||
@@ -11,8 +11,7 @@ export default function AppLayout({ children }: { children: React.ReactNode }) {
|
|||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const showSidebar = !hiddenRoutes.includes(pathname);
|
const showSidebar = !hiddenRoutes.includes(pathname);
|
||||||
|
|
||||||
return (
|
return showSidebar ? (
|
||||||
showSidebar ?
|
|
||||||
<SidebarProvider>
|
<SidebarProvider>
|
||||||
<div className="flex min-h-[100dvh] w-full">
|
<div className="flex min-h-[100dvh] w-full">
|
||||||
<AppSidebar />
|
<AppSidebar />
|
||||||
@@ -22,10 +21,7 @@ export default function AppLayout({ children }: { children: React.ReactNode }) {
|
|||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</SidebarProvider>
|
</SidebarProvider>
|
||||||
|
) : (
|
||||||
:
|
<main className="min-h-[100dvh]">{children}</main>
|
||||||
<main className="min-h-[100dvh]">
|
|
||||||
{children}
|
|
||||||
</main>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
SidebarFooter,
|
SidebarFooter,
|
||||||
SidebarGroup,
|
SidebarGroup,
|
||||||
SidebarHeader,
|
SidebarHeader,
|
||||||
} from "@/components/ui/sidebar"
|
} from "@/components/ui/sidebar";
|
||||||
|
|
||||||
export default function AppSidebar() {
|
export default function AppSidebar() {
|
||||||
return (
|
return (
|
||||||
@@ -16,5 +16,5 @@ export default function AppSidebar() {
|
|||||||
</SidebarContent>
|
</SidebarContent>
|
||||||
<SidebarFooter />
|
<SidebarFooter />
|
||||||
</Sidebar>
|
</Sidebar>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user