vioott commited on
Commit
ae01725
·
1 Parent(s): 7b7d873

feat(ui): add floating info button to reopen modal and enforce single-session flow

Browse files
Files changed (2) hide show
  1. static/style.css +25 -0
  2. templates/start.html +23 -31
static/style.css CHANGED
@@ -275,4 +275,29 @@ button:hover {
275
  @keyframes slideDown {
276
  from {transform: translateY(-50px); opacity: 0;}
277
  to {transform: translateY(0); opacity: 1;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
278
  }
 
275
  @keyframes slideDown {
276
  from {transform: translateY(-50px); opacity: 0;}
277
  to {transform: translateY(0); opacity: 1;}
278
+ }
279
+
280
+ /* --- Floating Info Button (FAB) --- */
281
+ .info-fab {
282
+ position: fixed;
283
+ bottom: 20px;
284
+ right: 20px;
285
+ background-color: #28a745;
286
+ color: white;
287
+ width: 50px;
288
+ height: 50px;
289
+ border-radius: 50%;
290
+ text-align: center;
291
+ line-height: 50px;
292
+ font-size: 24px;
293
+ box-shadow: 0 4px 10px rgba(0,0,0,0.3);
294
+ cursor: pointer;
295
+ z-index: 1900;
296
+ transition: transform 0.3s, background-color 0.3s;
297
+ display: none; /* Começa escondido, só aparece quando fecha o modal */
298
+ }
299
+
300
+ .info-fab:hover {
301
+ background-color: #218838;
302
+ transform: scale(1.1);
303
  }
templates/start.html CHANGED
@@ -40,30 +40,14 @@
40
  </div>
41
  </div>
42
 
 
 
 
 
 
43
  <form class="chat-box" method="POST">
44
  <h1 id="titulo-criar-perfil">Vamos criar seu perfil?</h1>
45
 
46
- <div class="small-link" id="link-ja-tenho">
47
- <a href="#" onclick="mostrarPerfis(); return false;">Já tenho perfil</a>
48
- </div>
49
-
50
- <div class="small-link hidden" id="link-criar">
51
- <a href="/">Criar perfil</a>
52
- </div>
53
-
54
- <div id="existing-profiles" class="hidden">
55
- <h1>Selecione um perfil</h1>
56
- {% if profiles %}
57
- <ul>
58
- {% for id, data in profiles.items() %}
59
- <li><a href="/perfil/{{ id }}">{{ data.name or "Usuário " ~ id }}</a></li>
60
- {% endfor %}
61
- </ul>
62
- {% else %}
63
- <p>Não há perfis cadastrados.</p>
64
- {% endif %}
65
- </div>
66
-
67
  <div id="formulario-perfil">
68
  <label for="name">Seu nome:</label>
69
  <input type="text" id="name" name="name" required
@@ -94,19 +78,30 @@
94
  <script>
95
  // Modal Logic
96
  const modal = document.getElementById("introModal");
 
 
 
 
 
 
 
97
 
98
  // Função para fechar o modal
99
  function closeModal() {
100
  modal.style.display = "none";
101
- // Marca na sessão que o intro já foi visto (chave atualizada para resetar para usuários antigos)
102
- sessionStorage.setItem('introShown_v2', 'true');
 
103
  }
104
 
105
- // Ao carregar a página, verifica se deve mostrar o modal
106
  window.addEventListener('load', function() {
107
- // Se NÃO tiver a flag 'introShown_v2' na sessão, mostra o modal
108
- if (!sessionStorage.getItem('introShown_v2')) {
109
- modal.style.display = "block";
 
 
 
110
  }
111
  });
112
 
@@ -123,10 +118,7 @@
123
  const errorMsg = document.getElementById('genre-error');
124
  let checkedOne = Array.prototype.slice.call(checkboxes).some(x => x.checked);
125
 
126
- // Verifica se está na tela de "Criar perfil" (se o formulario-perfil não está hidden)
127
- const formVisible = !document.getElementById('formulario-perfil').classList.contains('hidden');
128
-
129
- if (formVisible && !checkedOne) {
130
  e.preventDefault(); // Impede o envio
131
  errorMsg.style.display = 'block';
132
  } else {
 
40
  </div>
41
  </div>
42
 
43
+ <!-- Floating Info Button -->
44
+ <div id="infoFab" class="info-fab" onclick="openModal()" title="Sobre o Projeto">
45
+ ℹ️
46
+ </div>
47
+
48
  <form class="chat-box" method="POST">
49
  <h1 id="titulo-criar-perfil">Vamos criar seu perfil?</h1>
50
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  <div id="formulario-perfil">
52
  <label for="name">Seu nome:</label>
53
  <input type="text" id="name" name="name" required
 
78
  <script>
79
  // Modal Logic
80
  const modal = document.getElementById("introModal");
81
+ const fab = document.getElementById("infoFab");
82
+
83
+ // Função para abrir o modal
84
+ function openModal() {
85
+ modal.style.display = "block";
86
+ fab.style.display = "none";
87
+ }
88
 
89
  // Função para fechar o modal
90
  function closeModal() {
91
  modal.style.display = "none";
92
+ fab.style.display = "block"; // Mostra o botão flutuante
93
+ // Marca na sessão que o intro já foi visto
94
+ sessionStorage.setItem('introShown_v3', 'true');
95
  }
96
 
97
+ // Ao carregar a página
98
  window.addEventListener('load', function() {
99
+ // Se NÃO tiver a flag, mostra modal
100
+ if (!sessionStorage.getItem('introShown_v3')) {
101
+ openModal();
102
+ } else {
103
+ // Se já viu, mostra só o botão flutuante
104
+ fab.style.display = "block";
105
  }
106
  });
107
 
 
118
  const errorMsg = document.getElementById('genre-error');
119
  let checkedOne = Array.prototype.slice.call(checkboxes).some(x => x.checked);
120
 
121
+ if (!checkedOne) {
 
 
 
122
  e.preventDefault(); // Impede o envio
123
  errorMsg.style.display = 'block';
124
  } else {