Skip to content

Commit 0b48bd1

Browse files
authored
Merge pull request #122 from albertoivo/palette-guest-mode-fix-5149763296248046295
2 parents aa12248 + cd8ea1f commit 0b48bd1

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

.Jules/palette.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
## 2024-05-23 - Ambiguous Label Text in Tests
22
**Learning:** Using `getByLabelText` can be ambiguous if an interactive element (like a toggle button) has an `aria-label` that partially matches the input's label text (e.g., "Senha" vs "Mostrar senha").
33
**Action:** Always specify `{ selector: 'input' }` when querying inputs by label text if there are related buttons nearby with similar ARIA labels.
4+
5+
## 2024-05-24 - Frictionless Guest Entry
6+
**Learning:** Users in "Guest Mode" value speed over customization. Replacing a blocking `window.prompt` with auto-generated names removes a significant friction point and feels more "magical" and polished.
7+
**Action:** When designing "try it out" or guest flows, prioritize immediate access (1-click) over configuration. Save customization for after the user is hooked.

src/pages/RegisterPage.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,16 @@ export function RegisterPage() {
5959
};
6060

6161
const handleGuestMode = () => {
62-
const guestName = prompt('Digite seu apelido para jogar como convidado:');
63-
if (guestName && guestName.trim()) {
64-
enterAsGuest(guestName.trim());
65-
navigate('/game', { replace: true });
66-
}
62+
// Gera um nome aleatório divertido para o convidado
63+
const adjectives = ['Veloz', 'Esperto', 'Curioso', 'Valente', 'Sábio', 'Alegre'];
64+
const nouns = ['Viajante', 'Explorador', 'Aventureiro', 'Cientista', 'Mago', 'Ninja'];
65+
66+
const adj = adjectives[Math.floor(Math.random() * adjectives.length)];
67+
const noun = nouns[Math.floor(Math.random() * nouns.length)];
68+
const guestName = `${noun} ${adj}`;
69+
70+
enterAsGuest(guestName);
71+
navigate('/game', { replace: true });
6772
};
6873

6974
return (

0 commit comments

Comments
 (0)