import { useStudio as e } from "../providers/StudioProvider.js";
import { Button as t } from "../components/ui/button.js";
import { Alert as n, AlertDescription as r, AlertTitle as i } from "../components/ui/alert.js";
import a from "../components/layout/MainLayout.js";
import o from "../components/feedback/LoadingCentered.js";
import s from "../features/dashboard/Dashboard.js";
import { useDashboardStats as c } from "../hooks/useDashboard.js";
import { jsx as l, jsxs as u } from "react/jsx-runtime";
import { Home as d, TriangleAlert as f } from "lucide-react";
//#region src/pages/DashboardPage.tsx
function p() {
	let { environment: p } = e(), { data: m, isLoading: h, error: g, refetch: _, isRefetching: v } = c();
	return h ? /* @__PURE__ */ l(o, { loading: h }) : g ? /* @__PURE__ */ u(a, {
		breadcrumbsData: [{
			label: p.name,
			href: "#",
			icon: /* @__PURE__ */ l(d, { className: "h-4 w-4" })
		}, {
			label: "Dashboard",
			current: !0
		}],
		children: [/* @__PURE__ */ l("h1", {
			className: "mb-4 text-3xl font-bold tracking-tight",
			children: "Dashboard"
		}), /* @__PURE__ */ l("div", {
			className: "mx-auto w-full max-w-2xl",
			children: /* @__PURE__ */ u(n, {
				variant: "destructive",
				children: [
					/* @__PURE__ */ l(f, {}),
					/* @__PURE__ */ l(i, { children: "Dashboard konnte nicht geladen werden" }),
					/* @__PURE__ */ u(r, { children: [/* @__PURE__ */ u("p", {
						className: "wrap-break-word",
						children: ["Bitte versuch’s nochmal. ", g.message]
					}), /* @__PURE__ */ l("div", {
						className: "mt-3 flex flex-wrap gap-2",
						children: /* @__PURE__ */ l(t, {
							variant: "destructive",
							onClick: () => void _(),
							disabled: v,
							children: v ? "Lade neu…" : "Neu versuchen"
						})
					})] })
				]
			})
		})]
	}) : m ? /* @__PURE__ */ u(a, {
		breadcrumbsData: [{
			label: p.name,
			href: "#",
			icon: /* @__PURE__ */ l(d, { className: "h-4 w-4" })
		}, {
			label: "Dashboard",
			current: !0
		}],
		children: [/* @__PURE__ */ l("h1", {
			className: "mb-4 text-3xl font-bold tracking-tight",
			children: "Dashboard"
		}), /* @__PURE__ */ l(s, { dashboardStats: m })]
	}) : /* @__PURE__ */ l("div", {
		className: "p-4",
		children: "No data available"
	});
}
//#endregion
export { p as default };
