Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

SSC: Handle team=1 input on checkout form#62906

Merged
vdavid merged 6 commits into
mainfrom
dv/ssc-team-feature-to-checkout-form
May 28, 2024
Merged

SSC: Handle team=1 input on checkout form#62906
vdavid merged 6 commits into
mainfrom
dv/ssc-team-feature-to-checkout-form

Conversation

@vdavid

@vdavid vdavid commented May 24, 2024

Copy link
Copy Markdown
Contributor

We already have this on the old SSC front end since my earlier PR https://github.com/sourcegraph/self-serve-cody/pull/779. Now bringing the same feature to this page because we'll migrate our front end to this one, so we'll need it.

Note: This PR contains a bunch of random small fixes. Sorry for polluting the PR with so many little changes. I promise they are trivial, and I carefully checked the changes.

Test plan

Tested that with the ?team=1 parameter, the page displays the seat number setting UI, and without it, it doesn't.
For the refactors, CI.

@cla-bot cla-bot Bot added the cla-signed label May 24, 2024
export interface Call<Resp> {
method: 'GET' | 'POST' | 'PATCH' | 'DELETE'
urlSuffix: string
requestBody?: any

@vdavid vdavid May 24, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ESLint complained about the explicit any and suggested either never or unknown. I went with unknown because never seemed like a non-solution.

// https://maxrozen.com/race-conditions-fetching-data-react-with-useeffect
let ignore = false

;(async () => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought this was fine with the linter but it wasn't because it discarded the returned promise. I refactored it to this longer format because this one may be obscure to some devs, and we use it very rarely in the codebase.

interval: 'monthly',
seats: 1,
// If creating a team, we set seatCount=0, which means the user can adjust the seat count.
seats: creatingTeam ? 0 : 1,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the meat of the PR, really. It's a copy of the functionality on the old SSC site, and also is very simple.

@vdavid vdavid requested a review from a team May 24, 2024 15:34
@vdavid vdavid merged commit 03f82d6 into main May 28, 2024
@vdavid vdavid deleted the dv/ssc-team-feature-to-checkout-form branch May 28, 2024 11:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants