vioott commited on
Commit
6783ada
·
1 Parent(s): 354e59a

fix(ui): enhance modal styling, navbar color, form validation and session logic

Browse files
Files changed (2) hide show
  1. static/style.css +124 -8
  2. templates/start.html +23 -3
static/style.css CHANGED
@@ -129,7 +129,7 @@ button:hover {
129
 
130
  /* --- Navigation Bar --- */
131
  .navbar {
132
- background-color: #333;
133
  overflow: hidden;
134
  position: fixed;
135
  top: 0;
@@ -137,26 +137,142 @@ button:hover {
137
  z-index: 1000;
138
  display: flex;
139
  justify-content: center;
140
- box-shadow: 0 2px 5px rgba(0,0,0,0.2);
141
  }
142
 
143
  .navbar a {
144
  float: left;
145
  display: block;
146
- color: #f2f2f2;
147
  text-align: center;
148
- padding: 14px 20px;
149
  text-decoration: none;
150
  font-size: 17px;
151
- transition: background-color 0.3s;
 
152
  }
153
 
154
  .navbar a:hover {
155
- background-color: #ddd;
156
- color: black;
157
  }
158
 
159
  .navbar a.active {
160
- background-color: #28a745;
161
  color: white;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
  }
 
129
 
130
  /* --- Navigation Bar --- */
131
  .navbar {
132
+ background-color: #28a745; /* Verde igual aos botões */
133
  overflow: hidden;
134
  position: fixed;
135
  top: 0;
 
137
  z-index: 1000;
138
  display: flex;
139
  justify-content: center;
140
+ box-shadow: 0 2px 5px rgba(0,0,0,0.15);
141
  }
142
 
143
  .navbar a {
144
  float: left;
145
  display: block;
146
+ color: white;
147
  text-align: center;
148
+ padding: 14px 24px;
149
  text-decoration: none;
150
  font-size: 17px;
151
+ font-weight: 500;
152
+ transition: background-color 0.2s;
153
  }
154
 
155
  .navbar a:hover {
156
+ background-color: #218838; /* Verde um pouco mais escuro no hover */
157
+ color: white;
158
  }
159
 
160
  .navbar a.active {
161
+ background-color: #1e7e34;
162
  color: white;
163
+ }
164
+
165
+ /* --- Welcome Modal --- */
166
+ .modal {
167
+ display: none;
168
+ position: fixed;
169
+ z-index: 2000;
170
+ left: 0;
171
+ top: 0;
172
+ width: 100%;
173
+ height: 100%;
174
+ overflow: auto;
175
+ background-color: rgba(0,0,0,0.7); /* Fundo um pouco mais escuro */
176
+ backdrop-filter: blur(2px); /* Efeito de desfoque no fundo */
177
+ animation: fadeIn 0.3s;
178
+ }
179
+
180
+ .modal-content {
181
+ background-color: #fff;
182
+ margin: 8% auto;
183
+ padding: 40px; /* Mais padding */
184
+ border: none;
185
+ width: 85%;
186
+ max-width: 650px;
187
+ border-radius: 16px; /* Cantos mais arredondados */
188
+ box-shadow: 0 10px 30px rgba(0,0,0,0.3);
189
+ text-align: center;
190
+ position: relative;
191
+ animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1); /* Animação mais fluida */
192
+ font-family: 'Segoe UI', sans-serif;
193
+ }
194
+
195
+ .close-btn {
196
+ color: #999;
197
+ position: absolute;
198
+ top: 15px;
199
+ right: 25px;
200
+ font-size: 32px;
201
+ font-weight: 300;
202
+ line-height: 1;
203
+ transition: color 0.2s;
204
+ }
205
+
206
+ .close-btn:hover {
207
+ color: #333;
208
+ }
209
+
210
+ .modal-title {
211
+ color: #28a745;
212
+ margin-bottom: 15px;
213
+ font-size: 1.8em;
214
+ font-weight: 600;
215
+ }
216
+
217
+ .modal-desc {
218
+ font-size: 1.1em;
219
+ color: #444;
220
+ line-height: 1.6;
221
+ margin-bottom: 30px;
222
+ padding: 0 10px;
223
+ }
224
+
225
+ .tech-stack {
226
+ background-color: #f8f9fa;
227
+ padding: 25px;
228
+ border-radius: 12px;
229
+ margin-bottom: 30px;
230
+ text-align: left;
231
+ font-size: 1em;
232
+ border-left: 5px solid #28a745;
233
+ box-shadow: inset 0 0 5px rgba(0,0,0,0.03);
234
+ }
235
+
236
+ .tech-stack h4 {
237
+ margin-top: 0;
238
+ margin-bottom: 15px;
239
+ color: #2c3e50;
240
+ font-size: 1.1em;
241
+ text-transform: uppercase;
242
+ letter-spacing: 0.5px;
243
+ }
244
+
245
+ .tech-stack ul {
246
+ margin: 0;
247
+ padding-left: 20px;
248
+ }
249
+
250
+ .tech-stack li {
251
+ margin-bottom: 8px;
252
+ color: #555;
253
+ line-height: 1.5;
254
+ }
255
+
256
+ #start-intro-btn {
257
+ width: auto;
258
+ padding: 12px 40px;
259
+ font-size: 1.1em;
260
+ font-weight: 600;
261
+ box-shadow: 0 4px 10px rgba(40, 167, 69, 0.3);
262
+ transition: transform 0.2s, box-shadow 0.2s;
263
+ }
264
+
265
+ #start-intro-btn:hover {
266
+ transform: translateY(-2px);
267
+ box-shadow: 0 6px 15px rgba(40, 167, 69, 0.4);
268
+ }
269
+
270
+ @keyframes fadeIn {
271
+ from {opacity: 0}
272
+ to {opacity: 1}
273
+ }
274
+
275
+ @keyframes slideDown {
276
+ from {transform: translateY(-50px); opacity: 0;}
277
+ to {transform: translateY(0); opacity: 1;}
278
  }
templates/start.html CHANGED
@@ -66,7 +66,9 @@
66
 
67
  <div id="formulario-perfil">
68
  <label for="name">Seu nome:</label>
69
- <input type="text" id="name" name="name" required><br><br>
 
 
70
 
71
  <p>Quais gêneros de livros você gosta?</p>
72
 
@@ -78,6 +80,7 @@
78
  </label>
79
  {% endfor %}
80
  </div>
 
81
 
82
  <br>
83
  <button type="submit">Começar</button>
@@ -98,12 +101,12 @@
98
  }
99
 
100
  // Ao carregar a página, verifica se deve mostrar o modal
101
- window.onload = function() {
102
  // Se NÃO tiver a flag 'introShown' na sessão, mostra o modal
103
  if (!sessionStorage.getItem('introShown')) {
104
  modal.style.display = "block";
105
  }
106
- }
107
 
108
  // Fecha se clicar fora da caixa do modal
109
  window.onclick = function(event) {
@@ -111,6 +114,23 @@
111
  closeModal();
112
  }
113
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  </script>
115
 
116
  </body>
 
66
 
67
  <div id="formulario-perfil">
68
  <label for="name">Seu nome:</label>
69
+ <input type="text" id="name" name="name" required
70
+ oninvalid="this.setCustomValidity('Por favor, preencha seu nome')"
71
+ oninput="this.setCustomValidity('')"><br><br>
72
 
73
  <p>Quais gêneros de livros você gosta?</p>
74
 
 
80
  </label>
81
  {% endfor %}
82
  </div>
83
+ <p id="genre-error" style="color: red; display: none; font-size: 0.9em; margin-top: 5px;">⚠️ Selecione pelo menos um gênero.</p>
84
 
85
  <br>
86
  <button type="submit">Começar</button>
 
101
  }
102
 
103
  // Ao carregar a página, verifica se deve mostrar o modal
104
+ window.addEventListener('load', function() {
105
  // Se NÃO tiver a flag 'introShown' na sessão, mostra o modal
106
  if (!sessionStorage.getItem('introShown')) {
107
  modal.style.display = "block";
108
  }
109
+ });
110
 
111
  // Fecha se clicar fora da caixa do modal
112
  window.onclick = function(event) {
 
114
  closeModal();
115
  }
116
  }
117
+
118
+ // Validação do Formulário
119
+ document.querySelector('form').addEventListener('submit', function(e) {
120
+ const checkboxes = document.querySelectorAll('input[name="preferences"]');
121
+ const errorMsg = document.getElementById('genre-error');
122
+ let checkedOne = Array.prototype.slice.call(checkboxes).some(x => x.checked);
123
+
124
+ // Verifica se está na tela de "Criar perfil" (se o formulario-perfil não está hidden)
125
+ const formVisible = !document.getElementById('formulario-perfil').classList.contains('hidden');
126
+
127
+ if (formVisible && !checkedOne) {
128
+ e.preventDefault(); // Impede o envio
129
+ errorMsg.style.display = 'block';
130
+ } else {
131
+ errorMsg.style.display = 'none';
132
+ }
133
+ });
134
  </script>
135
 
136
  </body>