Spaces:
Running

LifeOrbit / index.html
Ragulselvakumar's picture
Update LifeOrbit app
05b467e verified
Raw History Blame Contribute Delete
18 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LifeOrbit</title>
<style>
*{
box-sizing:border-box;
margin:0;
padding:0;
font-family:Arial,sans-serif;
}
body{
background:#f5f7fb;
color:#20242c;
padding-bottom:80px;
}
body.dark{
background:#15171c;
color:#f5f5f5;
}
header{
background:linear-gradient(135deg,#6c63ff,#8b5cf6);
color:white;
padding:22px 18px;
border-radius:0 0 25px 25px;
}
.header-row{
display:flex;
justify-content:space-between;
align-items:center;
}
.logo{
font-size:25px;
font-weight:bold;
}
.header-sub{
margin-top:6px;
opacity:.9;
font-size:13px;
}
.icon-btn{
border:0;
background:rgba(255,255,255,.18);
color:white;
width:40px;
height:40px;
border-radius:50%;
cursor:pointer;
font-size:18px;
}
.container{
max-width:700px;
margin:auto;
padding:18px;
}
h2{
margin-bottom:12px;
}
.card{
background:white;
border-radius:18px;
padding:18px;
margin-bottom:15px;
box-shadow:0 5px 18px rgba(0,0,0,.06);
}
.dark .card{
background:#20232a;
box-shadow:none;
}
.score-card{
text-align:center;
background:linear-gradient(135deg,#6c63ff,#8b5cf6);
color:white;
}
.score{
font-size:50px;
font-weight:bold;
margin:8px 0;
}
.score-text{
opacity:.9;
}
.section-title{
display:flex;
justify-content:space-between;
align-items:center;
margin:20px 0 12px;
}
.section-title button{
border:0;
background:none;
color:#6c63ff;
font-weight:bold;
cursor:pointer;
}
.categories{
display:grid;
grid-template-columns:repeat(2,1fr);
gap:12px;
}
.category{
padding:18px 12px;
background:white;
border-radius:16px;
text-align:center;
cursor:pointer;
box-shadow:0 4px 15px rgba(0,0,0,.05);
}
.dark .category{
background:#20232a;
}
.category-icon{
font-size:28px;
margin-bottom:8px;
}
.category-name{
font-weight:bold;
}
.item{
display:flex;
justify-content:space-between;
align-items:center;
padding:14px 0;
border-bottom:1px solid #eee;
}
.dark .item{
border-color:#333;
}
.item:last-child{
border-bottom:0;
}
.item-title{
font-weight:bold;
}
.item-info{
font-size:12px;
margin-top:5px;
color:#777;
}
.dark .item-info{
color:#aaa;
}
.status{
font-size:11px;
padding:5px 8px;
border-radius:20px;
background:#eee;
}
.due{
background:#ffe4e4;
color:#d22;
}
.upcoming{
background:#fff1c7;
color:#9a6a00;
}
.good{
background:#dcfce7;
color:#15803d;
}
.delete-btn{
margin-left:8px;
border:0;
background:#fee2e2;
color:#dc2626;
width:30px;
height:30px;
border-radius:8px;
cursor:pointer;
}
.add-btn{
width:100%;
border:0;
background:#6c63ff;
color:white;
padding:14px;
border-radius:13px;
font-size:16px;
font-weight:bold;
cursor:pointer;
}
.form-group{
margin-bottom:14px;
}
label{
display:block;
font-size:13px;
font-weight:bold;
margin-bottom:6px;
}
input,select,textarea{
width:100%;
padding:12px;
border:1px solid #ddd;
border-radius:10px;
outline:none;
background:white;
color:#222;
}
.dark input,
.dark select,
.dark textarea{
background:#181a1f;
color:white;
border-color:#444;
}
textarea{
resize:none;
height:80px;
}
.hidden{
display:none;
}
.bill-amount{
font-weight:bold;
color:#6c63ff;
}
.empty{
text-align:center;
padding:20px;
color:#888;
}
.bottom-nav{
position:fixed;
bottom:0;
left:0;
right:0;
background:white;
height:68px;
display:flex;
justify-content:space-around;
align-items:center;
box-shadow:0 -4px 15px rgba(0,0,0,.08);
z-index:10;
}
.dark .bottom-nav{
background:#20232a;
}
.nav-btn{
border:0;
background:none;
color:#777;
font-size:11px;
cursor:pointer;
}
.nav-btn span{
display:block;
font-size:22px;
margin-bottom:3px;
}
.nav-btn.active{
color:#6c63ff;
font-weight:bold;
}
.page{
display:none;
}
.page.active{
display:block;
}
@media(min-width:650px){
.categories{
grid-template-columns:repeat(4,1fr);
}
}
</style>
</head>
<body>
<header>
<div class="header-row">
<div>
<div class="logo">LifeOrbit</div>
<div class="header-sub">Manage, maintain & organize your everyday life.</div>
</div>
<button class="icon-btn" onclick="toggleDark()">🌙</button>
</div>
</header>
<!-- HOME -->
<main id="homePage" class="page active">
<div class="container">
<div class="card score-card">
<div>LifeOrbit Score</div>
<div class="score" id="score">100%</div>
<div class="score-text" id="scoreText">
Everything looks good!
</div>
</div>
<div class="section-title">
<h2>Today</h2>
</div>
<div class="card" id="todayList"></div>
<div class="section-title">
<h2>Categories</h2>
<button onclick="showPage('addPage')">+ Add</button>
</div>
<div class="categories">
<div class="category" onclick="filterCategory('Home')">
<div class="category-icon">🏠</div>
<div class="category-name">Home</div>
</div>
<div class="category" onclick="filterCategory('Vehicle')">
<div class="category-icon">🚗</div>
<div class="category-name">Vehicle</div>
</div>
<div class="category" onclick="filterCategory('Bills')">
<div class="category-icon">💳</div>
<div class="category-name">Bills</div>
</div>
<div class="category" onclick="filterCategory('Documents')">
<div class="category-icon">📄</div>
<div class="category-name">Documents</div>
</div>
<div class="category" onclick="filterCategory('Electronics')">
<div class="category-icon">💻</div>
<div class="category-name">Electronics</div>
</div>
<div class="category" onclick="filterCategory('Purchases')">
<div class="category-icon">🛒</div>
<div class="category-name">Purchases</div>
</div>
<div class="category" onclick="filterCategory('Family')">
<div class="category-icon">👨‍👩‍👧</div>
<div class="category-name">Family</div>
</div>
<div class="category" onclick="filterCategory('Others')">
<div class="category-icon">📦</div>
<div class="category-name">Others</div>
</div>
</div>
</div>
</main>
<!-- TASKS -->
<main id="tasksPage" class="page">
<div class="container">
<div class="section-title">
<h2>All Tasks</h2>
<button onclick="showPage('addPage')">+ Add</button>
</div>
<div class="card" id="allItems"></div>
</div>
</main>
<!-- ADD -->
<main id="addPage" class="page">
<div class="container">
<div class="section-title">
<h2>Add New Item</h2>
</div>
<div class="card">
<div class="form-group">
<label>Item Name</label>
<input id="itemName" placeholder="Example: Water Filter">
</div>
<div class="form-group">
<label>Category</label>
<select id="category">
<option>Home</option>
<option>Vehicle</option>
<option>Bills</option>
<option>Documents</option>
<option>Electronics</option>
<option>Purchases</option>
<option>Family</option>
<option>Others</option>
</select>
</div>
<div class="form-group">
<label>Due / Maintenance Date</label>
<input type="date" id="dueDate">
</div>
<div class="form-group">
<label>Amount (optional)</label>
<input type="number" id="amount" placeholder="Example: 850">
</div>
<div class="form-group">
<label>Notes</label>
<textarea id="notes" placeholder="Add a note..."></textarea>
</div>
<button class="add-btn" onclick="addItem()">
Save Item
</button>
</div>
</div>
</main>
<!-- CALENDAR -->
<main id="calendarPage" class="page">
<div class="container">
<div class="section-title">
<h2>Upcoming</h2>
</div>
<div class="card" id="calendarList"></div>
</div>
</main>
<!-- PROFILE -->
<main id="profilePage" class="page">
<div class="container">
<div class="section-title">
<h2>Profile</h2>
</div>
<div class="card">
<div class="form-group">
<label>Your Name</label>
<input id="userName" placeholder="Enter your name">
</div>
<button class="add-btn" onclick="saveName()">
Save Profile
</button>
</div>
<div class="card">
<h3>About LifeOrbit</h3>
<p style="margin-top:8px;color:#777;">
LifeOrbit helps you manage maintenance,
reminders, bills, warranties and everyday
responsibilities in one place.
</p>
</div>
</div>
</main>
<!-- BOTTOM NAV -->
<nav class="bottom-nav">
<button class="nav-btn active" onclick="showPage('homePage',this)">
<span>🏠</span>
Home
</button>
<button class="nav-btn" onclick="showPage('tasksPage',this)">
<span>🔔</span>
Tasks
</button>
<button class="nav-btn" onclick="showPage('addPage',this)">
<span>➕</span>
Add
</button>
<button class="nav-btn" onclick="showPage('calendarPage',this)">
<span>📅</span>
Calendar
</button>
<button class="nav-btn" onclick="showPage('profilePage',this)">
<span>👤</span>
Profile
</button>
</nav>
<script>
let items = JSON.parse(localStorage.getItem("lifeOrbitItems")) || [];
function saveItems(){
localStorage.setItem(
"lifeOrbitItems",
JSON.stringify(items)
);
}
function addItem(){
const name =
document.getElementById("itemName").value.trim();
const category =
document.getElementById("category").value;
const dueDate =
document.getElementById("dueDate").value;
const amount =
document.getElementById("amount").value;
const notes =
document.getElementById("notes").value.trim();
if(!name || !dueDate){
alert("Please enter item name and date.");
return;
}
const item = {
id:Date.now(),
name:name,
category:category,
dueDate:dueDate,
amount:amount,
notes:notes,
completed:false
};
items.push(item);
saveItems();
document.getElementById("itemName").value="";
document.getElementById("dueDate").value="";
document.getElementById("amount").value="";
document.getElementById("notes").value="";
render();
alert("Item added successfully!");
showPage("tasksPage");
}
function deleteItem(id){
if(confirm("Delete this item?")){
items =
items.filter(item => item.id !== id);
saveItems();
render();
}
}
function markComplete(id){
const item =
items.find(item => item.id === id);
if(item){
item.completed = !item.completed;
}
saveItems();
render();
}
function getStatus(date){
const today =
new Date();
today.setHours(0,0,0,0);
const target =
new Date(date + "T00:00:00");
const diff =
Math.ceil(
(target - today) /
(1000*60*60*24)
);
if(diff < 0)
return {
text:"Overdue",
class:"due"
};
if(diff === 0)
return {
text:"Today",
class:"due"
};
if(diff <= 7)
return {
text:diff + " days",
class:"upcoming"
};
return {
text:diff + " days",
class:"good"
};
}
function itemHTML(item){
const status =
getStatus(item.dueDate);
return `
<div class="item">
<div>
<div class="item-title">
${escapeHTML(item.name)}
</div>
<div class="item-info">
${item.category}
• ${formatDate(item.dueDate)}
${item.amount ? " • ₹" + item.amount : ""}
</div>
${
item.notes
? `<div class="item-info">${escapeHTML(item.notes)}</div>`
: ""
}
</div>
<div>
<span class="status ${status.class}">
${item.completed ? "Completed" : status.text}
</span>
<button
class="delete-btn"
onclick="deleteItem(${item.id})">
×
</button>
</div>
</div>
`;
}
function render(){
const all =
document.getElementById("allItems");
const today =
document.getElementById("todayList");
const calendar =
document.getElementById("calendarList");
if(items.length === 0){
all.innerHTML =
`<div class="empty">
No items added yet.<br>
Tap + Add to get started.
</div>`;
today.innerHTML =
`<div class="empty">
Nothing scheduled today.
</div>`;
calendar.innerHTML =
`<div class="empty">
No upcoming items.
</div>`;
}else{
const sorted =
[...items].sort(
(a,b) =>
new Date(a.dueDate) -
new Date(b.dueDate)
);
all.innerHTML =
sorted.map(itemHTML).join("");
const upcoming =
sorted.slice(0,5);
calendar.innerHTML =
upcoming.map(itemHTML).join("");
const todayItems =
sorted.filter(item => {
const d =
new Date();
d.setHours(0,0,0,0);
const itemDate =
new Date(item.dueDate+"T00:00:00");
return d.getTime() ===
itemDate.getTime();
});
today.innerHTML =
todayItems.length
? todayItems.map(itemHTML).join("")
: `<div class="empty">
Nothing scheduled today.
</div>`;
}
calculateScore();
}
function calculateScore(){
const scoreElement =
document.getElementById("score");
const textElement =
document.getElementById("scoreText");
if(items.length === 0){
scoreElement.innerText="100%";
textElement.innerText =
"Add items to start tracking.";
return;
}
const completed =
items.filter(item => item.completed).length;
const score =
Math.round(
(completed / items.length) * 100
);
scoreElement.innerText =
score + "%";
if(score >= 80)
textElement.innerText =
"Everything looks great!";
else if(score >= 50)
textElement.innerText =
"A few things need attention.";
else
textElement.innerText =
"Several items need attention.";
}
function formatDate(date){
if(!date) return "";
return new Date(date+"T00:00:00")
.toLocaleDateString(
"en-IN",
{
day:"2-digit",
month:"short",
year:"numeric"
}
);
}
function escapeHTML(text){
return text
.replace(/&/g,"&amp;")
.replace(/</g,"&lt;")
.replace(/>/g,"&gt;")
.replace(/"/g,"&quot;")
.replace(/'/g,"&#039;");
}
function showPage(pageId,button){
document
.querySelectorAll(".page")
.forEach(page =>
page.classList.remove("active")
);
document
.getElementById(pageId)
.classList.add("active");
document
.querySelectorAll(".nav-btn")
.forEach(btn =>
btn.classList.remove("active")
);
if(button)
button.classList.add("active");
window.scrollTo(0,0);
}
function filterCategory(category){
showPage("tasksPage");
const filtered =
items.filter(
item => item.category === category
);
const container =
document.getElementById("allItems");
if(filtered.length === 0){
container.innerHTML =
`<div class="empty">
No ${category} items added.
</div>`;
}else{
container.innerHTML =
filtered.map(itemHTML).join("");
}
}
function toggleDark(){
document.body.classList.toggle("dark");
localStorage.setItem(
"lifeOrbitDark",
document.body.classList.contains("dark")
);
}
function saveName(){
const name =
document.getElementById("userName").value.trim();
if(name){
localStorage.setItem(
"lifeOrbitName",
name
);
alert("Profile saved!");
}
}
function loadProfile(){
const name =
localStorage.getItem("lifeOrbitName");
if(name){
document.getElementById("userName").value =
name;
}
const dark =
localStorage.getItem("lifeOrbitDark");
if(dark === "true"){
document.body.classList.add("dark");
}
}
loadProfile();
render();
</script>
</body>
</html>