Skip to content

Commit 33112dd

Browse files
0xsemajclaude
andcommitted
feat(licenses): always show create button, disable only above 5 licenses
- Add disabled prop to CreateAppButton - Show the button in LicenseList header for all states (empty and non-empty) - Disable it when the account has more than 5 developer licenses Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 7a908a6 commit 33112dd

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

src/app/app/list/components/CreateAppButton/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,19 @@ import { CreateAppModal } from '@/components/CreateAppModal';
66

77
interface Props {
88
className?: string;
9+
disabled?: boolean;
910
}
1011

11-
const CreateAppButton: React.FC<Props> = ({ className = 'dark with-icon' }) => {
12+
const CreateAppButton: React.FC<Props> = ({ className = 'dark with-icon', disabled }) => {
1213
const [isModalOpen, setIsModalOpen] = React.useState(false);
1314
return (
1415
<>
1516
<CreateAppModal isOpen={isModalOpen} handleIsOpen={setIsModalOpen} />
16-
<Button className={clsx(className, '!h-10')} onClick={() => setIsModalOpen(true)}>
17+
<Button
18+
className={clsx(className, '!h-10')}
19+
onClick={() => setIsModalOpen(true)}
20+
disabled={disabled}
21+
>
1722
<PlusIcon className="w-4 h-4" />
1823
Create a license
1924
</Button>

src/app/license/list/LicenseList.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { FC } from 'react';
22
import { LicenseCard } from '@/components/LicenseCard';
33
import EmptyList from '@/app/app/list/components/EmptyList';
4+
import CreateAppButton from '@/app/app/list/components/CreateAppButton';
45
import { FragmentType, gql, useFragment } from '@/gql';
56
import './LicenseList.css';
67

8+
const MAX_LICENSES = 5;
9+
710
export const GET_LICENSE_SUMMARIES = gql(`
811
fragment DeveloperLicenseSummariesOnConnection on DeveloperLicenseConnection {
912
nodes {
@@ -18,11 +21,13 @@ interface Props {
1821

1922
export const LicenseList: FC<Props> = ({ licenseConnection }) => {
2023
const fragment = useFragment(GET_LICENSE_SUMMARIES, licenseConnection);
24+
const atLimit = fragment.nodes.length > MAX_LICENSES;
2125

2226
return (
2327
<div className="license-list-content">
2428
<div className="description">
2529
<p className="title">Your Developer Licenses</p>
30+
<CreateAppButton disabled={atLimit} />
2631
</div>
2732
{fragment.nodes.length ? (
2833
<div className="license-list">

0 commit comments

Comments
 (0)