-
Notifications
You must be signed in to change notification settings - Fork 610
feat: onboarding success step #3499
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 all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
00a3208
fix: validation issues
ogzhanolguncu 300710e
feat: add tRPC endpoint
ogzhanolguncu 5c0ecc9
fix: add suspense with fallabck
ogzhanolguncu db2c568
Merge branch 'main' into onboarding-trpc
ogzhanolguncu cffa854
feat: add workspace creation to the first step
ogzhanolguncu 948dcd6
feat: add run every step individually
ogzhanolguncu d6189a3
Merge branch 'main' into onboarding-trpc
ogzhanolguncu eb1d767
feat: success step
ogzhanolguncu 30937eb
feat: add control for skippiong
ogzhanolguncu 64aaed0
refactor: replace new onboarding
ogzhanolguncu 30424b8
feat: add mising user and help button
ogzhanolguncu 66520bc
feat: prevent unauthenticated user access
ogzhanolguncu dfdbf52
fix: add use client
ogzhanolguncu 4ec14b9
Merge branch 'main' of github.com:unkeyed/unkey into onboarding-success
ogzhanolguncu c718be4
fix: get rid of workspace param
ogzhanolguncu 8b57c8a
refactor: make shared key secret section
ogzhanolguncu ec906b2
chore: remove redundant workspace lookup
ogzhanolguncu b4aaf1e
fix: coderabbit issue
ogzhanolguncu e4ea2fb
chore: rephrase the error message
ogzhanolguncu faec061
Merge branch 'main' of github.com:unkeyed/unkey into onboarding-success
ogzhanolguncu a94fefb
chore: fmt
ogzhanolguncu 0b910ea
Merge branch 'main' into onboarding-success
ogzhanolguncu dda7d1a
fix: import path
ogzhanolguncu 66585e0
Merge branch 'onboarding-success' of github.com:unkeyed/unkey into on…
ogzhanolguncu d4d0b00
fix: wording
ogzhanolguncu 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
74 changes: 74 additions & 0 deletions
74
...dashboard/app/(app)/apis/[apiId]/_components/create-key/components/key-secret-section.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,74 @@ | ||
| "use client"; | ||
|
|
||
| import { SecretKey } from "@/app/(app)/apis/[apiId]/_components/create-key/components/secret-key"; | ||
| import { CircleInfo } from "@unkey/icons"; | ||
| import { Code, CopyButton, VisibleButton } from "@unkey/ui"; | ||
| import { useState } from "react"; | ||
|
|
||
| type KeySecretSectionProps = { | ||
| keyValue: string; | ||
| apiId: string; | ||
| className?: string; | ||
| secretKeyClassName?: string; | ||
| codeClassName?: string; | ||
| }; | ||
|
|
||
| export const KeySecretSection = ({ | ||
| keyValue, | ||
| apiId, | ||
| className, | ||
| secretKeyClassName = "bg-white dark:bg-black", | ||
| codeClassName, | ||
| }: KeySecretSectionProps) => { | ||
| const [showKeyInSnippet, setShowKeyInSnippet] = useState(false); | ||
|
|
||
| const split = keyValue.split("_") ?? []; | ||
| const maskedKey = | ||
| split.length >= 2 | ||
| ? `${split.at(0)}_${"*".repeat(split.at(1)?.length ?? 0)}` | ||
| : "*".repeat(split.at(0)?.length ?? 0); | ||
|
|
||
| const snippet = `curl -XPOST '${ | ||
| process.env.NEXT_PUBLIC_UNKEY_API_URL ?? "https://api.unkey.dev" | ||
| }/v1/keys.verifyKey' \\ | ||
| -H 'Content-Type: application/json' \\ | ||
| -d '{ | ||
| "key": "${keyValue}", | ||
| "apiId": "${apiId}" | ||
| }'`; | ||
|
|
||
| return ( | ||
| <div className={className}> | ||
| <div className="flex flex-col gap-2 items-start w-full"> | ||
| <div className="text-gray-12 text-sm font-semibold">Key Secret</div> | ||
| <SecretKey value={keyValue} title="API Key" className={secretKeyClassName} /> | ||
| <div className="text-gray-9 text-[13px] flex items-center gap-1.5"> | ||
| <CircleInfo className="text-accent-9" size="sm-regular" /> | ||
| <span> | ||
| Copy and save this key secret as it won't be shown again.{" "} | ||
| <a | ||
| href="https://www.unkey.com/docs/security/recovering-keys" | ||
| target="_blank" | ||
| rel="noopener noreferrer" | ||
| className="text-info-11 hover:underline" | ||
| > | ||
| Learn more | ||
| </a> | ||
| </span> | ||
| </div> | ||
| </div> | ||
| <div className="flex flex-col gap-2 items-start w-full mt-8"> | ||
| <div className="text-gray-12 text-sm font-semibold">Try It Out</div> | ||
| <Code | ||
| className={codeClassName} | ||
| visibleButton={ | ||
| <VisibleButton isVisible={showKeyInSnippet} setIsVisible={setShowKeyInSnippet} /> | ||
| } | ||
| copyButton={<CopyButton value={snippet} />} | ||
| > | ||
| {showKeyInSnippet ? snippet : snippet.replace(keyValue, maskedKey)} | ||
| </Code> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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.