Skip to content

Conversation

HarshMN2345
Copy link
Member

@HarshMN2345 HarshMN2345 commented Sep 9, 2025

What does this PR do?

replaced AllProjectCount with data.projects.total
added tooltip

Test Plan

image

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

yes

Summary by CodeRabbit

  • New Features

    • Create Project button now shows a disabled state with a tooltip when you’ve reached your project limit; tooltip displays the current project limit.
  • Bug Fixes

    • Project creation availability now accurately reflects your current project count and plan limits, ensuring the button is only enabled when creation is allowed.

Copy link

appwrite bot commented Sep 9, 2025

Console

Project ID: 688b7bf400350cbd60e9

Sites (2)
Site Status Logs Preview QR
 console-qa
688b7cf6003b1842c9dc
Ready Ready View Logs Preview URL QR Code
 console-cloud
688b7c18002b9b871a8f
Ready Ready View Logs Preview URL QR Code

Note

Appwrite has a Discord community with over 16 000 members.

Copy link
Contributor

coderabbitai bot commented Sep 9, 2025

Walkthrough

  • Replaced use of data.allProjectsCount with data.projects.total for project creation gating.
  • Added reactive helpers: reachedProjectLimit (isCloud && limit <= data.projects.total) and projectsLimit (getServiceLimit('projects')).
  • Changed Create Project button rendering: when projectCreationDisabled && reachedProjectLimit show a disabled Button inside a Tooltip with message "You have reached your limit of {projectsLimit} projects."; otherwise render the interactive Create Project button.
  • Tooltip message now uses the dynamic projectsLimit value.

Possibly related PRs

Suggested reviewers

  • lohanidamodar
  • ItzNotABug

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly captures the core purpose of the changeset by indicating this PR fixes the issue where the “Create Project” button was disabled on a new organization, directly reflecting the main bug being addressed. It is clear, specific, and focuses on the primary change without extraneous detail.
Description Check ✅ Passed The description clearly states the key modifications—replacing AllProjectCount with data.projects.total and adding a tooltip—and includes a test plan screenshot that relates directly to the UI update, demonstrating that it is on-topic and sufficiently informative.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-SER-361-Create-project-disabled-on-new-org

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
src/routes/(console)/organization-[organization]/+page.svelte (3)

82-89: Compute service limit once and reuse in derived flags

Avoid repeating getServiceLimit('projects') and derive projectCreationDisabled from reachedProjectLimit for consistency and easier reasoning.

Apply:

-    $: projectCreationDisabled =
-        (isCloud && getServiceLimit('projects') <= data.projects.total) ||
-        (isCloud && $readOnly && !GRACE_PERIOD_OVERRIDE) ||
-        !$canWriteProjects;
-
-    $: reachedProjectLimit = isCloud && getServiceLimit('projects') <= data.projects.total;
-    $: projectsLimit = getServiceLimit('projects');
+    $: projectsLimit = getServiceLimit('projects');
+    $: reachedProjectLimit = isCloud && projectsLimit <= data.projects.total;
+    $: projectCreationDisabled =
+        reachedProjectLimit ||
+        (isCloud && $readOnly && !GRACE_PERIOD_OVERRIDE) ||
+        !$canWriteProjects;

135-147: Make tooltip discoverable via keyboard on disabled action

The disabled Button won’t be focusable; the wrapping <div> is not focusable either, so keyboard users likely can’t access the tooltip.

Minimal fix: make the wrapper focusable (and optionally label it).

-                <Tooltip placement="bottom">
-                    <div>
+                <Tooltip placement="bottom">
+                    <div tabindex="0" aria-label={`Create project disabled: reached limit of ${projectsLimit} projects`}>
                         <Button event="create_project" disabled>
                             <Icon icon={IconPlus} slot="start" size="s" />
                             Create project
                         </Button>
                     </div>

Verification: Tab to the “Create project” area when at the limit. Expect: focus lands on the wrapper and the tooltip appears on focus.


90-101: Unify command palette action with button logic

The command currently does showCreate = true; which bypasses the cloud path. Reuse handleCreateProject() so both paths behave identically.

-            callback: () => {
-                showCreate = true;
-            },
+            callback: () => handleCreateProject(),
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5b98696 and 521b289.

📒 Files selected for processing (1)
  • src/routes/(console)/organization-[organization]/+page.svelte (2 hunks)
🧰 Additional context used
🪛 GitHub Actions: Tests
src/routes/(console)/organization-[organization]/+page.svelte

[error] 1-1: Prettier formatting check failed. Run 'prettier --write' to fix code style issues.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: e2e
🔇 Additional comments (2)
src/routes/(console)/organization-[organization]/+page.svelte (2)

148-155: LGTM: Clear fallback for non-limit disabled states

Rendering the regular Button (with disabled={projectCreationDisabled}) when not strictly at the limit keeps behavior consistent (e.g., read-only, no write permission). Looks good.


144-145: Trailing space fix confirmed; Prettier checks passing

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/routes/(console)/organization-[organization]/+page.svelte (2)

135-147: Make the tooltip reachable via keyboard; fix pluralization

Disabled buttons aren’t focusable, so the tooltip can be unreachable for keyboard users. Wrap with a focusable element and associate the tooltip content. Also fix “1 projects” grammar.

-            {#if projectCreationDisabled && reachedProjectLimit}
-                <Tooltip placement="bottom">
-                    <div>
-                        <Button event="create_project" disabled>
+            {#if projectCreationDisabled && reachedProjectLimit}
+                <Tooltip placement="bottom">
+                    <span tabindex="0" aria-describedby="create-project-limit-tooltip">
+                        <Button event="create_project" disabled>
                             <Icon icon={IconPlus} slot="start" size="s" />
                             Create project
-                        </Button>
-                    </div>
-                    <span slot="tooltip">
-                        You have reached your limit of {projectsLimit} projects.
-                    </span>
+                        </Button>
+                    </span>
+                    <span slot="tooltip" id="create-project-limit-tooltip">
+                        You have reached your limit of {projectsLimit} {projectsLimit === 1 ? 'project' : 'projects'}.
+                    </span>
                 </Tooltip>

If Pink Tooltip supports focus-trigger explicitly (e.g., a prop), enable it here for consistent a11y.


82-89: Store and reuse the service limit and drop the 0/undefined guard—unlimited is already Infinity

-$: projectCreationDisabled =
-    (isCloud && getServiceLimit('projects') <= data.projects.total) ||
-    (isCloud && $readOnly && !GRACE_PERIOD_OVERRIDE) ||
-    !$canWriteProjects;
-
-$: reachedProjectLimit = isCloud && getServiceLimit('projects') <= data.projects.total;
-$: projectsLimit = getServiceLimit('projects');
+$: rawProjectsLimit = getServiceLimit('projects');
+$: reachedProjectLimit = isCloud && rawProjectsLimit <= data.projects.total;
+$: projectsLimit = rawProjectsLimit;
+
+$: projectCreationDisabled =
+    reachedProjectLimit ||
+    (isCloud && $readOnly && !GRACE_PERIOD_OVERRIDE) ||
+    !$canWriteProjects;

Unlimited limits are returned as Infinity by getServiceLimit('projects'), so there’s no need to normalize 0 or undefined. Deduping the call improves clarity and maintenance.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 521b289 and 1e99b58.

📒 Files selected for processing (1)
  • src/routes/(console)/organization-[organization]/+page.svelte (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: e2e
  • GitHub Check: build
🔇 Additional comments (1)
src/routes/(console)/organization-[organization]/+page.svelte (1)

148-155: LGTM on the enabled path

The enabled Create Project button correctly routes through handleCreateProject, honoring cloud vs. self-hosted behavior and permissions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant