Skip to content

Commit 1b81331

Browse files
Refactor: Remove existing Pomodoro timer implementation and replace with a new structure
- Deleted main.js, pomodoro.html, and pomodoro.css files from the src directory. - Added new main.js, pomodoro.html, and pomodoro.css files to the Live Project directory. - Updated timer logic and UI elements in the new implementation. - Enhanced task management features within the timer application.
1 parent 657c4d8 commit 1b81331

5 files changed

Lines changed: 4 additions & 621 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Upload artifacts
2828
uses: actions/upload-pages-artifact@v3
2929
with:
30-
path: "src"
30+
path: "Live Project"
3131

3232
- name: Deploy to Github Pages
3333
id: deployment

src/js/main.js renamed to Live Project/js/main.js

Lines changed: 3 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ let timeLeft = FOCUS_TIME;
1717
let isRunning = false;
1818
let currentMode = "focus"; // 'focus', 'short-break', 'long-break'
1919
let timerInterval = null;
20-
let tasks = []; // List of tasks
20+
2121

2222
// ==========================================
2323
// 2. DOM ELEMENTS (Selecting by ID)
@@ -37,11 +37,7 @@ const focusBtn = document.getElementById("focus-btn");
3737
const shortBreakBtn = document.getElementById("short-break-btn");
3838
const longBreakBtn = document.getElementById("long-break-btn");
3939

40-
// Task Elements
41-
const taskList = document.getElementById("task-list");
42-
const taskInput = document.getElementById("new-task-title");
43-
const addTaskBtn = document.getElementById("add-task-btn");
44-
const taskCountNum = document.getElementById("task-count-num");
40+
4541

4642
// ==========================================
4743
// 3. TIMER FUNCTIONS
@@ -154,98 +150,7 @@ function setMode(mode) {
154150
updateTimerDisplay();
155151
}
156152

157-
// ==========================================
158-
// 4. TASK FUNCTIONS
159-
// ==========================================
160-
161-
function renderTasks() {
162-
// Clear the list
163-
taskList.innerHTML = "";
164153

165-
// Update count
166-
const completedCount = tasks.filter((t) => t.isDone).length;
167-
taskCountNum.textContent = completedCount + " / " + tasks.length;
168-
169-
if (tasks.length === 0) {
170-
taskList.innerHTML = '<li class="empty-state">No active tasks</li>';
171-
return;
172-
}
173-
174-
// Loop through tasks and create HTML
175-
for (let i = 0; i < tasks.length; i++) {
176-
const task = tasks[i];
177-
178-
const li = document.createElement("li");
179-
li.className = "task-item";
180-
if (task.isDone) {
181-
li.classList.add("completed");
182-
}
183-
184-
li.innerHTML = `
185-
<div class="task-content">
186-
<button class="btn-check">
187-
<span class="material-symbols-rounded">${
188-
task.isDone ? "check_circle" : "radio_button_unchecked"
189-
}</span>
190-
</button>
191-
<div class="task-title">${task.title}</div>
192-
</div>
193-
<div class="task-actions">
194-
<button class="btn-edit">
195-
<span class="material-symbols-rounded">edit</span>
196-
</button>
197-
<button class="btn-delete">
198-
<span class="material-symbols-rounded">delete</span>
199-
</button>
200-
</div>
201-
`;
202-
203-
// Add Event Listeners to the buttons inside this task
204-
const checkBtn = li.querySelector(".btn-check");
205-
checkBtn.addEventListener("click", () => {
206-
task.isDone = !task.isDone;
207-
renderTasks();
208-
console.log("Task checked");
209-
});
210-
211-
const editBtn = li.querySelector(".btn-edit");
212-
editBtn.addEventListener("click", () => {
213-
const newTitle = prompt("Edit task title:", task.title);
214-
if (newTitle) {
215-
task.title = newTitle;
216-
renderTasks();
217-
console.log("Task edited");
218-
}
219-
});
220-
221-
const deleteBtn = li.querySelector(".btn-delete");
222-
deleteBtn.addEventListener("click", () => {
223-
tasks.splice(i, 1); // Remove task at index i
224-
renderTasks();
225-
console.log("Task deleted");
226-
});
227-
228-
taskList.appendChild(li);
229-
}
230-
}
231-
232-
function addTask() {
233-
const title = taskInput.value;
234-
if (title === "") {
235-
alert("Please enter a task title");
236-
return;
237-
}
238-
239-
const newTask = {
240-
title: title,
241-
isDone: false,
242-
};
243-
244-
tasks.push(newTask);
245-
taskInput.value = "";
246-
console.log("Task added");
247-
renderTasks();
248-
}
249154

250155
// ==========================================
251156
// 5. EVENT LISTENERS
@@ -269,14 +174,8 @@ longBreakBtn.addEventListener("click", () => {
269174
console.log("Long break mode activated");
270175
});
271176

272-
addTaskBtn.addEventListener("click", addTask);
273177

274-
taskInput.addEventListener("keypress", (event) => {
275-
if (event.key === "Enter") {
276-
addTask();
277-
}
278-
});
279178

280179
// Initialize
281180
updateTimerDisplay();
282-
renderTasks();
181+
Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -103,34 +103,7 @@
103103
</div>
104104
</div>
105105

106-
<div class="tasks-container">
107-
<div class="tasks-header">
108-
<h3>Session Tasks</h3>
109-
<span class="task-count"
110-
><span id="task-count-num">0</span></span
111-
>
112-
</div>
113106

114-
<ul class="task-list" id="task-list">
115-
<li class="empty-state">No active tasks</li>
116-
</ul>
117-
118-
<div class="task-input-group">
119-
<input
120-
type="text"
121-
id="new-task-title"
122-
placeholder="Add a new task..."
123-
aria-label="Task Title"
124-
/>
125-
<button
126-
class="btn-icon-small"
127-
id="add-task-btn"
128-
aria-label="Add Task"
129-
>
130-
<span class="material-symbols-rounded">add</span>
131-
</button>
132-
</div>
133-
</div>
134107
</section>
135108
</main>
136109

Lines changed: 0 additions & 158 deletions
Original file line numberDiff line numberDiff line change
@@ -267,165 +267,7 @@ body {
267267
right: 0;
268268
}
269269

270-
/* === Task Section === */
271-
.tasks-container {
272-
width: 100%;
273-
margin-top: 1rem;
274-
padding-top: 1.5rem;
275-
border-top: 1px solid rgba(255, 255, 255, 0.1);
276-
}
277-
278-
.tasks-header {
279-
display: flex;
280-
justify-content: space-between;
281-
align-items: center;
282-
margin-bottom: 1rem;
283-
color: var(--text-med);
284-
font-size: 0.85rem;
285-
text-transform: uppercase;
286-
letter-spacing: 1px;
287-
font-weight: 700;
288-
}
289-
290-
/* List Styles */
291-
.task-list {
292-
list-style: none;
293-
margin-bottom: 1rem;
294-
max-height: 200px;
295-
overflow-y: auto;
296-
scrollbar-width: thin;
297-
scrollbar-color: var(--theme-primary) transparent;
298-
}
299270

300-
.task-item {
301-
background: rgba(255, 255, 255, 0.05);
302-
border-radius: 12px;
303-
padding: 12px;
304-
margin-bottom: 8px;
305-
display: flex;
306-
justify-content: space-between;
307-
align-items: center;
308-
gap: 12px;
309-
transition: all 0.2s ease;
310-
border-left: 3px solid transparent;
311-
}
312-
313-
.task-item:hover {
314-
background: rgba(255, 255, 255, 0.1);
315-
border-left-color: var(--theme-primary);
316-
}
317-
318-
.task-item.completed .task-title {
319-
text-decoration: line-through;
320-
color: var(--text-med);
321-
}
322-
323-
.task-content {
324-
flex: 1;
325-
display: flex;
326-
align-items: center;
327-
gap: 12px;
328-
overflow: hidden;
329-
}
330-
331-
.task-title {
332-
font-size: 0.95rem;
333-
color: var(--text-high);
334-
font-weight: 500;
335-
white-space: nowrap;
336-
overflow: hidden;
337-
text-overflow: ellipsis;
338-
}
339-
340-
.empty-state {
341-
text-align: center;
342-
color: var(--text-med);
343-
font-style: italic;
344-
font-size: 0.9rem;
345-
padding: 1rem;
346-
}
347-
348-
/* Input Area */
349-
.task-input-group {
350-
display: flex;
351-
gap: 8px;
352-
background: rgba(0, 0, 0, 0.2);
353-
padding: 6px;
354-
border-radius: 100px;
355-
border: 1px solid transparent;
356-
transition: border-color 0.3s ease;
357-
}
358-
359-
.task-input-group:focus-within {
360-
border-color: var(--theme-primary);
361-
}
362-
363-
.task-input-group input {
364-
flex: 1;
365-
background: transparent;
366-
border: none;
367-
color: var(--text-high);
368-
padding: 8px 16px;
369-
outline: none;
370-
font-family: var(--font-display);
371-
}
372-
373-
.btn-icon-small {
374-
background: var(--theme-primary);
375-
border: none;
376-
border-radius: 50%;
377-
width: 36px;
378-
height: 36px;
379-
display: flex;
380-
align-items: center;
381-
justify-content: center;
382-
color: #000;
383-
cursor: pointer;
384-
}
385-
.btn-icon-small:hover {
386-
filter: brightness(1.1);
387-
}
388-
389-
/* Task Actions & Buttons */
390-
.task-actions {
391-
display: flex;
392-
align-items: center;
393-
gap: 4px;
394-
opacity: 0;
395-
transition: opacity 0.2s;
396-
}
397-
398-
.task-item:hover .task-actions {
399-
opacity: 1;
400-
}
401-
402-
.btn-check,
403-
.btn-edit,
404-
.btn-delete {
405-
background: transparent;
406-
border: none;
407-
color: var(--text-med);
408-
cursor: pointer;
409-
display: flex;
410-
align-items: center;
411-
justify-content: center;
412-
padding: 4px;
413-
border-radius: 50%;
414-
transition: all 0.2s;
415-
}
416-
417-
.btn-check:hover {
418-
color: var(--theme-primary);
419-
background: rgba(255, 255, 255, 0.1);
420-
}
421-
.btn-edit:hover {
422-
color: var(--text-high);
423-
background: rgba(255, 255, 255, 0.1);
424-
}
425-
.btn-delete:hover {
426-
color: var(--google-red);
427-
background: rgba(255, 255, 255, 0.1);
428-
}
429271

430272
/* === Mobile Adjustments === */
431273
@media (max-width: 480px) {

0 commit comments

Comments
 (0)