-
Notifications
You must be signed in to change notification settings - Fork 24
feat(docs): auth dropdown selector #4870
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
Merged
Merged
Changes from 25 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
59e87a3
feat(docs): support multiple security schemes in API explorer with OR…
devin-ai-integration[bot] cee1ca4
feat(docs): implement independent auth scheme selection in API explorer
devin-ai-integration[bot] 7772a6f
fix(docs): move client hooks from server-only component to fix CI lint
devin-ai-integration[bot] 4ea5849
fix(docs): remove unused lang parameter from PlaygroundAuthorizationF…
devin-ai-integration[bot] 278d4ac
fix(docs): apply biome formatting to fix CI lint
devin-ai-integration[bot] 246f85d
select auths
kennyderek 76501de
dropdown selector
kennyderek b505759
format
kennyderek aecdcf3
vercel comment
kennyderek 7c7f256
Merge branch 'app' into kenny/auth-selector-playground
kennyderek b89824c
Merge branch 'app' into kenny/auth-selector-playground
fern-support 233c886
Add auth type name
kennyderek f09817d
Merge branch 'app' into kenny/auth-selector-playground
kennyderek b40ed8e
with desc
kennyderek 8456090
Merge branch 'app' into kenny/auth-selector-playground
kennyderek 4f65d96
format
kennyderek f677ff6
Merge branch 'app' into kenny/auth-selector-playground
kennyderek db25aaa
Merge branch 'app' into kenny/auth-selector-playground
fern-support 9945cd4
store everything by auth key
kennyderek b721f98
format
kennyderek 6780b55
linkify function
kennyderek 5a7b869
turn green
kennyderek 269041b
Update packages/fern-docs/bundle/src/components/playground/auth/linki…
fern-support 7de5682
format
kennyderek 66add62
format
kennyderek 79e48be
vercel comment
kennyderek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
packages/fern-docs/bundle/src/components/playground/auth/PlaygroundAuthSwitcher.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| "use client"; | ||
|
|
||
| import type { EndpointContext, WebSocketContext } from "@fern-api/fdr-sdk/api-definition"; | ||
| import { useAtomValue } from "jotai"; | ||
| import { PLAYGROUND_SELECTED_AUTH_TYPE_ATOM } from "@/state/playground"; | ||
| import { getAuthKey } from "../utils"; | ||
| import { PlaygroundAuthorizationFormCard } from "./PlaygroundAuthorizationFormCard"; | ||
|
|
||
| interface PlaygroundAuthSwitcherProps { | ||
| context: EndpointContext | WebSocketContext; | ||
| oauthReferencedContext?: EndpointContext; | ||
| lang: string; | ||
| } | ||
|
|
||
| export function PlaygroundAuthSwitcher({ context, oauthReferencedContext, lang }: PlaygroundAuthSwitcherProps) { | ||
| const selectedAuthId = useAtomValue(PLAYGROUND_SELECTED_AUTH_TYPE_ATOM); | ||
|
|
||
| // Find the index of the auth that matches the user's preference | ||
| let selectedIndex = 0; | ||
| if (selectedAuthId) { | ||
| const foundIndex = context.authsWithKeys.findIndex((authWithKey) => getAuthKey(authWithKey) === selectedAuthId); | ||
| if (foundIndex !== -1) { | ||
| selectedIndex = foundIndex; | ||
| } | ||
| } | ||
|
|
||
| if (context.authsWithKeys.length === 0) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <PlaygroundAuthorizationFormCard | ||
| context={context} | ||
| oauthReferencedContext={oauthReferencedContext} | ||
| lang={lang} | ||
| /> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.