-
Notifications
You must be signed in to change notification settings - Fork 1.1k
improvement: new custom domain flow #868
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
41 commits
Select commit
Hold shift + click to select a range
c17ab58
new domain flow
ameer2468 8fe6ef4
Merge branch 'main' into new-domain-flow
ameer2468 b4d05c6
cleanup
ameer2468 c0e759c
logging
ameer2468 b2717cf
cname
ameer2468 17b059b
Update VerifyStep.tsx
ameer2468 6f4d412
Update CustomDomainDialog.tsx
ameer2468 221753c
update data
ameer2468 51db236
Update VerifyStep.tsx
ameer2468 660de0f
remove some code
ameer2468 6d80d17
run some testing
ameer2468 3770480
Merge branch 'main' into new-domain-flow
ameer2468 040c95e
update ui
ameer2468 605a1d1
update UI to show recommended values
ameer2468 7de6bbc
one table
ameer2468 76e7266
Update VerifyStep.tsx
ameer2468 68a8885
update ui
ameer2468 2468d9d
Update VerifyStep.tsx
ameer2468 204e926
run more tests
ameer2468 e2c2b1e
auto close dialog if success
ameer2468 f2b37b8
conditional rendering of domain
ameer2468 9df26c8
remove domain if already set
ameer2468 74fb503
loading state
ameer2468 a212885
Update CustomDomainDialog.tsx
ameer2468 99a2c8e
loading
ameer2468 cee5100
Update CustomDomainDialog.tsx
ameer2468 9ee1b21
visual tweaks
ameer2468 6a5b2ee
Update CapSettingsCard.tsx
ameer2468 052a9d4
remove state
ameer2468 288d583
Merge branch 'main' into new-domain-flow
ameer2468 304f3a7
wip
ameer2468 af026d3
Merge branch 'main' into new-domain-flow
ameer2468 0957d2e
confetti
ameer2468 66622ff
more time before closing
ameer2468 5bc34ab
cleanup
ameer2468 015cc64
visual tweaks
ameer2468 e776e19
Update CustomDomainDialog.tsx
ameer2468 2ed6698
proper loading state
ameer2468 bd92745
Update VerifyStep.tsx
ameer2468 230a0e6
Update CustomDomainDialog.tsx
ameer2468 60e3d6f
cleanup imports
ameer2468 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| "use client"; | ||
|
|
||
| import type { | ||
| GlobalOptions as ConfettiGlobalOptions, | ||
| CreateTypes as ConfettiInstance, | ||
| Options as ConfettiOptions, | ||
| } from "canvas-confetti"; | ||
| import confetti from "canvas-confetti"; | ||
| import type { ReactNode } from "react"; | ||
| import React, { | ||
| createContext, | ||
| forwardRef, | ||
| useCallback, | ||
| useEffect, | ||
| useImperativeHandle, | ||
| useMemo, | ||
| useRef, | ||
| } from "react"; | ||
|
|
||
| type Api = { | ||
| fire: (options?: ConfettiOptions) => void; | ||
| }; | ||
|
|
||
| type Props = React.ComponentPropsWithRef<"canvas"> & { | ||
| options?: ConfettiOptions; | ||
| globalOptions?: ConfettiGlobalOptions; | ||
| manualstart?: boolean; | ||
| children?: ReactNode; | ||
| }; | ||
|
|
||
| export type ConfettiRef = Api | null; | ||
|
|
||
| const ConfettiContext = createContext<Api>({} as Api); | ||
|
|
||
| // Define component first | ||
| const ConfettiComponent = forwardRef<ConfettiRef, Props>((props, ref) => { | ||
| const { | ||
| options, | ||
| globalOptions = { resize: true, useWorker: true }, | ||
| manualstart = false, | ||
| children, | ||
| ...rest | ||
| } = props; | ||
| const instanceRef = useRef<ConfettiInstance | null>(null); | ||
|
|
||
| const canvasRef = useCallback( | ||
| (node: HTMLCanvasElement) => { | ||
| if (node !== null) { | ||
| if (instanceRef.current) return; | ||
| instanceRef.current = confetti.create(node, { | ||
| ...globalOptions, | ||
| resize: true, | ||
| }); | ||
| } else { | ||
| if (instanceRef.current) { | ||
| instanceRef.current.reset(); | ||
| instanceRef.current = null; | ||
| } | ||
| } | ||
| }, | ||
| [globalOptions], | ||
| ); | ||
|
|
||
| const fire = useCallback( | ||
| async (opts = {}) => { | ||
| try { | ||
| await instanceRef.current?.({ ...options, ...opts }); | ||
| } catch (error) { | ||
| console.error("Confetti error:", error); | ||
| } | ||
| }, | ||
| [options], | ||
| ); | ||
|
|
||
| const api = useMemo( | ||
| () => ({ | ||
| fire, | ||
| }), | ||
| [fire], | ||
| ); | ||
|
|
||
| useImperativeHandle(ref, () => api, [api]); | ||
|
|
||
| useEffect(() => { | ||
| if (!manualstart) { | ||
| (async () => { | ||
| try { | ||
| await fire(); | ||
| } catch (error) { | ||
| console.error("Confetti effect error:", error); | ||
| } | ||
| })(); | ||
| } | ||
| }, [manualstart, fire]); | ||
|
|
||
| return ( | ||
| <ConfettiContext.Provider value={api}> | ||
| <canvas ref={canvasRef} {...rest} /> | ||
| {children} | ||
| </ConfettiContext.Provider> | ||
| ); | ||
| }); | ||
|
|
||
| ConfettiComponent.displayName = "Confetti"; | ||
|
|
||
| export const Confetti = ConfettiComponent; | ||
|
|
||
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.
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.