Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

fix(web): locked add-project button in the sidebar shows a plus, not a gem (#17176)

moaazf35d4a9b590e
diff --git a/brain/knowledge/platform-editions-ee/ee-platform-plans-billing.md b/brain/knowledge/platform-editions-ee/ee-platform-plans-billing.md
index edf0cff18d1..e9a204768f8 100644
--- a/brain/knowledge/platform-editions-ee/ee-platform-plans-billing.md
+++ b/brain/knowledge/platform-editions-ee/ee-platform-plans-billing.md
@@ -27,7 +27,7 @@ Billing and entitlements are powered by [Autumn](https://useautumn.com). Each pl
- The daily report's directory, service, and telemetry symbols are named `license-key-usage-report`, but its **persisted system-job name is still `billing-usage-report`** (`BILLING_USAGE_REPORT` in `system-jobs/common.ts`), and its emitted event names are unchanged too. Both strings are keys that outlive a deploy — the job name identifies the already-scheduled row, the event names identify history already captured — so renaming either orphans what is out there instead of renaming it. They read as leftovers of the rename; they are not.
- Never read entitlements inline from Autumn on a request path — always the `platform_plan` projection + Redis caches (`isBillingEnforced` is a plain Redis read defaulting to `false`, i.e. fail open).
- Active flows are unlimited in the new plans (projected `null`); `checkActiveFlowsExceededLimit` still runs on flow enable/publish but only binds when a limit is set.
-- **`billedTeamProjectsLimit: 0` hides the create-project control rather than crowning it.** The primary rail's `RailPinnedProjects` renders its create button only when the limit is non-zero, so a plan with no team projects at all shows no button in the rail — only the platform admin table keeps a crowned one. Testing a crowned rail control therefore needs a limit above zero that is fully consumed, not a limit of zero. `null` is unlimited, `0` is none, and the two read alike in a plan row.
+- **`billedTeamProjectsLimit: 0` hides the create-project control rather than locking it.** The primary rail's `RailPinnedProjects` renders its create button only when the limit is non-zero, so a plan with no team projects at all shows no button in the rail — only the platform admin table keeps one. Testing a locked rail control therefore needs a limit above zero that is fully consumed, not a limit of zero. A locked rail button keeps its plain plus; only the admin table's labeled button shows a gem. `null` is unlimited, `0` is none, and the two read alike in a plan row.
- **`openDialog()` from `useManagePlanDialogStore` is a silent no-op on Community, so any upgrade button wired to it is dead there.** `<ManagePlanDialog />` is mounted behind `edition !== ApEdition.COMMUNITY` in all three layouts (`platform-layout`, `project-layout`, `builder-layout`), while the store is a plain Zustand flag that any caller can flip with nothing listening, so the click closes what it was in and shows nothing. Every upgrade surface therefore has to branch on `isCommunity` itself and offer the sales route instead. `FeatureSample`, `FeatureTeaser` and `useTeamProjectLimitGuard` all do; the last of those did not until the team-project limit dialog was fixed, having shipped a dead `Explore plans` on self-hosted installs since well before the platform admin redesign. Check the branch exists whenever you add one.
- **`RequestTrial` lives in `features/billing/components/`, not `app/components/`.** Anything under `features/*` that needs the sales call to action - the plan guards and the upgrade dialog - cannot reach into `app/`, because the `import/no-restricted-paths` zone is one-directional. Keeping it in billing lets both layers use it, since every `app/` caller is importing downward. It exports `FeatureKey`, the union the `activepieces.com/sales` page reads from the query string, and every `PLATFORM_FEATURES` entry carries one so a gated surface can hand over the right key.
- Initial plan by edition: CE/EE → `OPEN_SOURCE_PLAN`, Cloud → `AUTUMN_FREE_PLAN`. CE and `TESTING` environments skip enrollment/sync entirely.
diff --git a/packages/web/src/features/projects/components/create-project-button.tsx b/packages/web/src/features/projects/components/create-project-button.tsx
index 22855f3b88c..7fdc29ddb98 100644
--- a/packages/web/src/features/projects/components/create-project-button.tsx
+++ b/packages/web/src/features/projects/components/create-project-button.tsx
@@ -1,6 +1,6 @@
import { ProjectWithLimits, TelemetryEventName } from '@activepieces/shared';
import { t } from 'i18next';
-import { Gem, Plus } from 'lucide-react';
+import { Plus } from 'lucide-react';
import React from 'react';
import { AnimatedIconButton } from '@/components/custom/animated-icon-button';
@@ -111,7 +111,7 @@ function triggerFor({ variant, className, crown, locked }: TriggerForParams) {
className={cn('hover:bg-gray-4', className)}
{...control}
>
- {locked ? <Gem className="text-accent-11" /> : <Plus />}
+ <Plus />
</Button>
);
case 'full':
@@ -141,11 +141,7 @@ function triggerFor({ variant, className, crown, locked }: TriggerForParams) {
className={cn('text-gray-11 gap-2', className)}
{...control}
>
- {locked ? (
- <Gem className="size-4 text-accent-11" />
- ) : (
- <Plus className="size-4" />
- )}
+ <Plus className="size-4" />
<span>{t('Add team project')}</span>
</SidebarMenuButton>
);
diff --git a/packages/web/test/app/billing/feature-gating.test.tsx b/packages/web/test/app/billing/feature-gating.test.tsx
index 167b056f4fc..da44e602b54 100644
--- a/packages/web/test/app/billing/feature-gating.test.tsx
+++ b/packages/web/test/app/billing/feature-gating.test.tsx
@@ -4,7 +4,7 @@
/* eslint-disable jest-dom/prefer-in-document -- @testing-library/jest-dom is not a dependency of packages/web */
/* eslint-disable testing-library/no-container, testing-library/no-node-access -- <video> has no implicit ARIA role */
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
-import { render, screen, fireEvent } from '@testing-library/react';
+import { render, screen, fireEvent, within } from '@testing-library/react';
import * as React from 'react';
import { beforeEach, describe, expect, it, vi } from 'vitest';
@@ -19,6 +19,8 @@ vi.mock('lucide-react', async (importOriginal) => ({
...(await importOriginal<Record<string, unknown>>()),
Gem: (props: Record<string, unknown>) =>
React.createElement('span', { ...props, 'data-testid': 'gem' }),
+ Plus: (props: Record<string, unknown>) =>
+ React.createElement('span', { ...props, 'data-testid': 'plus' }),
}));
vi.mock('@/hooks/platform-hooks', () => ({
@@ -147,12 +149,16 @@ describe('create project gating', () => {
expect(screen.getByTestId('gem')).toBeDefined();
});
- it('marks every variant with a gem, including the sidebar rail', () => {
- teamProjectsLimit = 0;
+ it('keeps the plus on the sidebar rail and names the lock in its label', () => {
+ teamProjectsLimit = 3;
renderWithQueryClient(
- <CreateProjectButton variant="icon" projects={usedTeamProjects(0)} />,
+ <CreateProjectButton variant="icon" projects={usedTeamProjects(3)} />,
);
- expect(screen.getByTestId('gem')).toBeDefined();
+ const button = screen.getByRole('button', {
+ name: 'Create Project, Requires a plan upgrade',
+ });
+ expect(within(button).getByTestId('plus')).toBeDefined();
+ expect(screen.queryByTestId('gem')).toBeNull();
});
it('refuses on the click instead of after the form is filled in', () => {