0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-03-10 22:22:45 -05:00

fix(console): fix webhook modal paywall for enterprise plan (#6698)

* fix(console): fix webhook modal paywall for enterprise plan

* fix: fix styles

* chore: update code

* chore: update code
This commit is contained in:
Darcy Ye 2024-10-22 11:02:01 +08:00 committed by GitHub
parent d52f25142d
commit c7f326edce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 14 deletions

View file

@ -1,6 +1,7 @@
import { type ReactNode } from 'react';
import Button from '@/ds-components/Button';
import { contactEmailLink } from '@/consts';
import { LinkButton } from '@/ds-components/Button';
import useTenantPathname from '@/hooks/use-tenant-pathname';
import styles from './index.module.scss';
@ -9,27 +10,36 @@ type Props = {
readonly children: ReactNode;
readonly isLoading?: boolean;
readonly onClickUpgrade?: () => void;
readonly isContactUsPreferred?: boolean;
};
function QuotaGuardFooter({ children, isLoading, onClickUpgrade }: Props) {
function QuotaGuardFooter({ children, isLoading, onClickUpgrade, isContactUsPreferred }: Props) {
const { navigate } = useTenantPathname();
return (
<div className={styles.container}>
<div className={styles.description}>{children}</div>
<Button
<LinkButton
size="large"
type="primary"
title="upsell.upgrade_plan"
isLoading={isLoading}
onClick={() => {
if (onClickUpgrade) {
onClickUpgrade();
return;
}
// Navigate to subscription page by default
navigate('/tenant-settings/subscription');
}}
{...(isContactUsPreferred
? {
title: 'general.contact_us_action',
href: contactEmailLink,
targetBlank: 'noopener',
}
: {
title: 'upsell.upgrade_plan',
isLoading,
onClick: () => {
if (onClickUpgrade) {
onClickUpgrade();
return;
}
// Navigate to subscription page by default
navigate('/tenant-settings/subscription');
},
})}
/>
</div>
);

View file

@ -64,7 +64,7 @@ function CreateForm({ onClose }: Props) {
subtitle="webhooks.create_form.subtitle"
footer={
shouldBlockCreation ? (
<QuotaGuardFooter>
<QuotaGuardFooter isContactUsPreferred={isEnterprisePlan}>
<Trans
components={{
a: <ContactUsPhraseLink />,