-
Notifications
You must be signed in to change notification settings - Fork 0
ctrlrun.dev as a static project site (www/ on Vercel), homepage rebuilt, launch-updates form #41
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
db0e309
ctrlrun.dev as a static project site: www/ for Vercel, the homepage r…
arpanghoshal 61f03a9
Homepage: the browser demo is the execution boundary page
arpanghoshal 99db1f5
ctrlrun.dev keeps its amber and black: accent, wordmark, favicon, OG;…
arpanghoshal 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
Some comments aren't visible on the classic Files Changed page.
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
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // The email form under "Something bigger is coming." on the homepage. One field, one button. | ||
| // Posts to /api/interest with the launch-updates intent; the server decides the subject line | ||
| // and that no company is required for this intent, so nothing the browser sends can change that. | ||
| // Same idempotency and honeypot pattern as the tier forms: one requestId per filled-in form, a | ||
| // hidden "website" field that a person never sees. | ||
| // | ||
| // ENDPOINT lives inside the component because a snippet exports one binding and module-level | ||
| // constants beside it are not in scope when MDX evaluates it. | ||
| export const LaunchUpdates = () => { | ||
| const ENDPOINT = 'https://ctrlrun-review-form.vercel.app/api/interest'; | ||
| const [email, setEmail] = useState(''); | ||
| const [website, setWebsite] = useState(''); | ||
| const [sending, setSending] = useState(false); | ||
| const [sent, setSent] = useState(false); | ||
| const [error, setError] = useState(''); | ||
| const requestId = useRef(null); | ||
| const sendingRef = useRef(false); | ||
| const track = name => window.dispatchEvent(new CustomEvent('ctrlrun:conversion', { detail: { name } })); | ||
|
|
||
| const send = async event => { | ||
| event.preventDefault(); | ||
| if (sendingRef.current || sent) return; | ||
| if (!requestId.current) requestId.current = crypto.randomUUID(); | ||
| sendingRef.current = true; setSending(true); setError(''); | ||
| try { | ||
| const response = await fetch(ENDPOINT, { | ||
| method: 'POST', credentials: 'omit', headers: { 'Content-Type': 'application/json' }, | ||
| body: JSON.stringify({ intent: 'launch-updates', email, website, requestId: requestId.current }), | ||
| signal: AbortSignal.timeout(15000) | ||
| }); | ||
| const data = await response.json(); | ||
| if (!response.ok || data.ok !== true || typeof data.id !== 'string') throw new Error(data.error || 'We could not confirm this. Retry, or email contact@arpanghoshal.com.'); | ||
| setSent(true); track('launch_updates_submitted'); | ||
| } catch (failure) { | ||
| setError(failure.name === 'TimeoutError' || failure.name === 'TypeError' ? 'We could not confirm this. Retrying is safe, or email contact@arpanghoshal.com.' : failure.message); | ||
| } finally { sendingRef.current = false; setSending(false); } | ||
| }; | ||
|
|
||
| if (sent) return <p className="ct-notify-done" role="status">Thanks. One email when it lands, nothing else.</p>; | ||
| return ( | ||
| <form className="ct-notify-form" onSubmit={send} noValidate={false}> | ||
| <fieldset disabled={sending} className="ct-notify-fields"> | ||
| <label className="ct-notify-label" htmlFor="ct-notify-email">Email</label> | ||
| <div className="ct-notify-row"> | ||
| <input id="ct-notify-email" className="ct-input" type="email" inputMode="email" autoComplete="email" required maxLength={254} placeholder="you@example.com" value={email} onChange={event => { setEmail(event.target.value); setError(''); }} /> | ||
| <button type="submit" className="ct-button">{sending ? 'Sending…' : error ? 'Retry' : 'Tell me first'}</button> | ||
| </div> | ||
| <div className="ct-honeypot" aria-hidden="true"><label>Website<input tabIndex={-1} autoComplete="off" value={website} onChange={event => setWebsite(event.target.value)} /></label></div> | ||
| </fieldset> | ||
| {error && <p role="alert" className="ct-notify-error">{error}</p>} | ||
| </form> | ||
| ); | ||
| }; | ||
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.
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.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
LaunchUpdatesgenerates its idempotencyrequestIdvia a directcrypto.randomUUID()call with no fallback, unlikewww/site.js's equivalent flow which falls back to a manual UUID generator when the native API is unavailable. In browsers or non-HTTPS contexts lackingcrypto.randomUUID, this throws and breaks the docs homepage signup form. Add the same fallback used inwww/site.js.🤖 Prompt for AI Agents