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
128 </nav>128 </nav>
129 129
130 <div className="flex flex-col gap-4 w-full mt-6">130 <div className="flex flex-col gap-4 w-full mt-6">
131 <Tabs131 <Tabs
132 defaultValue="monthly"132 defaultValue="monthly"
133 value={isAnnual ? "annual" : "monthly"}133 value={isAnnual ? "annual" : "monthly"}
134 className="w-full"134 className="w-full"
135 onValueChange={(e) => setIsAnnual(e === "annual")}135 onValueChange={(e) => setIsAnnual(e === "annual")}
136 >136 >
137 <TabsList>137 <TabsList>
138 <TabsTrigger value="monthly">Monthly</TabsTrigger>138 <TabsTrigger value="monthly">Monthly</TabsTrigger>
139 <TabsTrigger value="annual">Annual</TabsTrigger>139 <TabsTrigger value="annual">Annual</TabsTrigger>
140 </TabsList>140 </TabsList>
141 </Tabs>141 </Tabs>
142 {admin?.user.stripeSubscriptionId && (142 {admin?.user.stripeSubscriptionId && (
143 <div className="space-y-2 flex flex-col">143 <div className="space-y-2 flex flex-col">
144 <h3 className="text-lg font-medium">Servers Plan</h3>144 <h3 className="text-lg font-medium">Servers Plan</h3>
145 <p className="text-sm text-muted-foreground">145 <p className="text-sm text-muted-foreground">
146 You have {servers} server on your plan of{" "}146 You have {servers} server on your plan of{" "}
147 {admin?.user.serversQuantity} servers147 {admin?.user.serversQuantity} servers
148 </p>148 </p>
149 <div>149 <div>
150 <Progress value={safePercentage} className="max-w-lg" />150 <Progress value={safePercentage} className="max-w-lg" />
151 </div>151 </div>
152 {admin && admin.user.serversQuantity! <= (servers ?? 0) && (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">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" />154 <AlertTriangle className="text-yellow-600 dark:text-yellow-400" />
155 <span className="text-sm 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 can156 You have reached the maximum number of servers you can
157 create, please upgrade your plan to add more servers.157 create, please upgrade your plan to add more servers.
158 </span>158 </span>
159 </div>
160 )}
161 </div>159 </div>
162 )}160 )}
163 <div className="flex flex-col gap-1.5 mt-4">161 </div>
164 <span className="text-base text-primary">162 )}
165 Need Help? We are here to help you.163 <div className="flex flex-col gap-1.5 mt-4">
166 </span>164 <span className="text-base text-primary">
167 <span className="text-sm text-muted-foreground">165 Need Help? We are here to help you.
168 Join to our Discord server and we will help you.166 </span>
169 </span>167 <span className="text-sm text-muted-foreground">
170 <Button className="rounded-full bg-[#5965F2] hover:bg-[#4A55E0] w-fit">168 Join to our Discord server and we will help you.
171 <Link169 </span>
172 href="https://discord.gg/2tBnJ3jDJc"170 <Button className="rounded-full bg-[#5965F2] hover:bg-[#4A55E0] w-fit">
173 aria-label="Dokploy on GitHub"171 <Link
174 target="_blank"172 href="https://discord.gg/2tBnJ3jDJc"
175 className="flex flex-row items-center gap-2 text-white"173 aria-label="Dokploy on GitHub"
176 >174 target="_blank"
177 <svg175 className="flex flex-row items-center gap-2 text-white"
178 role="img"176 >
179 className="h-6 w-6 fill-white"177 <svg
180 viewBox="0 0 24 24"178 role="img"
181 xmlns="http://www.w3.org/2000/svg"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 )}
182 >207 >
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" />208 {isAnnual && (
184 </svg>209 <div className="mb-4 flex flex-row items-center gap-2">
185 Join Discord210 <Badge>Recommended 🚀</Badge>
186 </Link>211 </div>
187 </Button>212 )}
188 </div>213 {isAnnual ? (
189 {isLoading ? (214 <div className="flex flex-row gap-2 items-center">
190 <span className="text-base text-muted-foreground flex flex-row gap-3 items-center justify-center min-h-[10vh]">215 <p className="text-2xl font-semibold tracking-tight text-primary ">
191 Loading...216 ${" "}
192 <Loader2 className="animate-spin" />217 {calculatePrice(
193 </span>218 serverQuantity,
194 ) : (219 isAnnual,
195 <>220 ).toFixed(2)}{" "}
196 {products?.map((product) => {221 USD
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}
251 </p>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}
251 </p>
252 252
253 <ul253 <ul
254 className={clsx(254 className={clsx(
255 " mt-4 flex flex-col gap-y-2 text-sm",255 " mt-4 flex flex-col gap-y-2 text-sm",
256 featured ? "text-white" : "text-slate-200",256 featured ? "text-white" : "text-slate-200",
257 )}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"
258 >271 >
259 {[272 <CheckIcon />
260 "All the features of Dokploy",273 <span className="ml-4">{feature}</span>
261 "Unlimited deployments",274 </li>
262 "Self-hosted on your own infrastructure",275 ))}
263 "Full access to all deployment features",276 </ul>
264 "Dokploy integration",277 <div className="flex flex-col gap-2 mt-4">
265 "Backups",278 <div className="flex items-center gap-2 justify-center">
266 "All Incoming features",279 <span className="text-sm text-muted-foreground">
267 ].map((feature) => (280 {serverQuantity} Servers
268 <li281 </span>
269 key={feature}282 </div>
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>
283 283
284 <div className="flex items-center space-x-2">284 <div className="flex items-center space-x-2">
285 <Button285 <Button
286 disabled={serverQuantity <= 1}286 disabled={serverQuantity <= 1}
287 variant="outline"287 variant="outline"
288 onClick={() => {288 onClick={() => {
289 if (serverQuantity <= 1) return;289 if (serverQuantity <= 1) return;
290 290
291 setServerQuantity(serverQuantity - 1);291 setServerQuantity(serverQuantity - 1);
292 }}292 }}
293 >293 >
294 <MinusIcon className="h-4 w-4" />294 <MinusIcon className="h-4 w-4" />
295 </Button>295 </Button>
296 <NumberInput296 <NumberInput
297 value={serverQuantity}297 value={serverQuantity}
298 onChange={(e) => {298 onChange={(e) => {
299 setServerQuantity(299 setServerQuantity(
300 e.target.value as unknown as number,300 e.target.value as unknown as number,
301 );301 );
302 }}302 }}
303 />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();
304 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">
305 <Button340 <Button
306 variant="outline"341 className="w-full"
307 onClick={() => {342 onClick={async () => {
308 setServerQuantity(serverQuantity + 1);343 handleCheckout(product.id);
309 }}344 }}
345 disabled={serverQuantity < 1}
310 >346 >
311 <PlusIcon className="h-4 w-4" />347 Subscribe
312 </Button>348 </Button>
313 </div>349 </div>
314 <div350 )}
315 className={cn(351 </div>
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>
354 </div>352 </div>
355 );353 </section>
356 })}354 </div>
357 </>355 );
358 )}356 })}
359 </div>357 </>
358 )}
359 </div>
360 </CardContent>360 </CardContent>
361 </div>361 </div>
362 </Card>362 </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