-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add org selection dropdown to org auth token button #7716
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Since this is sadly hard to test on the preview 😬 Just to clarify
I like it! |
Correct! See sentry-docs/src/components/codeBlock.tsx Lines 214 to 218 in 4290615
Also correct! (See screenshot in PR description) |
Nice, that's what I figured but just to be extra clear :D Maybe @ArthurKnaus can also give it a review from a React perspective. From an outcome-perspective, I think this is great and will make this much more flexible to be used 🎉 |
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.
Nice feature, love it! 🎉
Mostly nitpicking from my side:
src/components/codeBlock.tsx
Outdated
| {status: 'none'} | ||
| {status: 'loading'} | ||
| {status: 'success'; token: string} | ||
| {status: 'error'} |
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.
nit: I would probably define the type TokenState
outside the component to keep the component cleaner 🤷
Same goes for the popper options.
src/components/codeBlock.tsx
Outdated
const [isOpen, setIsOpen] = useState(false); | ||
const [referenceEl, setReferenceEl] = useState<HTMLSpanElement>(null); | ||
const [dropdownEl, setDropdownEl] = useState<HTMLElement>(null); | ||
const {codeKeywords} = useContext(CodeContext); |
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.
nit: I would move the context subscription to the first line then it is easier to spot.
(as it is a dependency that component has)
src/components/codeBlock.tsx
Outdated
codeKeywords?.PROJECT?.forEach(projectKeyword => { | ||
orgSet.add(projectKeyword.ORG_SLUG); | ||
}); | ||
const orgs = [...orgSet]; |
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.
So it is clear further down the component that those are the slugs and not whole objects.
const orgs = [...orgSet]; | |
const orgSlugs = [...orgSet]; |
Co-authored-by: ArthurKnaus <[email protected]>
Added a dropdown to select an organization for the org auth token button. This should help make it more clear for which org a token is gonna be generated. Especially on pages where we don't have
___ORG_SLUG___
or___PROJECT_SLUG___
magic strings.Looks like this: