-
Notifications
You must be signed in to change notification settings - Fork 186
Fix: create project disabled on new org #2342
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
base: main
Are you sure you want to change the base?
Conversation
ConsoleProject ID: Sites (2)
Note Appwrite has a Discord community with over 16 000 members. |
Walkthrough
Possibly related PRs
Suggested reviewers
Pre-merge checks (3 passed)✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests
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. Comment |
There was a problem hiding this 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 flagsAvoid repeating
getServiceLimit('projects')
and deriveprojectCreationDisabled
fromreachedProjectLimit
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 actionThe 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 logicThe command currently does
showCreate = true;
which bypasses the cloud path. ReusehandleCreateProject()
so both paths behave identically.- callback: () => { - showCreate = true; - }, + callback: () => handleCreateProject(),
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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 statesRendering 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
There was a problem hiding this 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 pluralizationDisabled 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 alreadyInfinity
-$: 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
bygetServiceLimit('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
📒 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 pathThe enabled Create Project button correctly routes through
handleCreateProject
, honoring cloud vs. self-hosted behavior and permissions.
What does this PR do?
replaced AllProjectCount with data.projects.total
added tooltip
Test Plan
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
Bug Fixes