Skip to content

Commit 1fa4d5b

Browse files
committed
refactor: improve formatting and readability in billing and users components
- Enhanced code readability by adjusting formatting in the ShowBilling component, ensuring consistent line breaks and indentation. - Updated the ShowUsers component to improve the layout of the warning message for users with custom roles without a valid license, maintaining clarity in the alert presentation.
1 parent bade36e commit 1fa4d5b

File tree

2 files changed

+40
-23
lines changed

2 files changed

+40
-23
lines changed

apps/dokploy/components/dashboard/settings/billing/show-billing.tsx

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ export const ShowBilling = () => {
9292
const utils = api.useUtils();
9393

9494
const [hobbyServerQuantity, setHobbyServerQuantity] = useState(1);
95-
const [startupServerQuantity, setStartupServerQuantity] = useState(STARTUP_SERVERS_INCLUDED);
95+
const [startupServerQuantity, setStartupServerQuantity] = useState(
96+
STARTUP_SERVERS_INCLUDED,
97+
);
9698
const [isAnnual, setIsAnnual] = useState(false);
9799
const [upgradeTier, setUpgradeTier] = useState<"hobby" | "startup" | null>(
98100
null,
@@ -699,7 +701,8 @@ export const ShowBilling = () => {
699701
<p className="text-xs text-muted-foreground mt-2">
700702
$
701703
{(
702-
calculatePriceHobby(hobbyServerQuantity, true) / 12
704+
calculatePriceHobby(hobbyServerQuantity, true) /
705+
12
703706
).toFixed(2)}
704707
/mo
705708
</p>
@@ -826,7 +829,10 @@ export const ShowBilling = () => {
826829
<p className="text-xs text-muted-foreground mt-2">
827830
$
828831
{(
829-
calculatePriceStartup(startupServerQuantity, true) / 12
832+
calculatePriceStartup(
833+
startupServerQuantity,
834+
true,
835+
) / 12
830836
).toFixed(2)}
831837
/mo
832838
</p>
@@ -863,7 +869,8 @@ export const ShowBilling = () => {
863869
<div className="flex items-center gap-2">
864870
<Button
865871
disabled={
866-
startupServerQuantity <= STARTUP_SERVERS_INCLUDED
872+
startupServerQuantity <=
873+
STARTUP_SERVERS_INCLUDED
867874
}
868875
variant="outline"
869876
size="icon"
@@ -894,7 +901,9 @@ export const ShowBilling = () => {
894901
variant="outline"
895902
size="icon"
896903
className="h-8 w-8"
897-
onClick={() => setStartupServerQuantity((q) => q + 1)}
904+
onClick={() =>
905+
setStartupServerQuantity((q) => q + 1)
906+
}
898907
>
899908
<PlusIcon className="h-4 w-4" />
900909
</Button>
@@ -1025,17 +1034,21 @@ export const ShowBilling = () => {
10251034
<p className="text-base font-semibold tracking-tight text-muted-foreground">
10261035
${" "}
10271036
{(
1028-
calculatePrice(hobbyServerQuantity, isAnnual) / 12
1037+
calculatePrice(
1038+
hobbyServerQuantity,
1039+
isAnnual,
1040+
) / 12
10291041
).toFixed(2)}{" "}
10301042
/ Month USD
10311043
</p>
10321044
</div>
10331045
) : (
10341046
<p className="text-2xl font-semibold tracking-tight text-primary ">
10351047
${" "}
1036-
{calculatePrice(hobbyServerQuantity, isAnnual).toFixed(
1037-
2,
1038-
)}{" "}
1048+
{calculatePrice(
1049+
hobbyServerQuantity,
1050+
isAnnual,
1051+
).toFixed(2)}{" "}
10391052
USD
10401053
</p>
10411054
)}
@@ -1089,7 +1102,9 @@ export const ShowBilling = () => {
10891102
onClick={() => {
10901103
if (hobbyServerQuantity <= 1) return;
10911104

1092-
setHobbyServerQuantity(hobbyServerQuantity - 1);
1105+
setHobbyServerQuantity(
1106+
hobbyServerQuantity - 1,
1107+
);
10931108
}}
10941109
>
10951110
<MinusIcon className="h-4 w-4" />
@@ -1106,7 +1121,9 @@ export const ShowBilling = () => {
11061121
<Button
11071122
variant="outline"
11081123
onClick={() => {
1109-
setHobbyServerQuantity(hobbyServerQuantity + 1);
1124+
setHobbyServerQuantity(
1125+
hobbyServerQuantity + 1,
1126+
);
11101127
}}
11111128
>
11121129
<PlusIcon className="h-4 w-4" />

apps/dokploy/components/dashboard/settings/users/show-users.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,18 @@ export const ShowUsers = () => {
8080
</div>
8181
) : (
8282
<div className="flex flex-col gap-4 min-h-[25vh]">
83-
{hasCustomRolesWithoutLicense && (
84-
<AlertBlock type="warning">
85-
You have{" "}
86-
{membersWithCustomRoles?.length === 1
87-
? "1 user"
88-
: `${membersWithCustomRoles?.length} users`}{" "}
89-
assigned to custom roles. Custom roles will not work
90-
without a valid Enterprise license. Please activate
91-
your license or change these users to a free role
92-
(Admin or Member).
93-
</AlertBlock>
94-
)}
83+
{hasCustomRolesWithoutLicense && (
84+
<AlertBlock type="warning">
85+
You have{" "}
86+
{membersWithCustomRoles?.length === 1
87+
? "1 user"
88+
: `${membersWithCustomRoles?.length} users`}{" "}
89+
assigned to custom roles. Custom roles will not work
90+
without a valid Enterprise license. Please activate your
91+
license or change these users to a free role (Admin or
92+
Member).
93+
</AlertBlock>
94+
)}
9595
<Table>
9696
<TableHeader>
9797
<TableRow>

0 commit comments

Comments
 (0)