make paid alert position more consistent on resource

This commit is contained in:
miloschwartz
2026-06-11 12:37:54 -07:00
parent 5f0bc71bcd
commit 3e977ba00d
2 changed files with 54 additions and 77 deletions
+1 -1
View File
@@ -984,7 +984,7 @@
"sharedPolicy": "Shared Policy", "sharedPolicy": "Shared Policy",
"sharedPolicyNoneDescription": "This resource has its own policy.", "sharedPolicyNoneDescription": "This resource has its own policy.",
"resourceSharedPolicyOwnDescription": "This resource has its own authentication and access rules controls.", "resourceSharedPolicyOwnDescription": "This resource has its own authentication and access rules controls.",
"resourceSharedPolicyInheritedDescription": "This resource inherits authentication and access rules controls from <policyLink>{policyName}</policyLink>.", "resourceSharedPolicyInheritedDescription": "This resource inherits from <policyLink>{policyName}</policyLink>.",
"resourceSharedPolicyAuthenticationNotice": "This resource is using a shared policy. Some authentication settings can be edited on this resource to add to the policy. To change the underlying policy, you must edit to <policyLink>{policyName}</policyLink>.", "resourceSharedPolicyAuthenticationNotice": "This resource is using a shared policy. Some authentication settings can be edited on this resource to add to the policy. To change the underlying policy, you must edit to <policyLink>{policyName}</policyLink>.",
"resourceSharedPolicyRulesNotice": "This resource is using a shared policy. Some access rules can be edited on this resource. To change the underlying policy, you must edit <policyLink>{policyName}</policyLink>.", "resourceSharedPolicyRulesNotice": "This resource is using a shared policy. Some access rules can be edited on this resource. To change the underlying policy, you must edit <policyLink>{policyName}</policyLink>.",
"resourceUsersRoles": "Access Controls", "resourceUsersRoles": "Access Controls",
@@ -169,18 +169,25 @@ export default function ResourceMaintenancePage() {
{ {
id: "automatic", id: "automatic",
title: `${t("automatic")} (${t("recommended")})`, title: `${t("automatic")} (${t("recommended")})`,
description: t("automaticModeDescription"), description: t("automaticModeDescription")
disabled: isMaintenanceDisabled
}, },
{ {
id: "forced", id: "forced",
title: t("forced"), title: t("forced"),
description: t("forcedModeDescription"), description: t("forcedModeDescription")
disabled: isMaintenanceDisabled
} }
]; ];
return ( return (
<>
<PaidFeaturesAlert tiers={tierMatrix.maintencePage} />
<div
className={
isMaintenanceDisabled
? "pointer-events-none opacity-50"
: undefined
}
>
<SettingsContainer> <SettingsContainer>
<SettingsSection> <SettingsSection>
<SettingsSectionHeader> <SettingsSectionHeader>
@@ -193,7 +200,6 @@ export default function ResourceMaintenancePage() {
</SettingsSectionHeader> </SettingsSectionHeader>
<SettingsSectionBody> <SettingsSectionBody>
<PaidFeaturesAlert tiers={tierMatrix.maintencePage} />
<SettingsSectionForm variant="half"> <SettingsSectionForm variant="half">
<Form {...maintenanceForm}> <Form {...maintenanceForm}>
<form <form
@@ -205,12 +211,7 @@ export default function ResourceMaintenancePage() {
<FormField <FormField
control={maintenanceForm.control} control={maintenanceForm.control}
name="maintenanceModeEnabled" name="maintenanceModeEnabled"
render={({ field }) => { render={({ field }) => (
const isDisabled = !isPaidUser(
tierMatrix.maintencePage
);
return (
<FormItem> <FormItem>
<FormControl> <FormControl>
<SwitchInput <SwitchInput
@@ -224,27 +225,19 @@ export default function ResourceMaintenancePage() {
description={t( description={t(
"enableMaintenanceModeDescription" "enableMaintenanceModeDescription"
)} )}
disabled={
isDisabled
}
onCheckedChange={( onCheckedChange={(
val val
) => { ) => {
if (
!isDisabled
) {
maintenanceForm.setValue( maintenanceForm.setValue(
"maintenanceModeEnabled", "maintenanceModeEnabled",
val val
); );
}
}} }}
/> />
</FormControl> </FormControl>
<FormMessage /> <FormMessage />
</FormItem> </FormItem>
); )}
}}
/> />
</SettingsFormCell> </SettingsFormCell>
@@ -329,11 +322,6 @@ export default function ResourceMaintenancePage() {
<FormControl> <FormControl>
<Input <Input
{...field} {...field}
disabled={
!isPaidUser(
tierMatrix.maintencePage
)
}
placeholder="We'll be back soon!" placeholder="We'll be back soon!"
/> />
</FormControl> </FormControl>
@@ -365,11 +353,6 @@ export default function ResourceMaintenancePage() {
<Textarea <Textarea
{...field} {...field}
rows={4} rows={4}
disabled={
!isPaidUser(
tierMatrix.maintencePage
)
}
placeholder={t( placeholder={t(
"maintenancePageMessagePlaceholder" "maintenancePageMessagePlaceholder"
)} )}
@@ -402,11 +385,6 @@ export default function ResourceMaintenancePage() {
<FormControl> <FormControl>
<Input <Input
{...field} {...field}
disabled={
!isPaidUser(
tierMatrix.maintencePage
)
}
placeholder={t( placeholder={t(
"maintenanceTime" "maintenanceTime"
)} )}
@@ -434,10 +412,7 @@ export default function ResourceMaintenancePage() {
<Button <Button
type="submit" type="submit"
loading={maintenanceSaveLoading} loading={maintenanceSaveLoading}
disabled={ disabled={maintenanceSaveLoading}
maintenanceSaveLoading ||
!isPaidUser(tierMatrix.maintencePage)
}
form="maintenance-settings-form" form="maintenance-settings-form"
> >
{t("saveSettings")} {t("saveSettings")}
@@ -445,5 +420,7 @@ export default function ResourceMaintenancePage() {
</SettingsSectionFooter> </SettingsSectionFooter>
</SettingsSection> </SettingsSection>
</SettingsContainer> </SettingsContainer>
</div>
</>
); );
} }