Spaces:
Running
Running
Add 3 files
Browse files- README.md +7 -5
- index.html +568 -19
- prompts.txt +1 -0
README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
---
|
2 |
-
title:
|
3 |
-
emoji:
|
4 |
-
colorFrom:
|
5 |
-
colorTo:
|
6 |
sdk: static
|
7 |
pinned: false
|
|
|
|
|
8 |
---
|
9 |
|
10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
1 |
---
|
2 |
+
title: mindfullness-schedule
|
3 |
+
emoji: 🐳
|
4 |
+
colorFrom: blue
|
5 |
+
colorTo: yellow
|
6 |
sdk: static
|
7 |
pinned: false
|
8 |
+
tags:
|
9 |
+
- deepsite
|
10 |
---
|
11 |
|
12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
@@ -1,19 +1,568 @@
|
|
1 |
-
<!
|
2 |
-
<html>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Neural Synchronization Calendar</title>
|
7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js"></script>
|
9 |
+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
10 |
+
<style>
|
11 |
+
.event-dot {
|
12 |
+
width: 6px;
|
13 |
+
height: 6px;
|
14 |
+
border-radius: 50%;
|
15 |
+
display: inline-block;
|
16 |
+
margin-left: 2px;
|
17 |
+
}
|
18 |
+
.calendar-day:hover {
|
19 |
+
background-color: #f0f4ff;
|
20 |
+
}
|
21 |
+
.calendar-day.active {
|
22 |
+
background-color: #2a5298;
|
23 |
+
color: white;
|
24 |
+
}
|
25 |
+
.calendar-day.inactive {
|
26 |
+
color: #ccc;
|
27 |
+
}
|
28 |
+
.event-item {
|
29 |
+
border-left: 4px solid;
|
30 |
+
}
|
31 |
+
</style>
|
32 |
+
</head>
|
33 |
+
<body class="bg-gradient-to-br from-blue-900 to-blue-700 min-h-screen p-4 md:p-8">
|
34 |
+
<div class="max-w-6xl mx-auto bg-white rounded-xl shadow-xl overflow-hidden">
|
35 |
+
<div class="p-6">
|
36 |
+
<!-- Header -->
|
37 |
+
<div class="flex flex-col md:flex-row justify-between items-center mb-6 gap-4">
|
38 |
+
<div class="flex space-x-2">
|
39 |
+
<button id="monthView" class="px-4 py-2 bg-blue-800 text-white rounded-lg hover:bg-blue-700 transition">Month</button>
|
40 |
+
<button id="weekView" class="px-4 py-2 bg-blue-100 text-blue-800 rounded-lg hover:bg-blue-200 transition">Week</button>
|
41 |
+
<button id="dayView" class="px-4 py-2 bg-blue-100 text-blue-800 rounded-lg hover:bg-blue-200 transition">Day</button>
|
42 |
+
</div>
|
43 |
+
|
44 |
+
<h2 id="currentDate" class="text-2xl font-bold text-blue-800"></h2>
|
45 |
+
|
46 |
+
<div class="flex items-center space-x-4">
|
47 |
+
<button id="prev" class="text-blue-800 hover:bg-blue-100 p-2 rounded-full">
|
48 |
+
<span class="material-icons">chevron_left</span>
|
49 |
+
</button>
|
50 |
+
<button id="next" class="text-blue-800 hover:bg-blue-100 p-2 rounded-full">
|
51 |
+
<span class="material-icons">chevron_right</span>
|
52 |
+
</button>
|
53 |
+
<button id="exportPDF" class="px-4 py-2 bg-blue-800 text-white rounded-lg hover:bg-blue-700 transition flex items-center">
|
54 |
+
<span class="material-icons mr-2">picture_as_pdf</span>
|
55 |
+
Export PDF
|
56 |
+
</button>
|
57 |
+
</div>
|
58 |
+
</div>
|
59 |
+
|
60 |
+
<!-- Calendar -->
|
61 |
+
<div id="calendar" class="mb-8"></div>
|
62 |
+
|
63 |
+
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
64 |
+
<!-- Event Form -->
|
65 |
+
<div class="bg-blue-50 p-6 rounded-xl">
|
66 |
+
<h3 class="text-xl font-semibold text-blue-800 mb-4">Add Event</h3>
|
67 |
+
<div class="space-y-4">
|
68 |
+
<div class="grid grid-cols-2 gap-4">
|
69 |
+
<div>
|
70 |
+
<label class="block text-sm font-medium text-blue-700 mb-1">Date</label>
|
71 |
+
<input type="date" id="eventDate" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
72 |
+
</div>
|
73 |
+
<div>
|
74 |
+
<label class="block text-sm font-medium text-blue-700 mb-1">Time</label>
|
75 |
+
<input type="time" id="eventTime" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
76 |
+
</div>
|
77 |
+
</div>
|
78 |
+
|
79 |
+
<div>
|
80 |
+
<label class="block text-sm font-medium text-blue-700 mb-1">Title</label>
|
81 |
+
<input type="text" id="eventTitle" placeholder="Event Title" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
82 |
+
</div>
|
83 |
+
|
84 |
+
<div>
|
85 |
+
<label class="block text-sm font-medium text-blue-700 mb-1">Category</label>
|
86 |
+
<select id="eventCategory" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
87 |
+
<option value="Mental Health">Mental Health</option>
|
88 |
+
<option value="Motor Control">Motor Control</option>
|
89 |
+
<option value="Lifestyle">Lifestyle</option>
|
90 |
+
<option value="Research">Research</option>
|
91 |
+
</select>
|
92 |
+
</div>
|
93 |
+
|
94 |
+
<div>
|
95 |
+
<label class="block text-sm font-medium text-blue-700 mb-1">Description</label>
|
96 |
+
<input type="text" id="eventDescription" placeholder="Description" class="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500">
|
97 |
+
</div>
|
98 |
+
|
99 |
+
<div class="pt-2">
|
100 |
+
<button id="addEvent" class="w-full py-2 bg-blue-800 text-white rounded-lg hover:bg-blue-700 transition flex justify-center items-center">
|
101 |
+
<span class="material-icons mr-2">add</span>
|
102 |
+
Add Event
|
103 |
+
</button>
|
104 |
+
</div>
|
105 |
+
</div>
|
106 |
+
</div>
|
107 |
+
|
108 |
+
<!-- Events List -->
|
109 |
+
<div class="bg-blue-50 p-6 rounded-xl">
|
110 |
+
<h3 class="text-xl font-semibold text-blue-800 mb-4">Scheduled Events</h3>
|
111 |
+
<ul id="reminderList" class="space-y-2">
|
112 |
+
<!-- Events will be listed here -->
|
113 |
+
</ul>
|
114 |
+
</div>
|
115 |
+
</div>
|
116 |
+
</div>
|
117 |
+
</div>
|
118 |
+
|
119 |
+
<script>
|
120 |
+
// Initialize the calendar
|
121 |
+
document.addEventListener('DOMContentLoaded', function() {
|
122 |
+
const calendar = document.getElementById("calendar"),
|
123 |
+
currentDateEl = document.getElementById("currentDate"),
|
124 |
+
prevBtn = document.getElementById("prev"),
|
125 |
+
nextBtn = document.getElementById("next"),
|
126 |
+
monthViewBtn = document.getElementById("monthView"),
|
127 |
+
weekViewBtn = document.getElementById("weekView"),
|
128 |
+
dayViewBtn = document.getElementById("dayView"),
|
129 |
+
eventDate = document.getElementById("eventDate"),
|
130 |
+
eventTime = document.getElementById("eventTime"),
|
131 |
+
eventTitle = document.getElementById("eventTitle"),
|
132 |
+
eventCategory = document.getElementById("eventCategory"),
|
133 |
+
eventDescription = document.getElementById("eventDescription"),
|
134 |
+
addEventBtn = document.getElementById("addEvent"),
|
135 |
+
exportPDFBtn = document.getElementById("exportPDF"),
|
136 |
+
reminderList = document.getElementById("reminderList");
|
137 |
+
|
138 |
+
let date = new Date(),
|
139 |
+
currYear = date.getFullYear(),
|
140 |
+
currMonth = date.getMonth(),
|
141 |
+
currDay = date.getDate(),
|
142 |
+
currentView = "month";
|
143 |
+
|
144 |
+
const months = ["January", "February", "March", "April", "May", "June", "July",
|
145 |
+
"August", "September", "October", "November", "December"];
|
146 |
+
|
147 |
+
const daysOfWeek = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
148 |
+
|
149 |
+
const categoryColors = {
|
150 |
+
"Mental Health": "#1e90ff",
|
151 |
+
"Motor Control": "#ff4500",
|
152 |
+
"Lifestyle": "#32cd32",
|
153 |
+
"Research": "#9400d3"
|
154 |
+
};
|
155 |
+
|
156 |
+
// Set today's date in the form
|
157 |
+
const today = new Date();
|
158 |
+
eventDate.valueAsDate = today;
|
159 |
+
eventTime.value = "12:00";
|
160 |
+
|
161 |
+
// Load events from localStorage
|
162 |
+
const loadEvents = () => {
|
163 |
+
const events = localStorage.getItem('neuralCalendarEvents');
|
164 |
+
return events ? JSON.parse(events) : [];
|
165 |
+
};
|
166 |
+
|
167 |
+
// Save events to localStorage
|
168 |
+
const saveEvents = (events) => {
|
169 |
+
localStorage.setItem('neuralCalendarEvents', JSON.stringify(events));
|
170 |
+
};
|
171 |
+
|
172 |
+
// Add sample events if none exist
|
173 |
+
const initializeEvents = () => {
|
174 |
+
let events = loadEvents();
|
175 |
+
if (events.length === 0) {
|
176 |
+
const sampleEvents = [
|
177 |
+
{
|
178 |
+
id: Date.now().toString(),
|
179 |
+
date: formatDate(new Date()),
|
180 |
+
time: "08:00",
|
181 |
+
title: "Mindfulness Meditation",
|
182 |
+
category: "Mental Health",
|
183 |
+
description: "10 min morning session"
|
184 |
+
},
|
185 |
+
{
|
186 |
+
id: (Date.now() + 1).toString(),
|
187 |
+
date: formatDate(new Date(new Date().setDate(new Date().getDate() + 1))),
|
188 |
+
time: "18:00",
|
189 |
+
title: "Neurofeedback",
|
190 |
+
category: "Mental Health",
|
191 |
+
description: "30 min evening session"
|
192 |
+
},
|
193 |
+
{
|
194 |
+
id: (Date.now() + 2).toString(),
|
195 |
+
date: formatDate(new Date(new Date().setDate(new Date().getDate() + 2))),
|
196 |
+
time: "15:00",
|
197 |
+
title: "Physical Therapy",
|
198 |
+
category: "Motor Control",
|
199 |
+
description: "30 min CIMT exercises"
|
200 |
+
}
|
201 |
+
];
|
202 |
+
saveEvents(sampleEvents);
|
203 |
+
}
|
204 |
+
};
|
205 |
+
|
206 |
+
// Format date as YYYY-MM-DD
|
207 |
+
const formatDate = (date) => {
|
208 |
+
const d = new Date(date);
|
209 |
+
let month = '' + (d.getMonth() + 1);
|
210 |
+
let day = '' + d.getDate();
|
211 |
+
const year = d.getFullYear();
|
212 |
+
|
213 |
+
if (month.length < 2) month = '0' + month;
|
214 |
+
if (day.length < 2) day = '0' + day;
|
215 |
+
|
216 |
+
return [year, month, day].join('-');
|
217 |
+
};
|
218 |
+
|
219 |
+
// Render the calendar based on current view
|
220 |
+
const renderCalendar = () => {
|
221 |
+
const events = loadEvents();
|
222 |
+
let html = "";
|
223 |
+
|
224 |
+
if (currentView === "month") {
|
225 |
+
let firstDayofMonth = new Date(currYear, currMonth, 1).getDay();
|
226 |
+
let lastDateofMonth = new Date(currYear, currMonth + 1, 0).getDate();
|
227 |
+
let lastDayofMonth = new Date(currYear, currMonth, lastDateofMonth).getDay();
|
228 |
+
let lastDateofLastMonth = new Date(currYear, currMonth, 0).getDate();
|
229 |
+
|
230 |
+
// Weekday headers
|
231 |
+
html += `<div class="grid grid-cols-7 gap-1 mb-2">`;
|
232 |
+
daysOfWeek.forEach(day => {
|
233 |
+
html += `<div class="text-center font-semibold text-blue-800 py-2">${day}</div>`;
|
234 |
+
});
|
235 |
+
html += `</div>`;
|
236 |
+
|
237 |
+
// Calendar days
|
238 |
+
html += `<div class="grid grid-cols-7 gap-1">`;
|
239 |
+
|
240 |
+
// Days from previous month
|
241 |
+
for (let i = firstDayofMonth; i > 0; i--) {
|
242 |
+
const day = lastDateofLastMonth - i + 1;
|
243 |
+
html += `<div class="calendar-day inactive text-center py-2 rounded-lg">${day}</div>`;
|
244 |
+
}
|
245 |
+
|
246 |
+
// Days of current month
|
247 |
+
for (let i = 1; i <= lastDateofMonth; i++) {
|
248 |
+
const dateStr = `${currYear}-${String(currMonth + 1).padStart(2, '0')}-${String(i).padStart(2, '0')}`;
|
249 |
+
const isToday = i === new Date().getDate() && currMonth === new Date().getMonth() && currYear === new Date().getFullYear();
|
250 |
+
const dayEvents = events.filter(event => event.date === dateStr);
|
251 |
+
|
252 |
+
let dayClass = "calendar-day text-center py-2 rounded-lg cursor-pointer";
|
253 |
+
if (isToday) dayClass += " active";
|
254 |
+
|
255 |
+
let eventDots = "";
|
256 |
+
dayEvents.forEach(event => {
|
257 |
+
eventDots += `<span class="event-dot" style="background-color: ${categoryColors[event.category]}"></span>`;
|
258 |
+
});
|
259 |
+
|
260 |
+
html += `<div class="${dayClass}" data-date="${dateStr}">
|
261 |
+
${i}
|
262 |
+
<div class="flex justify-center">${eventDots}</div>
|
263 |
+
</div>`;
|
264 |
+
}
|
265 |
+
|
266 |
+
// Days from next month
|
267 |
+
for (let i = lastDayofMonth; i < 6; i++) {
|
268 |
+
const day = i - lastDayofMonth + 1;
|
269 |
+
html += `<div class="calendar-day inactive text-center py-2 rounded-lg">${day}</div>`;
|
270 |
+
}
|
271 |
+
|
272 |
+
html += `</div>`;
|
273 |
+
|
274 |
+
currentDateEl.textContent = `${months[currMonth]} ${currYear}`;
|
275 |
+
}
|
276 |
+
else if (currentView === "week") {
|
277 |
+
let startOfWeek = new Date(currYear, currMonth, currDay - date.getDay());
|
278 |
+
|
279 |
+
// Weekday headers
|
280 |
+
html += `<div class="grid grid-cols-7 gap-1 mb-2">`;
|
281 |
+
daysOfWeek.forEach(day => {
|
282 |
+
html += `<div class="text-center font-semibold text-blue-800 py-2">${day}</div>`;
|
283 |
+
});
|
284 |
+
html += `</div>`;
|
285 |
+
|
286 |
+
// Calendar days
|
287 |
+
html += `<div class="grid grid-cols-7 gap-1">`;
|
288 |
+
|
289 |
+
for (let i = 0; i < 7; i++) {
|
290 |
+
const day = new Date(startOfWeek);
|
291 |
+
day.setDate(startOfWeek.getDate() + i);
|
292 |
+
|
293 |
+
const dateStr = formatDate(day);
|
294 |
+
const isToday = day.getDate() === new Date().getDate() &&
|
295 |
+
day.getMonth() === new Date().getMonth() &&
|
296 |
+
day.getFullYear() === new Date().getFullYear();
|
297 |
+
const dayEvents = events.filter(event => event.date === dateStr);
|
298 |
+
|
299 |
+
let dayClass = "calendar-day text-center py-2 rounded-lg cursor-pointer";
|
300 |
+
if (isToday) dayClass += " active";
|
301 |
+
|
302 |
+
let eventDots = "";
|
303 |
+
dayEvents.forEach(event => {
|
304 |
+
eventDots += `<span class="event-dot" style="background-color: ${categoryColors[event.category]}"></span>`;
|
305 |
+
});
|
306 |
+
|
307 |
+
html += `<div class="${dayClass}" data-date="${dateStr}">
|
308 |
+
${day.getDate()}
|
309 |
+
<div class="flex justify-center">${eventDots}</div>
|
310 |
+
</div>`;
|
311 |
+
}
|
312 |
+
|
313 |
+
html += `</div>`;
|
314 |
+
|
315 |
+
const weekStart = new Date(startOfWeek);
|
316 |
+
const weekEnd = new Date(startOfWeek);
|
317 |
+
weekEnd.setDate(weekStart.getDate() + 6);
|
318 |
+
|
319 |
+
currentDateEl.textContent = `Week of ${months[weekStart.getMonth()]} ${weekStart.getDate()} - ${months[weekEnd.getMonth()]} ${weekEnd.getDate()}, ${weekEnd.getFullYear()}`;
|
320 |
+
}
|
321 |
+
else if (currentView === "day") {
|
322 |
+
const dateStr = `${currYear}-${String(currMonth + 1).padStart(2, '0')}-${String(currDay).padStart(2, '0')}`;
|
323 |
+
const isToday = currDay === new Date().getDate() &&
|
324 |
+
currMonth === new Date().getMonth() &&
|
325 |
+
currYear === new Date().getFullYear();
|
326 |
+
const dayEvents = events.filter(event => event.date === dateStr);
|
327 |
+
|
328 |
+
let dayClass = "calendar-day text-center py-8 rounded-lg cursor-pointer";
|
329 |
+
if (isToday) dayClass += " active";
|
330 |
+
|
331 |
+
html += `<div class="${dayClass}" data-date="${dateStr}">
|
332 |
+
<div class="text-2xl font-bold">${currDay}</div>
|
333 |
+
<div class="text-lg">${months[currMonth]}</div>
|
334 |
+
<div class="text-lg">${currYear}</div>
|
335 |
+
</div>`;
|
336 |
+
|
337 |
+
currentDateEl.textContent = `${months[currMonth]} ${currDay}, ${currYear}`;
|
338 |
+
}
|
339 |
+
|
340 |
+
calendar.innerHTML = html;
|
341 |
+
|
342 |
+
// Add click event to days
|
343 |
+
document.querySelectorAll('.calendar-day:not(.inactive)').forEach(day => {
|
344 |
+
day.addEventListener('click', () => {
|
345 |
+
const date = day.dataset.date;
|
346 |
+
eventDate.value = date;
|
347 |
+
renderEvents(date);
|
348 |
+
});
|
349 |
+
});
|
350 |
+
};
|
351 |
+
|
352 |
+
// Render events for a specific date
|
353 |
+
const renderEvents = (selectedDate) => {
|
354 |
+
const events = loadEvents();
|
355 |
+
const filteredEvents = events.filter(event => event.date === selectedDate);
|
356 |
+
|
357 |
+
if (filteredEvents.length === 0) {
|
358 |
+
reminderList.innerHTML = `<li class="text-gray-500 italic">No events for this date</li>`;
|
359 |
+
return;
|
360 |
+
}
|
361 |
+
|
362 |
+
reminderList.innerHTML = filteredEvents.map(event => `
|
363 |
+
<li class="event-item bg-white p-3 rounded-lg mb-2 shadow-sm"
|
364 |
+
style="border-left-color: ${categoryColors[event.category]}">
|
365 |
+
<div class="flex justify-between items-start">
|
366 |
+
<div>
|
367 |
+
<div class="font-semibold">${event.title}</div>
|
368 |
+
<div class="text-sm text-gray-600">${event.time} • ${event.category}</div>
|
369 |
+
<div class="text-sm mt-1">${event.description}</div>
|
370 |
+
</div>
|
371 |
+
<button class="delete-event text-red-500 hover:text-red-700"
|
372 |
+
data-id="${event.id}">
|
373 |
+
<span class="material-icons">delete</span>
|
374 |
+
</button>
|
375 |
+
</div>
|
376 |
+
</li>
|
377 |
+
`).join('');
|
378 |
+
|
379 |
+
// Add delete event handlers
|
380 |
+
document.querySelectorAll('.delete-event').forEach(btn => {
|
381 |
+
btn.addEventListener('click', (e) => {
|
382 |
+
e.stopPropagation();
|
383 |
+
deleteEvent(btn.dataset.id);
|
384 |
+
});
|
385 |
+
});
|
386 |
+
};
|
387 |
+
|
388 |
+
// Add a new event
|
389 |
+
const addEvent = () => {
|
390 |
+
const title = eventTitle.value.trim();
|
391 |
+
const category = eventCategory.value;
|
392 |
+
const description = eventDescription.value.trim();
|
393 |
+
const date = eventDate.value;
|
394 |
+
const time = eventTime.value;
|
395 |
+
|
396 |
+
if (!title || !date || !time) {
|
397 |
+
alert("Please fill in all required fields");
|
398 |
+
return;
|
399 |
+
}
|
400 |
+
|
401 |
+
const events = loadEvents();
|
402 |
+
const newEvent = {
|
403 |
+
id: Date.now().toString(),
|
404 |
+
date,
|
405 |
+
time,
|
406 |
+
title,
|
407 |
+
category,
|
408 |
+
description
|
409 |
+
};
|
410 |
+
|
411 |
+
events.push(newEvent);
|
412 |
+
saveEvents(events);
|
413 |
+
|
414 |
+
// Clear form
|
415 |
+
eventTitle.value = '';
|
416 |
+
eventDescription.value = '';
|
417 |
+
|
418 |
+
// Update calendar and events list
|
419 |
+
renderCalendar();
|
420 |
+
renderEvents(date);
|
421 |
+
|
422 |
+
// Show notification
|
423 |
+
showNotification(`Event added: ${title} on ${date} at ${time}`);
|
424 |
+
};
|
425 |
+
|
426 |
+
// Delete an event
|
427 |
+
const deleteEvent = (id) => {
|
428 |
+
const events = loadEvents();
|
429 |
+
const updatedEvents = events.filter(event => event.id !== id);
|
430 |
+
saveEvents(updatedEvents);
|
431 |
+
|
432 |
+
// Get the date of the deleted event to refresh that date
|
433 |
+
const deletedEvent = events.find(event => event.id === id);
|
434 |
+
if (deletedEvent) {
|
435 |
+
renderCalendar();
|
436 |
+
renderEvents(deletedEvent.date);
|
437 |
+
}
|
438 |
+
};
|
439 |
+
|
440 |
+
// Export to PDF
|
441 |
+
const exportToPDF = () => {
|
442 |
+
const { jsPDF } = window.jspdf;
|
443 |
+
const doc = new jsPDF();
|
444 |
+
|
445 |
+
doc.setFontSize(16);
|
446 |
+
doc.text("Neural Synchronization Calendar - Events", 10, 10);
|
447 |
+
|
448 |
+
const events = loadEvents();
|
449 |
+
if (events.length === 0) {
|
450 |
+
doc.setFontSize(12);
|
451 |
+
doc.text("No events to display", 10, 20);
|
452 |
+
} else {
|
453 |
+
doc.setFontSize(10);
|
454 |
+
let y = 20;
|
455 |
+
events.forEach(event => {
|
456 |
+
doc.text(`${event.date} ${event.time}: ${event.title} (${event.category})`, 10, y);
|
457 |
+
doc.text(`Description: ${event.description}`, 10, y + 5);
|
458 |
+
y += 12;
|
459 |
+
});
|
460 |
+
}
|
461 |
+
|
462 |
+
doc.save("neural-calendar-events.pdf");
|
463 |
+
};
|
464 |
+
|
465 |
+
// Show notification
|
466 |
+
const showNotification = (message) => {
|
467 |
+
if (!("Notification" in window)) {
|
468 |
+
console.log("This browser does not support desktop notification");
|
469 |
+
return;
|
470 |
+
}
|
471 |
+
|
472 |
+
if (Notification.permission === "granted") {
|
473 |
+
new Notification(message);
|
474 |
+
} else if (Notification.permission !== "denied") {
|
475 |
+
Notification.requestPermission().then(permission => {
|
476 |
+
if (permission === "granted") {
|
477 |
+
new Notification(message);
|
478 |
+
}
|
479 |
+
});
|
480 |
+
}
|
481 |
+
};
|
482 |
+
|
483 |
+
// Navigation handlers
|
484 |
+
prevBtn.addEventListener('click', () => {
|
485 |
+
if (currentView === "month") {
|
486 |
+
currMonth--;
|
487 |
+
if (currMonth < 0) {
|
488 |
+
currMonth = 11;
|
489 |
+
currYear--;
|
490 |
+
}
|
491 |
+
} else if (currentView === "week") {
|
492 |
+
currDay -= 7;
|
493 |
+
const newDate = new Date(currYear, currMonth, currDay);
|
494 |
+
currYear = newDate.getFullYear();
|
495 |
+
currMonth = newDate.getMonth();
|
496 |
+
currDay = newDate.getDate();
|
497 |
+
} else {
|
498 |
+
currDay--;
|
499 |
+
const newDate = new Date(currYear, currMonth, currDay);
|
500 |
+
currYear = newDate.getFullYear();
|
501 |
+
currMonth = newDate.getMonth();
|
502 |
+
currDay = newDate.getDate();
|
503 |
+
}
|
504 |
+
renderCalendar();
|
505 |
+
});
|
506 |
+
|
507 |
+
nextBtn.addEventListener('click', () => {
|
508 |
+
if (currentView === "month") {
|
509 |
+
currMonth++;
|
510 |
+
if (currMonth > 11) {
|
511 |
+
currMonth = 0;
|
512 |
+
currYear++;
|
513 |
+
}
|
514 |
+
} else if (currentView === "week") {
|
515 |
+
currDay += 7;
|
516 |
+
const newDate = new Date(currYear, currMonth, currDay);
|
517 |
+
currYear = newDate.getFullYear();
|
518 |
+
currMonth = newDate.getMonth();
|
519 |
+
currDay = newDate.getDate();
|
520 |
+
} else {
|
521 |
+
currDay++;
|
522 |
+
const newDate = new Date(currYear, currMonth, currDay);
|
523 |
+
currYear = newDate.getFullYear();
|
524 |
+
currMonth = newDate.getMonth();
|
525 |
+
currDay = newDate.getDate();
|
526 |
+
}
|
527 |
+
renderCalendar();
|
528 |
+
});
|
529 |
+
|
530 |
+
// View switchers
|
531 |
+
monthViewBtn.addEventListener('click', () => {
|
532 |
+
currentView = "month";
|
533 |
+
monthViewBtn.className = "px-4 py-2 bg-blue-800 text-white rounded-lg hover:bg-blue-700 transition";
|
534 |
+
weekViewBtn.className = "px-4 py-2 bg-blue-100 text-blue-800 rounded-lg hover:bg-blue-200 transition";
|
535 |
+
dayViewBtn.className = "px-4 py-2 bg-blue-100 text-blue-800 rounded-lg hover:bg-blue-200 transition";
|
536 |
+
renderCalendar();
|
537 |
+
});
|
538 |
+
|
539 |
+
weekViewBtn.addEventListener('click', () => {
|
540 |
+
currentView = "week";
|
541 |
+
monthViewBtn.className = "px-4 py-2 bg-blue-100 text-blue-800 rounded-lg hover:bg-blue-200 transition";
|
542 |
+
weekViewBtn.className = "px-4 py-2 bg-blue-800 text-white rounded-lg hover:bg-blue-700 transition";
|
543 |
+
dayViewBtn.className = "px-4 py-2 bg-blue-100 text-blue-800 rounded-lg hover:bg-blue-200 transition";
|
544 |
+
renderCalendar();
|
545 |
+
});
|
546 |
+
|
547 |
+
dayViewBtn.addEventListener('click', () => {
|
548 |
+
currentView = "day";
|
549 |
+
monthViewBtn.className = "px-4 py-2 bg-blue-100 text-blue-800 rounded-lg hover:bg-blue-200 transition";
|
550 |
+
weekViewBtn.className = "px-4 py-2 bg-blue-100 text-blue-800 rounded-lg hover:bg-blue-200 transition";
|
551 |
+
dayViewBtn.className = "px-4 py-2 bg-blue-800 text-white rounded-lg hover:bg-blue-700 transition";
|
552 |
+
renderCalendar();
|
553 |
+
});
|
554 |
+
|
555 |
+
// Form submission
|
556 |
+
addEventBtn.addEventListener('click', addEvent);
|
557 |
+
|
558 |
+
// Export PDF
|
559 |
+
exportPDFBtn.addEventListener('click', exportToPDF);
|
560 |
+
|
561 |
+
// Initialize the app
|
562 |
+
initializeEvents();
|
563 |
+
renderCalendar();
|
564 |
+
renderEvents(formatDate(new Date()));
|
565 |
+
});
|
566 |
+
</script>
|
567 |
+
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=MarcRyan/mindfullness-schedule" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
568 |
+
</html>
|
prompts.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
fix this so it works
|