|
5 | 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
6 | 6 | <title>Mental Health Tracker</title> |
7 | 7 | <link rel="stylesheet" href="styles/styles.css"> |
8 | | - <script type="module" src="scripts/mental-health.js"></script> |
| 8 | + <script src="https://cdn.jsdelivr.net/npm/chart.js"></script> |
| 9 | + <script src="scripts/mental-health.js"></script> |
9 | 10 | <style> |
10 | 11 | /* Basic styling for layout and components */ |
11 | 12 | body { |
12 | | - font-family: Arial, sans-serif; |
13 | | - margin: 0; |
14 | | - padding: 0; |
15 | | - background-color: #f4f4f4; |
16 | | - color: #333; |
17 | | - } |
18 | | - .container { |
19 | | - max-width: 800px; |
20 | | - margin: 2rem auto; |
21 | | - padding: 1rem; |
22 | | - background: #fff; |
23 | | - border-radius: 8px; |
24 | | - box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); |
25 | | - } |
26 | | - h1 { |
27 | | - text-align: center; |
28 | | - color: #2c3e50; |
29 | | - } |
30 | | - .card { |
31 | | - margin: 1rem 0; |
32 | | - padding: 1rem; |
33 | | - border: 1px solid #fff9f9; |
34 | | - border-radius: 8px; |
35 | | - } |
36 | | - .button { |
37 | | - background-color: #3498db; |
38 | | - color: white; |
39 | | - padding: 10px 20px; |
40 | | - border: none; |
41 | | - border-radius: 4px; |
42 | | - cursor: pointer; |
43 | | - text-align: center; |
44 | | - text-decoration: none; |
45 | | - display: inline-block; |
46 | | - } |
47 | | - .button:hover { |
48 | | - background-color: #2980b9; |
49 | | - } |
50 | | - .slider-container { |
51 | | - margin: 1rem 0; |
52 | | - } |
53 | | - .tip { |
54 | | - margin: 1rem 0; |
55 | | - font-weight: bold; |
56 | | - text-align: center; |
57 | | - } |
| 13 | + font-family: Arial, sans-serif; |
| 14 | + margin: 0; |
| 15 | + padding: 0; |
| 16 | + background-color: #f4f4f4; |
| 17 | + color: #333; |
| 18 | + } |
| 19 | + .container { |
| 20 | + max-width: 800px; |
| 21 | + margin: 2rem auto; |
| 22 | + padding: 1rem; |
| 23 | + background: #fff; |
| 24 | + border-radius: 8px; |
| 25 | + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); |
| 26 | + } |
| 27 | + h1 { |
| 28 | + text-align: center; |
| 29 | + color: #2c3e50; |
| 30 | + } |
| 31 | + .card { |
| 32 | + margin: 1rem 0; |
| 33 | + padding: 1rem; |
| 34 | + border: 1px solid #fff9f9; |
| 35 | + border-radius: 8px; |
| 36 | + } |
| 37 | + .button { |
| 38 | + background-color: #3498db; |
| 39 | + color: white; |
| 40 | + padding: 10px 20px; |
| 41 | + border: none; |
| 42 | + border-radius: 4px; |
| 43 | + cursor: pointer; |
| 44 | + text-align: center; |
| 45 | + } |
| 46 | + .button:hover { |
| 47 | + background-color: #2980b9; |
| 48 | + } |
| 49 | + .slider-container { |
| 50 | + margin: 1rem 0; |
| 51 | + } |
| 52 | + .tip { |
| 53 | + margin: 1rem 0; |
| 54 | + font-weight: bold; |
| 55 | + text-align: center; |
| 56 | + } |
| 57 | + #moodChart { |
| 58 | + max-width: 600px; |
| 59 | + max-height: 300px; |
| 60 | + margin: auto; |
| 61 | + } |
58 | 62 | </style> |
59 | 63 | <body class="bg-custom-green"> |
60 | 64 | <header class="bg-white shadow-md"> |
@@ -88,37 +92,71 @@ <h2 class="text-xl font-bold mb-4">Account</h2> |
88 | 92 | </header> |
89 | 93 |
|
90 | 94 | <!-- Back Button --> |
91 | | -<a href="/welcomePage.html" class="button">Back to Welcome</a> |
| 95 | +<div class="container mx-auto px-4 py-8"> |
| 96 | + <h1 class="text-3xl font-bold text-gray-900 mb-8 text-center">Mental Health Tracker</h1> |
| 97 | + <div class="mb-4"> |
| 98 | + <a href="welcomePage.html" class="bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600">Back to Welcome</a> |
| 99 | + </div> |
| 100 | + |
| 101 | +<!-- Main Container --> |
| 102 | +<div class="container mx-auto p-8"> |
| 103 | + |
| 104 | + <!-- Grid Layout for Daily Mood and Stress Level --> |
| 105 | + <div class="grid md:grid-cols-2 gap-12 mt-12"> |
| 106 | + |
| 107 | + <!-- Daily Mood Check Card --> |
| 108 | + <div class="bg-white rounded-lg shadow-lg p-8"> |
| 109 | + <h2 class="text-2xl font-semibold text-gray-700 mb-6">Daily Mood Check</h2> |
| 110 | + <div id="mood-options" class="grid grid-cols-3 gap-4"> |
| 111 | + <!-- Mood buttons will be generated in JS --> |
| 112 | + </div> |
| 113 | + </div> |
92 | 114 |
|
93 | | -<!-- Mood Tracker --> |
94 | | -<div class="card"> |
95 | | - <h2>Daily Mood Check</h2> |
96 | | - <div id="mood-options"> |
97 | | - <!-- Radio buttons will be added dynamically --> |
| 115 | + <!-- Stress Levels Bar --> |
| 116 | + <div class="bg-white rounded-lg shadow-lg p-8"> |
| 117 | + <h2 class="text-2xl font-semibold text-gray-700 mb-6">Stress Level</h2> |
| 118 | + <input type="range" id="stress-slider" min="0" max="10" step="1" value="5" class="w-full"> |
| 119 | + <p class="mt-4 text-lg">Your stress level: <span id="stress-value" class="font-bold text-blue-600">5</span> / 10</p> |
| 120 | + </div> |
98 | 121 | </div> |
99 | | -</div> |
100 | 122 |
|
101 | | -<!-- Stress Level --> |
102 | | -<div class="card"> |
103 | | - <h2>Stress Level</h2> |
104 | | - <div class="slider-container"> |
105 | | - <input type="range" id="stress-slider" min="0" max="10" step="1" value="5"> |
106 | | - <p>Your stress level: <span id="stress-value">5</span> / 10</p> |
| 123 | + <!-- Grid Layout for Chart and Wellness Tip --> |
| 124 | + <div class="grid md:grid-cols-2 gap-12 mt-12"> |
| 125 | + |
| 126 | + <!-- Mood & Stress Trends Chart --> |
| 127 | + <div class="bg-white rounded-lg shadow-lg p-8 h-[400px]"> |
| 128 | + <h2 class="text-2xl font-semibold text-gray-700 mb-6">Mood & Stress Trends</h2> |
| 129 | + <canvas id="moodChart" class="w-full h-full"></canvas> |
| 130 | + </div> |
| 131 | + |
| 132 | + <!-- Wellness Tip Generator --> |
| 133 | + <div class="bg-white rounded-lg shadow-lg p-8"> |
| 134 | + <h2 class="text-2xl font-semibold text-gray-700 mb-6">Wellness Suggestions</h2> |
| 135 | + <p id="wellness-tip" class="text-lg mb-6">Click the button below for a wellness tip!</p> |
| 136 | + <!--button class="bg-blue-500 text-white px-6 py-3 rounded-lg hover:bg-blue-700 transition duration-300 ease-in-out" |
| 137 | + id="generate-tip"> |
| 138 | + Generate Tip |
| 139 | + </button--> |
| 140 | + </div> |
107 | 141 | </div> |
108 | | -</div> |
109 | 142 |
|
110 | | -<!-- Wellness Tip --> |
111 | | -<div class="card"> |
112 | | - <h2>Wellness Tip</h2> |
113 | | - <p id="wellness-tip">Click the button below to get a wellness tip!</p> |
114 | 143 | </div> |
115 | 144 |
|
| 145 | +</div> |
116 | 146 | <!-- Save Entry --> |
117 | 147 | <div style="text-align: center;"> |
118 | 148 | <button class="button" id="save-entry">Save Today's Entry</button> |
119 | 149 | </div> |
120 | | -</div> |
121 | 150 |
|
122 | 151 |
|
| 152 | + <!-- Script to Initialize Chart After Page Load --> |
| 153 | + <script> |
| 154 | + window.addEventListener('DOMContentLoaded', function () { |
| 155 | + import('./scripts/mental-health.js').then(module => { |
| 156 | + module.initializeChart(); |
| 157 | + }); |
| 158 | + }); |
| 159 | +</script> |
| 160 | + |
123 | 161 | </body> |
124 | 162 | </html> |
0 commit comments