feat(plg): Invite users on Cody Dashboard#63375
Conversation
| </PageHeader.Heading> | ||
| </PageHeader> | ||
|
|
||
| {isAdmin && <InviteUsers telemetryRecorder={telemetryRecorder} />} |
There was a problem hiding this comment.
By now we are sure that the subscription summary is successfully loaded and user is admin. We can pass summary as a prop and avoid query status-checking logic in the InviteUsers component.
There was a problem hiding this comment.
The user is not always an admin on this page. This page also loads for non-admins.
Also, I tried to make the InviteUsers component independent of the embedding page, allowing that we may not have the subscription summary elsewhere on the page.
The isAdmin check is only there because the InviteUsers component uses the useCurrentSubscription hook, which is fairly expensive, so wanted to make sure that it doesn't load for non-admins.
There was a problem hiding this comment.
@vdavid, I mean that InviteUsers component is only rendered for admins and can get subscription summary as prop to avoid dealing with subscription summary query states.
There was a problem hiding this comment.
By now we are sure that the subscription summary is successfully loaded and user is admin
"By now" refers to line 147
There was a problem hiding this comment.
Is this your suggestion? https://github.com/sourcegraph/sourcegraph/pull/63383
Based on @taras-yemets's [feedback](https://github.com/sourcegraph/sourcegraph/pull/63375#discussion_r1647346730) on https://github.com/sourcegraph/sourcegraph/pull/63375 ## Test plan Just a refactor
Before this PR, you could only invite teammates on the
/cody/team/managepage.Now you can also do it on the Cody Dashboard, like @rrhyne suggested here.
Test plan
Here is a 30-sec Loom demoing the new behavior.
And a screenshot: