Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 21 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,43 @@
<link rel="stylesheet" href="style.css">
</head>
<body>
/* Nav-Bar link to style.css no any functionality okay */
<nav class="navbar">
<h2>📚 Productivity Tracker</h2>

<ul class="nav-links">
<li><a href="#">Home</a></li>
<li><a href="#">Tasks</a></li>
<li><a href="#">Timer</a></li>
</ul>
</nav>

<div class="container">
<h1>📚 Productivity Tracker</h1>

<!-- Task Input -->
<h1>Stay Productive 🚀</h1>

<div class="task-box">

<input type="text" id="taskInput" placeholder="Enter your task">
<button onclick="addTask()">Add</button>

<!-- Task List -->
<button>Add</button>
</div>

<ul id="taskList"></ul>

<!-- Progress -->
<h3 id="progress">Progress: 0% (0/0 tasks completed)</h3>

<!-- Timer -->
<h3 id="progress">Progress: 0% (0/0 tasks completed)</h3>

<div class="timer">
<h2 id="time">00:00:00</h2>
<button onclick="startTimer()">Start</button>
<button onclick="stopTimer()">Stop</button>
</div>
</div>

</body>

<script src="script.js"></script>
</body>
</html>
14 changes: 13 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,24 @@ function addTask() {
let taskText = input.value.trim();

if (taskText === "") return;
//We remove all extra spaces group of strings and trim in single"" ",
const normalized=taskText.replace(/\s+/g, " ").toLowerCase();

// is any duplicate occurs we simple replace it
const isDuplicate = tasks.some(task =>
task.text.replace(/\s+/g, " ").toLowerCase() === normalized
);
// This our checker func to help if already existed don't include and throw alert message.
if (isDuplicate) {
alert(`"${taskText}" already exists in your list!`);
return;
}
//If all test pass then push into tasks.

tasks.push({ text: taskText, done: false });
input.value = "";
renderTasks();
}

// ➤ Render Tasks
function renderTasks() {
let list = document.getElementById("taskList");
Expand Down
127 changes: 109 additions & 18 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,33 +1,124 @@
body {
font-family: Arial;
background: #f4f4f4;
/* Basic Reset */
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}

/* Body Styling */
body{
font-family: Arial, sans-serif;
background: linear-gradient(to right, #667eea, #764ba2);
min-height: 100vh;
color: white;
text-align: center;
}

.container {
width: 300px;
margin: auto;
margin-top: 50px;
background: white;
/* Navbar */
.navbar{
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px 30px;
background: rgba(255,255,255,0.1);
}

/* Navbar Links */
.nav-links{
display: flex;
gap: 20px;
list-style: none;
}

.nav-links a{
text-decoration: none;
color: white;
}

/* Main Container */
.container{
width: 90%;
max-width: 400px;
margin: 50px auto;
background: rgba(255,255,255,0.15);
padding: 20px;
border-radius: 10px;

/* Simple Animation */
animation: fadeIn 1s;
}

input {
padding: 8px;
width: 70%;
/* Input Box */
.task-box{
display: flex;
gap: 10px;
margin-top: 20px;
}

button {
padding: 8px;
margin: 5px;
input{
flex: 1;
padding: 10px;
border: none;
border-radius: 5px;
}

/* Buttons */
button{
padding: 10px;
border: none;
border-radius: 5px;
cursor: pointer;
background: yellow;
font-weight: bold;

transition: 0.3s;
}

/* Button Hover Effect */
button:hover{
transform: scale(1.05);
}

li {
/* Task List */
li{
list-style: none;
margin: 10px 0;
background: #eee;
padding: 5px;
background: rgba(255,255,255,0.2);
margin-top: 10px;
padding: 10px;
border-radius: 5px;
}

/* Timer */
.timer{
margin-top: 20px;
}

/* Animation */
@keyframes fadeIn{
from{
opacity: 0;
transform: translateY(20px);
}

to{
opacity: 1;
transform: translateY(0);
}
}

/* Responsive Design */
@media(max-width: 600px){

.navbar{
flex-direction: column;
gap: 10px;
}

.task-box{
flex-direction: column;
}

button{
width: 100%;
}
}
1 change: 1 addition & 0 deletions tempCodeRunnerFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
input.value = "";