feat: devtool indicator - rename Quick Sign In → Quick Sign Up, remove email input (#1643)

This commit is contained in:
Konsti Wohlwend 2026-06-22 16:10:57 -07:00 committed by GitHub
parent 88eae6fbf1
commit a66d94bb43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -635,11 +635,6 @@ function createOverviewTab(app: StackClientApp<true>): TabResult {
const actions = h('div', { className: 'sdt-ov-actions' });
const toast = h('div', { className: 'sdt-ov-toast', style: { display: 'none' } });
const emailRow = h('div', { className: 'sdt-ov-email-input' });
const emailInput = h('input', { type: 'email', placeholder: 'Sign in as email\u2026' }) as HTMLInputElement;
const emailBtn = h('button', null);
setHtml(emailBtn, '<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="12" x2="19" y2="12"/><polyline points="12 5 19 12 12 19"/></svg>');
emailRow.append(emailInput, emailBtn);
function isBestEffortOverviewError(error: unknown) {
if (error instanceof DOMException && error.name === 'AbortError') {
@ -701,15 +696,14 @@ function createOverviewTab(app: StackClientApp<true>): TabResult {
});
actions.append(signOutBtn, randomBtn);
} else {
const quickBtn = h('button', { className: 'sdt-ov-btn sdt-ov-btn-primary sdt-ov-btn-wide' }, loading ? 'Working\u2026' : 'Quick Sign In');
const quickBtn = h('button', { className: 'sdt-ov-btn sdt-ov-btn-primary sdt-ov-btn-wide' }, loading ? 'Working\u2026' : 'Quick Sign Up');
quickBtn.disabled = loading;
quickBtn.addEventListener('click', () => {
runAsynchronously(doQuickSignIn());
});
actions.appendChild(quickBtn);
}
emailInput.placeholder = currentUser ? 'Switch to email\u2026' : 'Sign in as email\u2026';
actions.appendChild(emailRow);
}
async function doQuickSignIn() {
@ -741,54 +735,6 @@ function createOverviewTab(app: StackClientApp<true>): TabResult {
await refreshUser();
}
async function doSignInAs(targetEmail: string) {
if (!targetEmail.trim()) return;
if (!isLocalhost(window.location.href)) {
showToast('Quick sign-in is only available on localhost', 'error');
return;
}
loading = true;
rebuildActions();
const trimmed = targetEmail.trim();
try {
const signInResult = await app.signInWithCredential({ email: trimmed, password: trimmed, noRedirect: true });
if (signInResult.status === 'ok') {
showToast(`Signed in as ${trimmed}`, 'success');
emailInput.value = '';
loading = false;
await refreshUser();
return;
}
const signUpResult = await app.signUpWithCredential({ email: trimmed, password: trimmed, noRedirect: true } as any);
if (signUpResult.status === 'error') {
showToast(`Failed: ${signUpResult.error.message}`, 'error');
loading = false;
rebuildActions();
return;
}
const retryResult = await app.signInWithCredential({ email: trimmed, password: trimmed, noRedirect: true });
if (retryResult.status === 'error') {
showToast(`Sign in failed: ${retryResult.error.message}`, 'error');
} else {
showToast(`Signed in as ${trimmed}`, 'success');
emailInput.value = '';
}
} catch (e: any) {
showToast(e.message || 'Unknown error', 'error');
}
loading = false;
await refreshUser();
}
emailBtn.addEventListener('click', () => {
runAsynchronously(doSignInAs(emailInput.value));
});
emailInput.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
runAsynchronously(doSignInAs(emailInput.value));
}
});
heroCard.append(actions, toast);
// ── Auth methods card ──────────────────────────────────────────────────────
@ -852,7 +798,7 @@ function createOverviewTab(app: StackClientApp<true>): TabResult {
function buildChecklist() {
checksCard.innerHTML = '';
const currentUserCheck = hasPersistentTokenStore
? { ok: !!currentUser, label: 'Sign in a test user', hint: 'Use \u201cQuick Sign In\u201d above \u2192' }
? { ok: !!currentUser, label: 'Sign in a test user', hint: 'Use \u201cQuick Sign Up\u201d above \u2192' }
: { ok: true, label: 'Current-user tools unavailable', hint: null };
const checks = [
{ ok: !!projectId && projectId !== 'default', label: 'Project configured', hint: null },
@ -922,7 +868,7 @@ function createOverviewTab(app: StackClientApp<true>): TabResult {
} else {
avatar.textContent = initials;
}
userName.textContent = currentUser.displayName || 'Anonymous';
userName.textContent = currentUser.displayName || '(No display name)';
userEmail.textContent = currentUser.primaryEmail || 'No email';
authIndicator.style.display = '';
} else {