mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-06-15 20:25:23 +02:00
Adds a new /dashboard/home landing with welcome header, KPI cards (deploys/24h, build, CPU, memory) and a recent deployments list. Home is now the post-login landing and the destination for permission fallback redirects across the app. Projects remains accessible from the sidebar.
64 lines
1.5 KiB
TypeScript
64 lines
1.5 KiB
TypeScript
import { IS_CLOUD } from "@dokploy/server/constants";
|
|
import { validateRequest } from "@dokploy/server/lib/auth";
|
|
import { createServerSideHelpers } from "@trpc/react-query/server";
|
|
import type { GetServerSidePropsContext } from "next";
|
|
import type { ReactElement } from "react";
|
|
import superjson from "superjson";
|
|
import { ShowBilling } from "@/components/dashboard/settings/billing/show-billing";
|
|
import { DashboardLayout } from "@/components/layouts/dashboard-layout";
|
|
import { appRouter } from "@/server/api/root";
|
|
|
|
const Page = () => {
|
|
return <ShowBilling />;
|
|
};
|
|
|
|
export default Page;
|
|
|
|
Page.getLayout = (page: ReactElement) => {
|
|
return <DashboardLayout metaName="Billing">{page}</DashboardLayout>;
|
|
};
|
|
export async function getServerSideProps(
|
|
ctx: GetServerSidePropsContext<{ serviceId: string }>,
|
|
) {
|
|
if (!IS_CLOUD) {
|
|
return {
|
|
redirect: {
|
|
permanent: true,
|
|
destination: "/dashboard/home",
|
|
},
|
|
};
|
|
}
|
|
const { req, res } = ctx;
|
|
const { user, session } = await validateRequest(req);
|
|
if (!user || user.role !== "owner") {
|
|
return {
|
|
redirect: {
|
|
permanent: true,
|
|
destination: "/",
|
|
},
|
|
};
|
|
}
|
|
|
|
const helpers = createServerSideHelpers({
|
|
router: appRouter,
|
|
ctx: {
|
|
req: req as any,
|
|
res: res as any,
|
|
db: null as any,
|
|
session: session as any,
|
|
user: user as any,
|
|
},
|
|
transformer: superjson,
|
|
});
|
|
|
|
await helpers.user.get.prefetch();
|
|
|
|
await helpers.settings.isCloud.prefetch();
|
|
|
|
return {
|
|
props: {
|
|
trpcState: helpers.dehydrate(),
|
|
},
|
|
};
|
|
}
|