Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): team member limit nudge #6693

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 23 additions & 29 deletions apps/web/src/ee/clerk/components/CustomOrganizationProfile.tsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,38 @@
import { OrganizationProfile } from '@clerk/clerk-react';
import { FC } from 'react';
import { OrganizationProfile, useOrganization } from '@clerk/clerk-react';
import { OrganizationProfileTheme } from '@clerk/types';
import { ROUTES } from '../../../constants/routes';

// Hides OrganizationProfile sidebar + makes it fit the parent container
const OrganizationProfileAppearance = {
elements: {
pageScrollBox: {
padding: 0,
},
cardBox: {
display: 'block',
width: '100%',
height: '100%',
boxShadow: 'none',
},
navbar: {
display: 'none',
},
rootBox: {
width: '100%',
},
},
};

interface CustomOrganizationProfileProps {
// Hacky workaround to embed organization profile in user profile page
export const CustomOrganizationProfile = ({
appearance,
firstItem,
}: {
appearance: OrganizationProfileTheme;
firstItem: 'general' | 'members';
}
}) => {
const { organization } = useOrganization();

// Hacky workaround to embed organization profile in user profile page
export const CustomOrganizationProfile: FC<CustomOrganizationProfileProps> = ({ firstItem }) => {
if (firstItem === 'general') {
return (
<OrganizationProfile appearance={OrganizationProfileAppearance}>
<OrganizationProfile
appearance={appearance}
// @ts-ignore
__unstable_manageBillingUrl={ROUTES.MANAGE_ACCOUNT_BILLING}
__unstable_manageBillingMembersLimit={organization?.maxAllowedMemberships}
>
Comment on lines +20 to +21
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we need to make the same changes in the SettingsPage in the Dashboard?

<OrganizationProfile.Page label="general" />
<OrganizationProfile.Page label="members" />
</OrganizationProfile>
);
}

return (
<OrganizationProfile appearance={OrganizationProfileAppearance}>
<OrganizationProfile
appearance={appearance}
// @ts-ignore
__unstable_manageBillingUrl={ROUTES.MANAGE_ACCOUNT_BILLING}
__unstable_manageBillingMembersLimit={organization?.maxAllowedMemberships}
>
<OrganizationProfile.Page label="members" />
<OrganizationProfile.Page label="general" />
</OrganizationProfile>
Expand Down
13 changes: 4 additions & 9 deletions apps/web/src/ee/clerk/pages/ManageAccountPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import {
} from '@novu/novui/icons';
import { FeatureFlagsKeysEnum } from '@novu/shared';
import { useNavigate, useParams } from 'react-router-dom';
import { Title } from '@novu/novui';
import { MANAGE_ACCOUNT_ROUTE_SEGMENTS, ROUTES } from '../../../constants/routes';
import { useFeatureFlag } from '../../../hooks/useFeatureFlag';
import { BrandingPage } from '../../../pages/brand/BrandingPage';
import { BillingPage } from '../../billing/pages/BillingPage';
import { Title } from '@novu/novui';
import {
billingTitle,
clerkComponentAppearance,
Expand All @@ -24,6 +24,7 @@ import {
tabsStyles,
titleTab,
} from './ManageAccountPage.styles';
import { CustomOrganizationProfile } from '../components/CustomOrganizationProfile';

export default function ManageAccountPage() {
const navigate = useNavigate();
Expand Down Expand Up @@ -108,16 +109,10 @@ export default function ManageAccountPage() {
</UserProfile>
</Tabs.Panel>
<Tabs.Panel value={MANAGE_ACCOUNT_ROUTE_SEGMENTS.ORGANIZATION}>
<OrganizationProfile appearance={clerkComponentAppearance}>
<OrganizationProfile.Page label="general" />
<OrganizationProfile.Page label="members" />
</OrganizationProfile>
<CustomOrganizationProfile appearance={clerkComponentAppearance} firstItem="general" />
</Tabs.Panel>
<Tabs.Panel value={MANAGE_ACCOUNT_ROUTE_SEGMENTS.TEAM_MEMBERS}>
<OrganizationProfile appearance={clerkComponentAppearance}>
<OrganizationProfile.Page label="members" />
<OrganizationProfile.Page label="general" />
</OrganizationProfile>
<CustomOrganizationProfile appearance={clerkComponentAppearance} firstItem="members" />
</Tabs.Panel>
{!isV2Enabled && (
<Tabs.Panel value={MANAGE_ACCOUNT_ROUTE_SEGMENTS.BRANDING}>
Expand Down
Loading