milwright commited on
Commit
4e2df23
·
1 Parent(s): c463c35

improve: enhance welcome overlay styling and timing

Browse files

- Always show overlay regardless of previous views
- Center image with flexbox wrapper
- Add high contrast button styling (dark background, white text)
- Show overlay immediately before loading, not after
- Remove dependency on localStorage for showing overlay

Files changed (3) hide show
  1. src/app.js +3 -5
  2. src/styles.css +15 -0
  3. src/welcomeOverlay.js +6 -4
src/app.js CHANGED
@@ -29,15 +29,13 @@ class App {
29
 
30
  async initialize() {
31
  try {
 
 
 
32
  this.showLoading(true);
33
  await this.game.initialize();
34
  await this.startNewGame();
35
  this.showLoading(false);
36
-
37
- // Show welcome overlay for first-time users
38
- setTimeout(() => {
39
- this.welcomeOverlay.show();
40
- }, 500);
41
  } catch (error) {
42
  console.error('Failed to initialize app:', error);
43
  this.showError('Failed to load the game. Please refresh and try again.');
 
29
 
30
  async initialize() {
31
  try {
32
+ // Show welcome overlay immediately before loading
33
+ this.welcomeOverlay.show();
34
+
35
  this.showLoading(true);
36
  await this.game.initialize();
37
  await this.startNewGame();
38
  this.showLoading(false);
 
 
 
 
 
39
  } catch (error) {
40
  console.error('Failed to initialize app:', error);
41
  this.showError('Failed to load the game. Please refresh and try again.');
src/styles.css CHANGED
@@ -89,6 +89,21 @@
89
  .welcome-content p {
90
  margin: 0 0 16px 0;
91
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  .cloze-input.correct {
93
  background-color: #dcfce7 !important;
94
  border-color: #16a34a !important;
 
89
  .welcome-content p {
90
  margin: 0 0 16px 0;
91
  }
92
+
93
+ .welcome-overlay .typewriter-button {
94
+ background: #1f2937;
95
+ color: white;
96
+ border: 2px solid #374151;
97
+ padding: 12px 24px;
98
+ font-weight: 600;
99
+ transition: all 0.2s ease;
100
+ }
101
+
102
+ .welcome-overlay .typewriter-button:hover {
103
+ background: #374151;
104
+ border-color: #4b5563;
105
+ transform: translateY(-1px);
106
+ }
107
  .cloze-input.correct {
108
  background-color: #dcfce7 !important;
109
  border-color: #16a34a !important;
src/welcomeOverlay.js CHANGED
@@ -7,7 +7,7 @@ class WelcomeOverlay {
7
 
8
  show() {
9
  console.log('WelcomeOverlay.show() called, hasBeenShown:', this.hasBeenShown);
10
- if (this.hasBeenShown) return;
11
 
12
  this.isVisible = true;
13
  const overlay = this.createOverlay();
@@ -34,9 +34,11 @@ class WelcomeOverlay {
34
  `;
35
 
36
  modal.innerHTML = `
37
- <img src="https://raw.githubusercontent.com/zmuhls/cloze-reader/main/icon.png"
38
- alt="Cloze Reader"
39
- style="width: 64px; height: 64px; margin-bottom: 16px; border-radius: 8px;">
 
 
40
  <h1 class="welcome-title">
41
  Cloze Reader
42
  </h1>
 
7
 
8
  show() {
9
  console.log('WelcomeOverlay.show() called, hasBeenShown:', this.hasBeenShown);
10
+ // Always show overlay regardless of previous views
11
 
12
  this.isVisible = true;
13
  const overlay = this.createOverlay();
 
34
  `;
35
 
36
  modal.innerHTML = `
37
+ <div style="display: flex; justify-content: center; margin-bottom: 16px;">
38
+ <img src="https://raw.githubusercontent.com/zmuhls/cloze-reader/main/icon.png"
39
+ alt="Cloze Reader"
40
+ style="width: 64px; height: 64px; border-radius: 8px;">
41
+ </div>
42
  <h1 class="welcome-title">
43
  Cloze Reader
44
  </h1>