Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions apps/web/app/dashboard/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,23 @@ const NewServerPage = async ({
return (
<>
<PageHeader title="New server" />
<PageBody>
<ExternalStoreNotice
description="New servers are ordered through our store. Once your order is complete, the server appears here."
storeUrl={settings.storeUrl}
title="Order from our store"
/>
</PageBody>
{settings.billingProvider === "nobilling" ? (
<PageBody>
<ExternalStoreNotice
description="Billing is not enabled here. This panel is possibly for personal use only."
storeUrl={null}
title="Personal Use (No Billing)"
/>
</PageBody>
) : (
<PageBody>
<ExternalStoreNotice
description="New servers are ordered through our store. Once your order is complete, the server appears here."
storeUrl={settings.storeUrl}
title="Order from our store"
/>
</PageBody>
)}
</>
);
};
Expand Down
22 changes: 15 additions & 7 deletions apps/web/app/dashboard/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import {
} from "@/components/ui/empty";
import { prisma } from "@/lib/db";
import { requireUser } from "@/lib/session";
import { getPanelSettings } from "@/lib/settings";
import { cn } from "@/lib/utils";

import { PageBody, PageHeader } from "./components/page-header";
import { ServerGrid } from "./components/server-grid";

const DashboardPage = async () => {
const user = await requireUser();
const settings = await getPanelSettings();
const rows = await prisma.server.findMany({
include: {
allocation: { select: { ip: true, ipAlias: true, port: true } },
Expand Down Expand Up @@ -63,7 +65,11 @@ const DashboardPage = async () => {
if (servers.length === 0) {
return (
<>
<PageHeader actions={newServerAction} title="Servers" />
{settings.billingProvider === "nobilling" ? (
<PageHeader title="Servers" />
) : (
<PageHeader actions={newServerAction} title="Servers" />
)}
<PageBody wide>
<Empty>
<EmptyHeader>
Expand All @@ -88,12 +94,14 @@ const DashboardPage = async () => {
</EmptyDescription>
</EmptyHeader>
<EmptyContent>
<Button asChild size="lg">
<Link href="/dashboard/new" prefetch={false}>
<PlusIcon />
Create your first server
</Link>
</Button>
{settings.billingProvider === "nobilling" ? null : (
<Button asChild size="lg">
<Link href="/dashboard/new" prefetch={false}>
<PlusIcon />
Create your first server
</Link>
</Button>
)}
</EmptyContent>
</Empty>
</PageBody>
Expand Down
7 changes: 7 additions & 0 deletions apps/web/lib/billing-providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export const BILLING_PROVIDERS = [
"blesta",
"paymenter",
"builtin",
"nobilling",
] as const;

export type BillingProvider = (typeof BILLING_PROVIDERS)[number];
Expand Down Expand Up @@ -35,6 +36,12 @@ export const BILLING_PROVIDER_INFO: Record<
setup:
"Add a BytePanel server in BytePay with the API URL and key below, then set the BYTEPAY_* variables for sign-in.",
},
nobilling: {
description: "Just using BytePanel for personal use? Disable Billing!",
external: false,
label: "No Billing",
setup: "No setup needed!",
},
paymenter: {
description: "Sell servers in Paymenter. Customers order and pay there.",
external: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterEnum
ALTER TYPE "BillingProvider" ADD VALUE 'nobilling';
1 change: 1 addition & 0 deletions apps/web/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ enum BillingProvider {
blesta
paymenter
builtin
nobilling
}

model PanelSettings {
Expand Down