|
3 | 3 | <head> |
4 | 4 | <meta charset="UTF-8"> |
5 | 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
6 | | - <title>Welcome Dashboard</title> |
| 6 | + <title>Welcome Website</title> |
7 | 7 | <style> |
8 | 8 | body { |
9 | 9 | margin: 0; |
| 10 | + padding: 0; |
10 | 11 | height: 100vh; |
11 | 12 | display: flex; |
12 | 13 | justify-content: center; |
13 | 14 | align-items: center; |
14 | | - background: #111; |
15 | | - color: white; |
16 | | - font-family: Arial, sans-serif; |
| 15 | + font-family: 'Poppins', sans-serif; |
| 16 | + background: linear-gradient(135deg, #667eea, #764ba2); |
17 | 17 | overflow: hidden; |
18 | | - flex-direction: column; |
| 18 | + color: white; |
19 | 19 | } |
20 | 20 |
|
21 | | - #nameInputBox { |
22 | | - display: flex; |
23 | | - flex-direction: column; |
24 | | - align-items: center; |
| 21 | + .fade { |
| 22 | + opacity: 0; |
| 23 | + transition: opacity 1s ease; |
25 | 24 | } |
26 | | - |
27 | | - input { |
28 | | - padding: 8px; |
29 | | - border-radius: 8px; |
30 | | - border: none; |
31 | | - margin-bottom: 10px; |
32 | | - font-size: 16px; |
| 25 | + .fade.show { |
| 26 | + opacity: 1; |
33 | 27 | } |
34 | 28 |
|
35 | | - button { |
36 | | - padding: 8px 15px; |
37 | | - border-radius: 8px; |
38 | | - border: none; |
39 | | - cursor: pointer; |
40 | | - font-size: 16px; |
41 | | - background: #0af; |
42 | | - color: white; |
43 | | - transition: 0.3s; |
| 29 | + .screen { |
| 30 | + display: none; |
| 31 | + text-align: center; |
| 32 | + } |
| 33 | + .screen.active { |
| 34 | + display: block; |
44 | 35 | } |
45 | 36 |
|
46 | | - button:hover { |
47 | | - background: #09c; |
| 37 | + h1 { |
| 38 | + font-size: 3rem; |
| 39 | + margin-bottom: 20px; |
48 | 40 | } |
49 | 41 |
|
50 | | - .flicker { |
51 | | - margin-top: 15px; |
52 | | - font-size: 18px; |
53 | | - animation: flicker 1.2s infinite alternate; |
| 42 | + button, .done-btn { |
| 43 | + padding: 10px 20px; |
| 44 | + border: none; |
| 45 | + background: white; |
| 46 | + color: #333; |
| 47 | + font-size: 1rem; |
| 48 | + border-radius: 10px; |
54 | 49 | cursor: pointer; |
| 50 | + transition: 0.3s; |
55 | 51 | } |
56 | | - |
57 | | - @keyframes flicker { |
58 | | - 0% { opacity: 1; } |
59 | | - 50% { opacity: 0.3; } |
60 | | - 100% { opacity: 1; } |
| 52 | + button:hover, .done-btn:hover { |
| 53 | + background: #ddd; |
61 | 54 | } |
62 | 55 |
|
63 | | - #dashboard { |
64 | | - display: none; |
65 | | - width: 100%; |
66 | | - height: 100vh; |
67 | | - background: white; |
68 | | - color: black; |
| 56 | + .input-box { |
| 57 | + display: flex; |
69 | 58 | justify-content: center; |
70 | 59 | align-items: center; |
71 | | - font-size: 24px; |
| 60 | + margin-top: 20px; |
| 61 | + } |
| 62 | + input { |
| 63 | + padding: 10px; |
| 64 | + font-size: 1rem; |
| 65 | + border: none; |
| 66 | + border-radius: 10px 0 0 10px; |
| 67 | + outline: none; |
| 68 | + } |
| 69 | + .done-btn { |
| 70 | + border-radius: 0 10px 10px 0; |
72 | 71 | } |
73 | 72 | </style> |
74 | 73 | </head> |
75 | 74 | <body> |
76 | | - |
77 | | - <!-- Name Input --> |
78 | | - <div id="nameInputBox"> |
79 | | - <input type="text" id="username" placeholder="Enter your name"> |
80 | | - <button onclick="showWelcome()">Start</button> |
| 75 | + <!-- Screen 1 --> |
| 76 | + <div id="welcomeScreen" class="screen active fade"> |
| 77 | + <h1>Welcome</h1> |
| 78 | + <button onclick="goToName()">Next</button> |
81 | 79 | </div> |
82 | 80 |
|
83 | | - <!-- Welcome Screen --> |
84 | | - <div id="welcomeScreen" style="display:none; text-align:center;"> |
85 | | - <h1 id="greeting"></h1> |
86 | | - <div class="flicker" onclick="openDashboard()">Click on screen for next</div> |
| 81 | + <!-- Screen 2 --> |
| 82 | + <div id="nameScreen" class="screen fade"> |
| 83 | + <h1>Provide us your name, for better conversation</h1> |
| 84 | + <div class="input-box"> |
| 85 | + <input type="text" id="username" placeholder="Enter your name"> |
| 86 | + <button class="done-btn" onclick="saveName()">Done</button> |
| 87 | + </div> |
87 | 88 | </div> |
88 | 89 |
|
89 | | - <!-- Dashboard --> |
90 | | - <div id="dashboard"> |
91 | | - <h2>🎮 Your White Dashboard (Game area)</h2> |
| 90 | + <!-- Screen 3 --> |
| 91 | + <div id="dashboard" class="screen fade"> |
| 92 | + <h1 id="greeting"></h1> |
| 93 | + <p>🎉 This is your main dashboard</p> |
92 | 94 | </div> |
93 | 95 |
|
94 | 96 | <script> |
95 | | - function showWelcome() { |
96 | | - let name = document.getElementById("username").value; |
97 | | - if (name.trim() === "") name = "User"; |
98 | | - |
99 | | - document.getElementById("nameInputBox").style.display = "none"; |
100 | | - document.getElementById("welcomeScreen").style.display = "block"; |
| 97 | + function fadeOutIn(current, next) { |
| 98 | + document.getElementById(current).classList.remove("show"); |
| 99 | + setTimeout(() => { |
| 100 | + document.getElementById(current).classList.remove("active"); |
| 101 | + document.getElementById(next).classList.add("active"); |
| 102 | + setTimeout(() => { |
| 103 | + document.getElementById(next).classList.add("show"); |
| 104 | + }, 50); |
| 105 | + }, 1000); |
| 106 | + } |
101 | 107 |
|
102 | | - document.getElementById("greeting").innerText = `Hello, ${name}!`; |
| 108 | + // Next button |
| 109 | + function goToName() { |
| 110 | + fadeOutIn("welcomeScreen", "nameScreen"); |
103 | 111 | } |
104 | 112 |
|
105 | | - function openDashboard() { |
106 | | - document.getElementById("welcomeScreen").style.display = "none"; |
107 | | - document.getElementById("dashboard").style.display = "flex"; |
| 113 | + // Save Name |
| 114 | + function saveName() { |
| 115 | + let name = document.getElementById("username").value.trim(); |
| 116 | + if (name) { |
| 117 | + localStorage.setItem("userName", name); |
| 118 | + document.getElementById("greeting").innerText = "Hello, " + name + "!"; |
| 119 | + fadeOutIn("nameScreen", "dashboard"); |
| 120 | + } |
108 | 121 | } |
109 | | - </script> |
110 | 122 |
|
| 123 | + // On load check if name already saved |
| 124 | + window.onload = function() { |
| 125 | + let savedName = localStorage.getItem("userName"); |
| 126 | + if (savedName) { |
| 127 | + document.getElementById("welcomeScreen").classList.remove("active", "show"); |
| 128 | + document.getElementById("dashboard").classList.add("active", "show"); |
| 129 | + document.getElementById("greeting").innerText = "Hello, " + savedName + "!"; |
| 130 | + } else { |
| 131 | + setTimeout(() => { |
| 132 | + document.getElementById("welcomeScreen").classList.add("show"); |
| 133 | + }, 50); |
| 134 | + } |
| 135 | + }; |
| 136 | + </script> |
111 | 137 | </body> |
112 | 138 | </html> |
0 commit comments