History

[autofix.ci] apply automated fixes

autofix-ci[bot] committed 10 months ago

Commit 2acaaed1 parent f3039621 file · +214 −214Browse files

Unified · Split

apps/dokploy/components/dashboard/settings/billing/show-billing.tsx+214−214
@@ -128,235 +128,235 @@ export const ShowBilling = () => { · 127 unmodified lines
128128 </nav>
129129
130130 <div className="flex flex-col gap-4 w-full mt-6">
131− <Tabs
132− defaultValue="monthly"
133− value={isAnnual ? "annual" : "monthly"}
134− className="w-full"
135− onValueChange={(e) => setIsAnnual(e === "annual")}
136− >
137− <TabsList>
138− <TabsTrigger value="monthly">Monthly</TabsTrigger>
139− <TabsTrigger value="annual">Annual</TabsTrigger>
140− </TabsList>
141− </Tabs>
142− {admin?.user.stripeSubscriptionId && (
143− <div className="space-y-2 flex flex-col">
144− <h3 className="text-lg font-medium">Servers Plan</h3>
145− <p className="text-sm text-muted-foreground">
146− You have {servers} server on your plan of{" "}
147− {admin?.user.serversQuantity} servers
148− </p>
149− <div>
150− <Progress value={safePercentage} className="max-w-lg" />
151− </div>
152− {admin && admin.user.serversQuantity! <= (servers ?? 0) && (
153− <div className="flex flex-row gap-4 p-2 bg-yellow-50 dark:bg-yellow-950 rounded-lg items-center">
154− <AlertTriangle className="text-yellow-600 dark:text-yellow-400" />
155− <span className="text-sm text-yellow-600 dark:text-yellow-400">
156− You have reached the maximum number of servers you can
157− create, please upgrade your plan to add more servers.
158− </span>
159− </div>
160− )}
131+ <Tabs
132+ defaultValue="monthly"
133+ value={isAnnual ? "annual" : "monthly"}
134+ className="w-full"
135+ onValueChange={(e) => setIsAnnual(e === "annual")}
136+ >
137+ <TabsList>
138+ <TabsTrigger value="monthly">Monthly</TabsTrigger>
139+ <TabsTrigger value="annual">Annual</TabsTrigger>
140+ </TabsList>
141+ </Tabs>
142+ {admin?.user.stripeSubscriptionId && (
143+ <div className="space-y-2 flex flex-col">
144+ <h3 className="text-lg font-medium">Servers Plan</h3>
145+ <p className="text-sm text-muted-foreground">
146+ You have {servers} server on your plan of{" "}
147+ {admin?.user.serversQuantity} servers
148+ </p>
149+ <div>
150+ <Progress value={safePercentage} className="max-w-lg" />
151+ </div>
152+ {admin && admin.user.serversQuantity! <= (servers ?? 0) && (
153+ <div className="flex flex-row gap-4 p-2 bg-yellow-50 dark:bg-yellow-950 rounded-lg items-center">
154+ <AlertTriangle className="text-yellow-600 dark:text-yellow-400" />
155+ <span className="text-sm text-yellow-600 dark:text-yellow-400">
156+ You have reached the maximum number of servers you can
157+ create, please upgrade your plan to add more servers.
158+ </span>
161159 </div>
162160 )}
163− <div className="flex flex-col gap-1.5 mt-4">
164− <span className="text-base text-primary">
165− Need Help? We are here to help you.
166− </span>
167− <span className="text-sm text-muted-foreground">
168− Join to our Discord server and we will help you.
169− </span>
170− <Button className="rounded-full bg-[#5965F2] hover:bg-[#4A55E0] w-fit">
171− <Link
172− href="https://discord.gg/2tBnJ3jDJc"
173− aria-label="Dokploy on GitHub"
174− target="_blank"
175− className="flex flex-row items-center gap-2 text-white"
176− >
177− <svg
178− role="img"
179− className="h-6 w-6 fill-white"
180− viewBox="0 0 24 24"
181− xmlns="http://www.w3.org/2000/svg"
161+ </div>
162+ )}
163+ <div className="flex flex-col gap-1.5 mt-4">
164+ <span className="text-base text-primary">
165+ Need Help? We are here to help you.
166+ </span>
167+ <span className="text-sm text-muted-foreground">
168+ Join to our Discord server and we will help you.
169+ </span>
170+ <Button className="rounded-full bg-[#5965F2] hover:bg-[#4A55E0] w-fit">
171+ <Link
172+ href="https://discord.gg/2tBnJ3jDJc"
173+ aria-label="Dokploy on GitHub"
174+ target="_blank"
175+ className="flex flex-row items-center gap-2 text-white"
176+ >
177+ <svg
178+ role="img"
179+ className="h-6 w-6 fill-white"
180+ viewBox="0 0 24 24"
181+ xmlns="http://www.w3.org/2000/svg"
182+ >
183+ <path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z" />
184+ </svg>
185+ Join Discord
186+ </Link>
187+ </Button>
188+ </div>
189+ {isLoading ? (
190+ <span className="text-base text-muted-foreground flex flex-row gap-3 items-center justify-center min-h-[10vh]">
191+ Loading...
192+ <Loader2 className="animate-spin" />
193+ </span>
194+ ) : (
195+ <>
196+ {products?.map((product) => {
197+ const featured = true;
198+ return (
199+ <div key={product.id}>
200+ <section
201+ className={clsx(
202+ "flex flex-col rounded-3xl border-dashed border-2 px-4 max-w-sm",
203+ featured
204+ ? "order-first border py-8 lg:order-none"
205+ : "lg:py-8",
206+ )}
182207 >
183− <path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z" />
184− </svg>
185− Join Discord
186− </Link>
187− </Button>
188− </div>
189− {isLoading ? (
190− <span className="text-base text-muted-foreground flex flex-row gap-3 items-center justify-center min-h-[10vh]">
191− Loading...
192− <Loader2 className="animate-spin" />
193− </span>
194− ) : (
195− <>
196− {products?.map((product) => {
197− const featured = true;
198− return (
199− <div key={product.id}>
200− <section
201− className={clsx(
202− "flex flex-col rounded-3xl border-dashed border-2 px-4 max-w-sm",
203− featured
204− ? "order-first border py-8 lg:order-none"
205− : "lg:py-8",
206− )}
207− >
208− {isAnnual && (
209− <div className="mb-4 flex flex-row items-center gap-2">
210− <Badge>Recommended 🚀</Badge>
211− </div>
212− )}
213− {isAnnual ? (
214− <div className="flex flex-row gap-2 items-center">
215− <p className="text-2xl font-semibold tracking-tight text-primary ">
216− ${" "}
217− {calculatePrice(
218− serverQuantity,
219− isAnnual,
220− ).toFixed(2)}{" "}
221− USD
222− </p>
223− |
224− <p className="text-base font-semibold tracking-tight text-muted-foreground">
225− ${" "}
226− {(
227− calculatePrice(serverQuantity, isAnnual) / 12
228− ).toFixed(2)}{" "}
229− / Month USD
230− </p>
231− </div>
232− ) : (
233− <p className="text-2xl font-semibold tracking-tight text-primary ">
234− ${" "}
235− {calculatePrice(serverQuantity, isAnnual).toFixed(
236− 2,
237− )}{" "}
238− USD
239− </p>
240− )}
241− <h3 className="mt-5 font-medium text-lg text-primary">
242− {product.name}
243− </h3>
244− <p
245− className={clsx(
246− "text-sm",
247− featured ? "text-white" : "text-slate-400",
248− )}
249− >
250− {product.description}
208+ {isAnnual && (
209+ <div className="mb-4 flex flex-row items-center gap-2">
210+ <Badge>Recommended 🚀</Badge>
211+ </div>
212+ )}
213+ {isAnnual ? (
214+ <div className="flex flex-row gap-2 items-center">
215+ <p className="text-2xl font-semibold tracking-tight text-primary ">
216+ ${" "}
217+ {calculatePrice(
218+ serverQuantity,
219+ isAnnual,
220+ ).toFixed(2)}{" "}
221+ USD
251222 </p>
223+ |
224+ <p className="text-base font-semibold tracking-tight text-muted-foreground">
225+ ${" "}
226+ {(
227+ calculatePrice(serverQuantity, isAnnual) / 12
228+ ).toFixed(2)}{" "}
229+ / Month USD
230+ </p>
231+ </div>
232+ ) : (
233+ <p className="text-2xl font-semibold tracking-tight text-primary ">
234+ ${" "}
235+ {calculatePrice(serverQuantity, isAnnual).toFixed(
236+ 2,
237+ )}{" "}
238+ USD
239+ </p>
240+ )}
241+ <h3 className="mt-5 font-medium text-lg text-primary">
242+ {product.name}
243+ </h3>
244+ <p
245+ className={clsx(
246+ "text-sm",
247+ featured ? "text-white" : "text-slate-400",
248+ )}
249+ >
250+ {product.description}
251+ </p>
252252
253− <ul
254− className={clsx(
255− " mt-4 flex flex-col gap-y-2 text-sm",
256− featured ? "text-white" : "text-slate-200",
257− )}
253+ <ul
254+ className={clsx(
255+ " mt-4 flex flex-col gap-y-2 text-sm",
256+ featured ? "text-white" : "text-slate-200",
257+ )}
258+ >
259+ {[
260+ "All the features of Dokploy",
261+ "Unlimited deployments",
262+ "Self-hosted on your own infrastructure",
263+ "Full access to all deployment features",
264+ "Dokploy integration",
265+ "Backups",
266+ "All Incoming features",
267+ ].map((feature) => (
268+ <li
269+ key={feature}
270+ className="flex text-muted-foreground"
258271 >
259− {[
260− "All the features of Dokploy",
261− "Unlimited deployments",
262− "Self-hosted on your own infrastructure",
263− "Full access to all deployment features",
264− "Dokploy integration",
265− "Backups",
266− "All Incoming features",
267− ].map((feature) => (
268− <li
269− key={feature}
270− className="flex text-muted-foreground"
271− >
272− <CheckIcon />
273− <span className="ml-4">{feature}</span>
274− </li>
275− ))}
276− </ul>
277− <div className="flex flex-col gap-2 mt-4">
278− <div className="flex items-center gap-2 justify-center">
279− <span className="text-sm text-muted-foreground">
280− {serverQuantity} Servers
281− </span>
282− </div>
272+ <CheckIcon />
273+ <span className="ml-4">{feature}</span>
274+ </li>
275+ ))}
276+ </ul>
277+ <div className="flex flex-col gap-2 mt-4">
278+ <div className="flex items-center gap-2 justify-center">
279+ <span className="text-sm text-muted-foreground">
280+ {serverQuantity} Servers
281+ </span>
282+ </div>
283283
284− <div className="flex items-center space-x-2">
285− <Button
286− disabled={serverQuantity <= 1}
287− variant="outline"
288− onClick={() => {
289− if (serverQuantity <= 1) return;
284+ <div className="flex items-center space-x-2">
285+ <Button
286+ disabled={serverQuantity <= 1}
287+ variant="outline"
288+ onClick={() => {
289+ if (serverQuantity <= 1) return;
290290
291− setServerQuantity(serverQuantity - 1);
292− }}
293− >
294− <MinusIcon className="h-4 w-4" />
295− </Button>
296− <NumberInput
297− value={serverQuantity}
298− onChange={(e) => {
299− setServerQuantity(
300− e.target.value as unknown as number,
301− );
302− }}
303− />
291+ setServerQuantity(serverQuantity - 1);
292+ }}
293+ >
294+ <MinusIcon className="h-4 w-4" />
295+ </Button>
296+ <NumberInput
297+ value={serverQuantity}
298+ onChange={(e) => {
299+ setServerQuantity(
300+ e.target.value as unknown as number,
301+ );
302+ }}
303+ />
304+
305+ <Button
306+ variant="outline"
307+ onClick={() => {
308+ setServerQuantity(serverQuantity + 1);
309+ }}
310+ >
311+ <PlusIcon className="h-4 w-4" />
312+ </Button>
313+ </div>
314+ <div
315+ className={cn(
316+ data?.subscriptions &&
317+ data?.subscriptions?.length > 0
318+ ? "justify-between"
319+ : "justify-end",
320+ "flex flex-row items-center gap-2 mt-4",
321+ )}
322+ >
323+ {admin?.user.stripeCustomerId && (
324+ <Button
325+ variant="secondary"
326+ className="w-full"
327+ onClick={async () => {
328+ const session =
329+ await createCustomerPortalSession();
304330
331+ window.open(session.url);
332+ }}
333+ >
334+ Manage Subscription
335+ </Button>
336+ )}
337+
338+ {data?.subscriptions?.length === 0 && (
339+ <div className="justify-end w-full">
305340 <Button
306− variant="outline"
307− onClick={() => {
308− setServerQuantity(serverQuantity + 1);
341+ className="w-full"
342+ onClick={async () => {
343+ handleCheckout(product.id);
309344 }}
345+ disabled={serverQuantity < 1}
310346 >
311− <PlusIcon className="h-4 w-4" />
347+ Subscribe
312348 </Button>
313349 </div>
314− <div
315− className={cn(
316− data?.subscriptions &&
317− data?.subscriptions?.length > 0
318− ? "justify-between"
319− : "justify-end",
320− "flex flex-row items-center gap-2 mt-4",
321− )}
322− >
323− {admin?.user.stripeCustomerId && (
324− <Button
325− variant="secondary"
326− className="w-full"
327− onClick={async () => {
328− const session =
329− await createCustomerPortalSession();
330−
331− window.open(session.url);
332− }}
333− >
334− Manage Subscription
335− </Button>
336− )}
337−
338− {data?.subscriptions?.length === 0 && (
339− <div className="justify-end w-full">
340− <Button
341− className="w-full"
342− onClick={async () => {
343− handleCheckout(product.id);
344− }}
345− disabled={serverQuantity < 1}
346− >
347− Subscribe
348− </Button>
349− </div>
350− )}
351− </div>
352− </div>
353− </section>
350+ )}
351+ </div>
354352 </div>
355− );
356− })}
357− </>
358− )}
359− </div>
353+ </section>
354+ </div>
355+ );
356+ })}
357+ </>
358+ )}
359+ </div>
360360 </CardContent>
361361 </div>
362362 </Card>

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t