make better for mobile users - Follow Up Deployment
Browse files- index.html +38 -22
- prompts.txt +3 -1
index.html
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
<html lang="en" class="dark">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
| 5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
| 6 |
<title>Shared Notes App</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
|
@@ -10,33 +10,47 @@
|
|
| 10 |
<body class="bg-gray-100 dark:bg-gray-900 text-gray-900 dark:text-gray-100 min-h-screen flex flex-col">
|
| 11 |
|
| 12 |
<!-- Header -->
|
| 13 |
-
<header class="p-4 bg-white dark:bg-gray-800 shadow flex justify-between items-center">
|
| 14 |
-
<h1 class="text-
|
| 15 |
<div class="flex items-center gap-4">
|
| 16 |
-
<span id="connection-status" class="flex items-center gap-
|
| 17 |
<span class="w-2 h-2 rounded-full bg-gray-400"></span>
|
| 18 |
-
Connecting...
|
| 19 |
</span>
|
| 20 |
-
<button id="toggle-dark" class="p-2 rounded-full bg-gray-
|
| 21 |
-
<i data-feather="moon"></i>
|
| 22 |
</button>
|
| 23 |
</div>
|
| 24 |
</header>
|
| 25 |
|
| 26 |
<!-- Notes List -->
|
| 27 |
-
<main class="flex-1 p-4">
|
| 28 |
-
<ul id="notes-list" class="space-y-
|
| 29 |
</main>
|
| 30 |
|
| 31 |
<!-- Input -->
|
| 32 |
-
<footer class="p-4 bg-white dark:bg-gray-800 shadow
|
| 33 |
-
<
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
</footer>
|
| 38 |
|
| 39 |
<!-- Firebase + App -->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
<script type="module">
|
| 41 |
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.12.2/firebase-app.js";
|
| 42 |
import { getFirestore, collection, addDoc, onSnapshot, serverTimestamp, orderBy, query, doc, deleteDoc, updateDoc }
|
|
@@ -107,25 +121,26 @@
|
|
| 107 |
|
| 108 |
// 🔄 Live notes from Firestore
|
| 109 |
const q = query(collection(db, "notes"), orderBy("createdAt", "asc"));
|
| 110 |
-
notesList.innerHTML = '<div class="text-center py-
|
| 111 |
const unsubscribe = onSnapshot(q, (snapshot) => {
|
| 112 |
notesList.innerHTML = "";
|
| 113 |
if (snapshot.empty) {
|
| 114 |
-
notesList.innerHTML = '<div class="text-center py-
|
|
|
|
| 115 |
return;
|
| 116 |
}
|
| 117 |
snapshot.forEach((docSnap) => {
|
| 118 |
const note = { id: docSnap.id, ...docSnap.data() };
|
| 119 |
const li = document.createElement("li");
|
| 120 |
-
li.className = "note-item flex items-center justify-between p-
|
| 121 |
|
| 122 |
li.innerHTML = `
|
| 123 |
<div class="flex items-center flex-1">
|
| 124 |
-
<input type="checkbox" class="done-checkbox mr-
|
| 125 |
-
<span class="note-text ${note.done ? "line-through text-gray-400" : ""}">${note.text}</span>
|
| 126 |
</div>
|
| 127 |
-
<button class="delete-btn text-red-500 opacity-0 group-hover:opacity-100 transition">
|
| 128 |
-
<i data-feather="trash-2"></i>
|
| 129 |
</button>
|
| 130 |
`;
|
| 131 |
|
|
@@ -152,7 +167,8 @@
|
|
| 152 |
feather.replace();
|
| 153 |
}, (error) => {
|
| 154 |
console.error("Error loading notes:", error);
|
| 155 |
-
notesList.innerHTML = '<div class="text-center py-
|
|
|
|
| 156 |
});
|
| 157 |
|
| 158 |
window.addEventListener('beforeunload', () => unsubscribe());
|
|
|
|
| 2 |
<html lang="en" class="dark">
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8" />
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover" />
|
| 6 |
<title>Shared Notes App</title>
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
|
|
|
| 10 |
<body class="bg-gray-100 dark:bg-gray-900 text-gray-900 dark:text-gray-100 min-h-screen flex flex-col">
|
| 11 |
|
| 12 |
<!-- Header -->
|
| 13 |
+
<header class="p-4 bg-white dark:bg-gray-800 shadow-md flex justify-between items-center sticky top-0 z-10 safe-area-top">
|
| 14 |
+
<h1 class="text-2xl font-bold bg-gradient-to-r from-blue-500 to-purple-600 bg-clip-text text-transparent">Shared Notes</h1>
|
| 15 |
<div class="flex items-center gap-4">
|
| 16 |
+
<span id="connection-status" class="flex items-center gap-2 text-sm px-3 py-1 rounded-full bg-gray-100 dark:bg-gray-700">
|
| 17 |
<span class="w-2 h-2 rounded-full bg-gray-400"></span>
|
| 18 |
+
<span>Connecting...</span>
|
| 19 |
</span>
|
| 20 |
+
<button id="toggle-dark" class="p-2 rounded-full bg-gray-100 dark:bg-gray-700 hover:bg-gray-200 dark:hover:bg-gray-600 transition-colors">
|
| 21 |
+
<i data-feather="moon" class="w-5 h-5"></i>
|
| 22 |
</button>
|
| 23 |
</div>
|
| 24 |
</header>
|
| 25 |
|
| 26 |
<!-- Notes List -->
|
| 27 |
+
<main class="flex-1 p-4 max-w-2xl w-full mx-auto">
|
| 28 |
+
<ul id="notes-list" class="space-y-3"></ul>
|
| 29 |
</main>
|
| 30 |
|
| 31 |
<!-- Input -->
|
| 32 |
+
<footer class="p-4 bg-white dark:bg-gray-800 shadow-md sticky bottom-0 safe-area-bottom">
|
| 33 |
+
<div class="max-w-2xl mx-auto flex">
|
| 34 |
+
<input id="note-input" type="text" placeholder="Write a note..."
|
| 35 |
+
class="flex-1 p-3 rounded-l-lg bg-gray-100 dark:bg-gray-700 border-none outline-none focus:ring-2 focus:ring-blue-500 transition text-base"
|
| 36 |
+
autocomplete="off" autocorrect="off" spellcheck="false" />
|
| 37 |
+
<button id="add-note" class="px-6 bg-gradient-to-r from-blue-500 to-purple-600 text-white rounded-r-lg hover:opacity-90 transition active:scale-95">
|
| 38 |
+
<i data-feather="plus" class="w-5 h-5"></i>
|
| 39 |
+
</button>
|
| 40 |
+
</div>
|
| 41 |
</footer>
|
| 42 |
|
| 43 |
<!-- Firebase + App -->
|
| 44 |
+
<style>
|
| 45 |
+
@supports (padding: max(0px)) {
|
| 46 |
+
.safe-area-top {
|
| 47 |
+
padding-top: max(1rem, env(safe-area-inset-top));
|
| 48 |
+
}
|
| 49 |
+
.safe-area-bottom {
|
| 50 |
+
padding-bottom: max(1rem, env(safe-area-inset-bottom));
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
</style>
|
| 54 |
<script type="module">
|
| 55 |
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.12.2/firebase-app.js";
|
| 56 |
import { getFirestore, collection, addDoc, onSnapshot, serverTimestamp, orderBy, query, doc, deleteDoc, updateDoc }
|
|
|
|
| 121 |
|
| 122 |
// 🔄 Live notes from Firestore
|
| 123 |
const q = query(collection(db, "notes"), orderBy("createdAt", "asc"));
|
| 124 |
+
notesList.innerHTML = '<div class="text-center py-8"><div class="inline-block animate-spin rounded-full h-8 w-8 border-t-2 border-b-2 border-blue-500"></div><p class="mt-2 text-gray-500 text-lg">Loading notes...</p></div>';
|
| 125 |
const unsubscribe = onSnapshot(q, (snapshot) => {
|
| 126 |
notesList.innerHTML = "";
|
| 127 |
if (snapshot.empty) {
|
| 128 |
+
notesList.innerHTML = '<div class="text-center py-8"><i data-feather="edit" class="w-12 h-12 mx-auto text-gray-400"></i><p class="mt-2 text-gray-500 text-lg">No notes yet. Add your first note!</p></div>';
|
| 129 |
+
feather.replace();
|
| 130 |
return;
|
| 131 |
}
|
| 132 |
snapshot.forEach((docSnap) => {
|
| 133 |
const note = { id: docSnap.id, ...docSnap.data() };
|
| 134 |
const li = document.createElement("li");
|
| 135 |
+
li.className = "note-item flex items-center justify-between p-4 bg-white dark:bg-gray-800 rounded-lg shadow-sm hover:shadow-md transition-all group";
|
| 136 |
|
| 137 |
li.innerHTML = `
|
| 138 |
<div class="flex items-center flex-1">
|
| 139 |
+
<input type="checkbox" class="done-checkbox w-5 h-5 mr-3 rounded border-gray-300 text-blue-600 focus:ring-blue-500" ${note.done ? "checked" : ""}>
|
| 140 |
+
<span class="note-text ${note.done ? "line-through text-gray-400 dark:text-gray-500" : ""}">${note.text}</span>
|
| 141 |
</div>
|
| 142 |
+
<button class="delete-btn p-2 text-red-500 hover:bg-red-50 dark:hover:bg-gray-700 rounded-full opacity-100 md:opacity-0 md:group-hover:opacity-100 transition active:scale-95">
|
| 143 |
+
<i data-feather="trash-2" class="w-4 h-4"></i>
|
| 144 |
</button>
|
| 145 |
`;
|
| 146 |
|
|
|
|
| 167 |
feather.replace();
|
| 168 |
}, (error) => {
|
| 169 |
console.error("Error loading notes:", error);
|
| 170 |
+
notesList.innerHTML = '<div class="text-center py-8"><i data-feather="wifi-off" class="w-12 h-12 mx-auto text-red-500"></i><p class="mt-2 text-red-500">Error loading notes. Check connection.</p></div>';
|
| 171 |
+
feather.replace();
|
| 172 |
});
|
| 173 |
|
| 174 |
window.addEventListener('beforeunload', () => unsubscribe());
|
prompts.txt
CHANGED
|
@@ -5,4 +5,6 @@ sync should work automaticaly, when note is added to be remembered on notes (onl
|
|
| 5 |
when note is added, should have checkbox is is done or not, also should stay remembered, not to dissapier when refresh page
|
| 6 |
make my notes to be synced online (when note is added to remain on server / notes)
|
| 7 |
notes won't load after I refresh page - check the problem
|
| 8 |
-
stilll stuck at "Loading notes..."
|
|
|
|
|
|
|
|
|
| 5 |
when note is added, should have checkbox is is done or not, also should stay remembered, not to dissapier when refresh page
|
| 6 |
make my notes to be synced online (when note is added to remain on server / notes)
|
| 7 |
notes won't load after I refresh page - check the problem
|
| 8 |
+
stilll stuck at "Loading notes..."
|
| 9 |
+
make visually better
|
| 10 |
+
make better for mobile users
|