Nakvi commited on
Commit
93f26cb
·
verified ·
1 Parent(s): c920a92

Upload 5 files

Browse files
ui_pages/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ # FocusTrack UI Pages
ui_pages/activity_log.py ADDED
@@ -0,0 +1,175 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ FocusTrack - Page 3: Activity Log
3
+ Searchable, filterable, paginated activity table.
4
+ """
5
+
6
+ import streamlit as st
7
+ import pandas as pd
8
+ from datetime import datetime, timedelta, date
9
+
10
+ from ui_utils import (
11
+ fmt_duration, privacy_badge, page_header,
12
+ CATEGORY_COLORS, get_db, get_date_range
13
+ )
14
+
15
+
16
+ PAGE_SIZE = 50
17
+
18
+
19
+ def render():
20
+ db = get_db()
21
+ privacy_badge()
22
+ page_header("Activity Log", "Browse and search all tracked sessions")
23
+
24
+ # ── Filters ───────────────────────────────────────────────────────────────
25
+ col1, col2, col3, col4 = st.columns([1.5, 1, 1, 1])
26
+
27
+ with col1:
28
+ search = st.text_input("🔍 Search", placeholder="App, title, or category…")
29
+
30
+ with col2:
31
+ range_sel = st.selectbox("Range", ["Today", "Yesterday", "Last 7 days", "Last 30 days", "Custom"], index=2)
32
+
33
+ start, end = get_date_range(range_sel)
34
+ if range_sel == "Custom":
35
+ with col3:
36
+ start_d = st.date_input("From", value=date.today() - timedelta(days=6))
37
+ with col4:
38
+ end_d = st.date_input("To", value=date.today())
39
+ start = datetime.combine(start_d, datetime.min.time())
40
+ end = datetime.combine(end_d, datetime.max.time())
41
+
42
+ # Filter by category
43
+ cats = [c["name"] for c in db.get_categories()]
44
+ with col3 if range_sel != "Custom" else st.columns(1)[0]:
45
+ pass
46
+ cat_filter_col, show_idle_col = st.columns([2, 1])
47
+ with cat_filter_col:
48
+ selected_cats = st.multiselect("Filter by category", cats, default=[])
49
+ with show_idle_col:
50
+ show_idle = st.checkbox("Include idle", value=False)
51
+
52
+ # ── Count & Pagination ────────────────────────────────────────────────────
53
+ total_count = db.get_activity_count(start, end, search)
54
+
55
+ if "log_page" not in st.session_state:
56
+ st.session_state.log_page = 0
57
+ page = st.session_state.log_page
58
+ offset = page * PAGE_SIZE
59
+ total_pages = max(1, (total_count + PAGE_SIZE - 1) // PAGE_SIZE)
60
+
61
+ # ── Fetch Data ────────────────────────────────────────────────────────────
62
+ rows = db.get_activities(start, end, search=search, limit=PAGE_SIZE, offset=offset)
63
+
64
+ # Apply local filters
65
+ if selected_cats:
66
+ rows = [r for r in rows if r.get("category") in selected_cats]
67
+ if not show_idle:
68
+ rows = [r for r in rows if not r.get("is_idle")]
69
+
70
+ # ── Stats bar ─────────────────────────────────────────────────────────────
71
+ st.markdown(
72
+ f"<p style='color:#9090b0; font-size:0.8rem; margin:8px 0;'>"
73
+ f"Showing {len(rows)} of {total_count:,} records &nbsp;|&nbsp; "
74
+ f"Page {page + 1} of {total_pages}"
75
+ f"</p>",
76
+ unsafe_allow_html=True,
77
+ )
78
+
79
+ # ── Table ─────────────────────────────────────────────────────────────────
80
+ if rows:
81
+ html_rows = ""
82
+ for r in rows:
83
+ cat = r.get("category", "uncategorized")
84
+ color = CATEGORY_COLORS.get(cat, "#6366f1")
85
+ ts = r.get("timestamp", "")[:19].replace("T", " ")
86
+ is_idle_icon = "💤" if r.get("is_idle") else "●"
87
+ idle_color = "#374151" if r.get("is_idle") else "#10b981"
88
+ dur = fmt_duration(r.get("duration_seconds", 0))
89
+ app = str(r.get("app_name", ""))[:30]
90
+ title = str(r.get("window_title", ""))[:60]
91
+
92
+ html_rows += f"""
93
+ <tr style="border-bottom:1px solid #1a1a2a; transition:background 0.15s;"
94
+ onmouseover="this.style.background='#1c1c27'" onmouseout="this.style.background='transparent'">
95
+ <td style="padding:9px 12px; font-family:'DM Mono',monospace; font-size:0.78rem; color:#9090b0; white-space:nowrap;">{ts}</td>
96
+ <td style="padding:9px 12px; font-weight:500; color:#f0f0ff; font-size:0.85rem;">{app}</td>
97
+ <td style="padding:9px 12px; color:#9090b0; font-size:0.82rem; max-width:280px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">{title}</td>
98
+ <td style="padding:9px 12px; font-family:'DM Mono',monospace; font-size:0.82rem; color:#9090b0;">{dur}</td>
99
+ <td style="padding:9px 12px;">
100
+ <span style="background:{color}22; color:{color}; border:1px solid {color}44;
101
+ border-radius:20px; padding:2px 8px; font-size:0.7rem; font-weight:600; font-family:'DM Mono',monospace;">{cat}</span>
102
+ </td>
103
+ <td style="padding:9px 12px; color:{idle_color}; font-size:0.9rem;" title="{'Idle' if r.get('is_idle') else 'Active'}">{is_idle_icon}</td>
104
+ </tr>"""
105
+
106
+ st.markdown(f"""
107
+ <div style="overflow-x:auto; border:1px solid #2a2a3a; border-radius:12px; margin-bottom:1rem;">
108
+ <table style="width:100%; border-collapse:collapse; font-family:'Inter',sans-serif;">
109
+ <thead>
110
+ <tr style="background:#111118; color:#5a5a7a; font-size:0.7rem; text-transform:uppercase; letter-spacing:0.08em; border-bottom:1px solid #2a2a3a;">
111
+ <th style="text-align:left; padding:10px 12px; font-weight:500;">Time</th>
112
+ <th style="text-align:left; padding:10px 12px; font-weight:500;">App</th>
113
+ <th style="text-align:left; padding:10px 12px; font-weight:500;">Window Title</th>
114
+ <th style="text-align:left; padding:10px 12px; font-weight:500;">Duration</th>
115
+ <th style="text-align:left; padding:10px 12px; font-weight:500;">Category</th>
116
+ <th style="text-align:left; padding:10px 12px; font-weight:500;">Status</th>
117
+ </tr>
118
+ </thead>
119
+ <tbody>{html_rows}</tbody>
120
+ </table>
121
+ </div>
122
+ """, unsafe_allow_html=True)
123
+ else:
124
+ st.markdown("""
125
+ <div style="padding:3rem; text-align:center; border:1px dashed #2a2a3a; border-radius:12px; color:#5a5a7a;">
126
+ No activity records found for the selected filters.
127
+ </div>""", unsafe_allow_html=True)
128
+
129
+ # ── Pagination controls ───────────────────────────────────────────────────
130
+ pc1, pc2, pc3, pc4, pc5 = st.columns([1, 1, 2, 1, 1])
131
+ with pc1:
132
+ if st.button("⏮ First") and page > 0:
133
+ st.session_state.log_page = 0
134
+ st.rerun()
135
+ with pc2:
136
+ if st.button("◀ Prev") and page > 0:
137
+ st.session_state.log_page = page - 1
138
+ st.rerun()
139
+ with pc3:
140
+ st.markdown(
141
+ f"<div style='text-align:center; color:#9090b0; font-size:0.82rem; padding-top:8px;'>"
142
+ f"Page {page + 1} / {total_pages}</div>",
143
+ unsafe_allow_html=True,
144
+ )
145
+ with pc4:
146
+ if st.button("Next ▶") and page < total_pages - 1:
147
+ st.session_state.log_page = page + 1
148
+ st.rerun()
149
+ with pc5:
150
+ if st.button("Last ⏭") and page < total_pages - 1:
151
+ st.session_state.log_page = total_pages - 1
152
+ st.rerun()
153
+
154
+ # ── Export ────────────────────────────────────────────────────────────────
155
+ st.markdown("---")
156
+ all_rows = db.get_activities(start, end, search=search, limit=100000)
157
+ if all_rows:
158
+ df_export = pd.DataFrame(all_rows)
159
+ col_ex1, col_ex2 = st.columns([1, 1])
160
+ with col_ex1:
161
+ st.download_button(
162
+ "📥 Export visible data (CSV)",
163
+ df_export.to_csv(index=False).encode("utf-8"),
164
+ file_name="focustrack_log.csv",
165
+ mime="text/csv",
166
+ use_container_width=True,
167
+ )
168
+ with col_ex2:
169
+ st.download_button(
170
+ "📥 Export visible data (JSON)",
171
+ df_export.to_json(orient="records", indent=2).encode("utf-8"),
172
+ file_name="focustrack_log.json",
173
+ mime="application/json",
174
+ use_container_width=True,
175
+ )
ui_pages/analytics.py ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ FocusTrack - Page 2: Analytics & Reports
3
+ Date-range charts, heatmaps, export.
4
+ """
5
+
6
+ import streamlit as st
7
+ import plotly.express as px
8
+ import plotly.graph_objects as go
9
+ import pandas as pd
10
+ import json
11
+ import io
12
+ from datetime import datetime, timedelta, date
13
+
14
+ from ui_utils import (
15
+ fmt_duration, fmt_duration_long, get_focus_score,
16
+ privacy_badge, page_header, CATEGORY_COLORS, get_db, get_date_range
17
+ )
18
+
19
+
20
+ def render():
21
+ db = get_db()
22
+ privacy_badge()
23
+ page_header("Analytics & Reports", "Visualize your productivity trends")
24
+
25
+ # ── Date Range Selector ───────────────────────────────────────────────────
26
+ col_range, col_start, col_end = st.columns([1.5, 1, 1])
27
+ with col_range:
28
+ range_sel = st.selectbox(
29
+ "Date range",
30
+ ["Today", "Yesterday", "Last 7 days", "Last 30 days", "Custom"],
31
+ index=2,
32
+ )
33
+ start, end = get_date_range(range_sel)
34
+ if range_sel == "Custom":
35
+ with col_start:
36
+ start_d = st.date_input("From", value=date.today() - timedelta(days=6))
37
+ with col_end:
38
+ end_d = st.date_input("To", value=date.today())
39
+ start = datetime.combine(start_d, datetime.min.time())
40
+ end = datetime.combine(end_d, datetime.max.time())
41
+
42
+ # ── Summary Metrics ───────────────────────────────────────────────────────
43
+ summary = db.get_summary(start, end)
44
+ focus_sec = summary.get("focus_seconds") or 0
45
+ idle_sec = summary.get("idle_seconds") or 0
46
+ total_sec = summary.get("total_seconds") or 0
47
+
48
+ c1, c2, c3, c4 = st.columns(4)
49
+ with c1: st.metric("Total Focus Time", fmt_duration_long(focus_sec))
50
+ with c2: st.metric("Total Idle Time", fmt_duration_long(idle_sec))
51
+ with c3: st.metric("Focus Score", f"{get_focus_score(focus_sec, total_sec)}%")
52
+ with c4: st.metric("Tracked Time", fmt_duration_long(total_sec))
53
+
54
+ st.markdown("<div style='height:0.75rem'></div>", unsafe_allow_html=True)
55
+
56
+ # ── Daily Activity Bar Chart ──────────────────────────────────────────────
57
+ daily = db.get_daily_totals(start, end)
58
+ if daily:
59
+ st.markdown("#### Daily Activity")
60
+ df_daily = pd.DataFrame(daily)
61
+ df_daily["focus_min"] = df_daily["focus_seconds"] / 60
62
+ df_daily["idle_min"] = df_daily["idle_seconds"] / 60
63
+
64
+ fig = go.Figure()
65
+ fig.add_bar(
66
+ x=df_daily["day"], y=df_daily["focus_min"],
67
+ name="Focus", marker_color="#6366f1",
68
+ hovertemplate="<b>%{x}</b><br>Focus: %{y:.0f} min<extra></extra>"
69
+ )
70
+ fig.add_bar(
71
+ x=df_daily["day"], y=df_daily["idle_min"],
72
+ name="Idle", marker_color="#374151",
73
+ hovertemplate="<b>%{x}</b><br>Idle: %{y:.0f} min<extra></extra>"
74
+ )
75
+ fig.update_layout(
76
+ barmode="stack", height=280,
77
+ paper_bgcolor="rgba(0,0,0,0)", plot_bgcolor="rgba(0,0,0,0)",
78
+ font=dict(color="#9090b0", family="Inter"),
79
+ margin=dict(t=10, b=30, l=0, r=0),
80
+ xaxis=dict(showgrid=False),
81
+ yaxis=dict(showgrid=True, gridcolor="#2a2a3a", title="Minutes"),
82
+ legend=dict(orientation="h", yanchor="bottom", y=1, xanchor="left", x=0),
83
+ )
84
+ st.plotly_chart(fig, use_container_width=True, config={"displayModeBar": False})
85
+
86
+ # ── Two-column: Category Breakdown + Top Apps ─────────────────────────────
87
+ col_l, col_r = st.columns(2)
88
+
89
+ with col_l:
90
+ st.markdown("#### Time by Category")
91
+ cat_data = db.get_by_category(start, end)
92
+ if cat_data:
93
+ df_cat = pd.DataFrame(cat_data)
94
+ df_cat["minutes"] = df_cat["total_seconds"] / 60
95
+ colors = [CATEGORY_COLORS.get(c, "#6366f1") for c in df_cat["category"]]
96
+ fig_cat = px.bar(
97
+ df_cat, x="minutes", y="category", orientation="h",
98
+ color="category", color_discrete_map=CATEGORY_COLORS,
99
+ labels={"minutes": "Minutes", "category": ""},
100
+ )
101
+ fig_cat.update_layout(
102
+ height=300, showlegend=False,
103
+ paper_bgcolor="rgba(0,0,0,0)", plot_bgcolor="rgba(0,0,0,0)",
104
+ font=dict(color="#9090b0", family="Inter"),
105
+ margin=dict(t=10, b=30, l=0, r=0),
106
+ xaxis=dict(showgrid=True, gridcolor="#2a2a3a"),
107
+ yaxis=dict(showgrid=False),
108
+ )
109
+ st.plotly_chart(fig_cat, use_container_width=True, config={"displayModeBar": False})
110
+ else:
111
+ st.markdown("<p style='color:#5a5a7a'>No data for this range.</p>", unsafe_allow_html=True)
112
+
113
+ with col_r:
114
+ st.markdown("#### Top Apps Leaderboard")
115
+ apps_data = db.get_by_app(start, end, limit=10)
116
+ if apps_data:
117
+ df_apps = pd.DataFrame(apps_data)
118
+ df_apps["minutes"] = df_apps["total_seconds"] / 60
119
+ html = ""
120
+ max_min = df_apps["minutes"].max() or 1
121
+ for i, row in df_apps.iterrows():
122
+ cat = row.get("category", "uncategorized")
123
+ color = CATEGORY_COLORS.get(cat, "#6366f1")
124
+ pct = int((row["minutes"] / max_min) * 100)
125
+ rank = i + 1
126
+ html += f"""
127
+ <div style="display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid #1e1e2e;">
128
+ <div style="font-family:'DM Mono',monospace; font-size:0.8rem; color:#5a5a7a; min-width:20px;">#{rank}</div>
129
+ <div style="flex:1; min-width:0;">
130
+ <div style="font-size:0.85rem; font-weight:500; color:#f0f0ff; margin-bottom:3px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">{row['app_name'][:30]}</div>
131
+ <div style="background:#1e1e2e; border-radius:4px; height:4px;">
132
+ <div style="background:{color}; width:{pct}%; height:100%; border-radius:4px;"></div>
133
+ </div>
134
+ </div>
135
+ <div style="font-family:'DM Mono',monospace; font-size:0.8rem; color:#9090b0; min-width:55px; text-align:right;">{fmt_duration(row['total_seconds'])}</div>
136
+ </div>"""
137
+ st.markdown(f'<div style="font-family:Inter,sans-serif;">{html}</div>', unsafe_allow_html=True)
138
+ else:
139
+ st.markdown("<p style='color:#5a5a7a'>No data for this range.</p>", unsafe_allow_html=True)
140
+
141
+ # ── Weekly Heatmap ────────────────────────────────────────────────────────
142
+ if range_sel in ("Last 7 days", "Last 30 days", "Custom"):
143
+ st.markdown("#### Weekly Activity Heatmap (hours × days)")
144
+ acts = db.get_activities(start, end, limit=50000)
145
+ if acts:
146
+ df_all = pd.DataFrame(acts)
147
+ df_all["dt"] = pd.to_datetime(df_all["timestamp"])
148
+ df_all["hour"] = df_all["dt"].dt.hour
149
+ df_all["day"] = df_all["dt"].dt.strftime("%a %b %d")
150
+ heatmap = df_all.groupby(["day", "hour"])["duration_seconds"].sum().reset_index()
151
+ heatmap["minutes"] = heatmap["duration_seconds"] / 60
152
+ pivot = heatmap.pivot_table(index="day", columns="hour", values="minutes", fill_value=0)
153
+
154
+ fig_hm = go.Figure(go.Heatmap(
155
+ z=pivot.values,
156
+ x=[f"{h:02d}:00" for h in pivot.columns],
157
+ y=pivot.index.tolist(),
158
+ colorscale=[[0, "#0a0a0f"], [0.3, "#1a1a3a"], [0.7, "#4040a0"], [1, "#6366f1"]],
159
+ showscale=True,
160
+ hovertemplate="<b>%{y}</b> at <b>%{x}</b><br>%{z:.0f} minutes<extra></extra>",
161
+ ))
162
+ fig_hm.update_layout(
163
+ height=max(200, len(pivot) * 30 + 80),
164
+ paper_bgcolor="rgba(0,0,0,0)",
165
+ plot_bgcolor="rgba(0,0,0,0)",
166
+ font=dict(color="#9090b0", family="Inter"),
167
+ margin=dict(t=10, b=30, l=80, r=0),
168
+ xaxis=dict(tickfont=dict(size=9)),
169
+ yaxis=dict(tickfont=dict(size=9)),
170
+ )
171
+ st.plotly_chart(fig_hm, use_container_width=True, config={"displayModeBar": False})
172
+
173
+ # ── Export ────────────────────────────────────────────────────────────────
174
+ st.markdown("---")
175
+ st.markdown("#### Export Data")
176
+ col_ex1, col_ex2, col_ex3 = st.columns([1, 1, 4])
177
+
178
+ acts_for_export = db.get_activities(start, end, limit=100000)
179
+ if acts_for_export:
180
+ df_export = pd.DataFrame(acts_for_export)
181
+
182
+ with col_ex1:
183
+ csv_buf = df_export.to_csv(index=False).encode("utf-8")
184
+ st.download_button(
185
+ "📥 Export CSV", csv_buf,
186
+ file_name=f"focustrack_export_{start.date()}_{end.date()}.csv",
187
+ mime="text/csv", use_container_width=True
188
+ )
189
+
190
+ with col_ex2:
191
+ json_buf = df_export.to_json(orient="records", indent=2).encode("utf-8")
192
+ st.download_button(
193
+ "📥 Export JSON", json_buf,
194
+ file_name=f"focustrack_export_{start.date()}_{end.date()}.json",
195
+ mime="application/json", use_container_width=True
196
+ )
197
+ else:
198
+ st.markdown("<p style='color:#5a5a7a; font-size:0.85rem;'>No data to export for selected range.</p>",
199
+ unsafe_allow_html=True)
ui_pages/dashboard.py ADDED
@@ -0,0 +1,253 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ FocusTrack - Page 1: Live Dashboard
3
+ Real-time activity overview with charts and controls.
4
+ """
5
+
6
+ import streamlit as st
7
+ import plotly.express as px
8
+ import plotly.graph_objects as go
9
+ import pandas as pd
10
+ from datetime import datetime, timedelta, date
11
+
12
+ from ui_utils import (
13
+ fmt_duration, fmt_duration_long, get_focus_score,
14
+ privacy_badge, page_header, status_dot, category_pill,
15
+ CATEGORY_COLORS, get_db
16
+ )
17
+
18
+
19
+ def render():
20
+ db = get_db()
21
+ privacy_badge()
22
+ page_header("Live Dashboard", "Real-time activity overview")
23
+
24
+ # ── Current Session Card ──────────────────────────────────────────────────
25
+ latest = db.get_latest_activity()
26
+ tracker_status = db.get_setting("tracker_running", "true")
27
+
28
+ status_label = {
29
+ "true": ("running", "#10b981"),
30
+ "paused": ("paused", "#f59e0b"),
31
+ "false": ("stopped", "#f43f5e"),
32
+ }.get(tracker_status, ("unknown", "#6366f1"))
33
+
34
+ app_name = latest.get("app_name", "—") if latest else "—"
35
+ window = latest.get("window_title", "—") if latest else "—"
36
+ category = latest.get("category", "—") if latest else "—"
37
+ cat_color = CATEGORY_COLORS.get(category, "#6366f1")
38
+
39
+ st.markdown(f"""
40
+ <div style="
41
+ background: linear-gradient(135deg, #16161f 0%, #1a1a2a 100%);
42
+ border: 1px solid #2a2a3a; border-left: 4px solid {cat_color};
43
+ border-radius: 16px; padding: 1.5rem 2rem; margin-bottom: 1.5rem;
44
+ display: flex; justify-content: space-between; align-items: center;
45
+ box-shadow: 0 4px 20px rgba(0,0,0,0.3);
46
+ ">
47
+ <div>
48
+ <div style="display:flex; align-items:center; gap:10px; margin-bottom:6px;">
49
+ <span style="font-size:0.75rem; color:#9090b0; font-family:'DM Mono',monospace; text-transform:uppercase; letter-spacing:0.1em;">NOW TRACKING</span>
50
+ <span style="background:{status_label[1]}22; color:{status_label[1]}; border:1px solid {status_label[1]}44; border-radius:20px; padding:2px 10px; font-size:0.7rem; font-weight:600;">● {status_label[0].upper()}</span>
51
+ </div>
52
+ <div style="font-family:'Syne',sans-serif; font-size:1.6rem; font-weight:700; color:#f0f0ff; margin-bottom:4px; letter-spacing:-0.02em;">
53
+ {app_name[:60]}
54
+ </div>
55
+ <div style="color:#9090b0; font-size:0.85rem; margin-bottom:8px; max-width:600px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;">
56
+ {window[:80]}
57
+ </div>
58
+ <span style="background:{cat_color}22; color:{cat_color}; border:1px solid {cat_color}44; border-radius:20px; padding:3px 12px; font-size:0.72rem; font-weight:600; font-family:'DM Mono',monospace;">
59
+ {category}
60
+ </span>
61
+ </div>
62
+ <div style="text-align:right; color:#9090b0; font-family:'DM Mono',monospace; font-size:0.8rem;">
63
+ {datetime.now().strftime("%H:%M:%S")}
64
+ </div>
65
+ </div>
66
+ """, unsafe_allow_html=True)
67
+
68
+ # ── Summary Metrics ────────────────────────────────────────────────────────
69
+ today_start = datetime.combine(date.today(), datetime.min.time())
70
+ today_end = datetime.combine(date.today(), datetime.max.time())
71
+ summary = db.get_summary(today_start, today_end)
72
+
73
+ focus_sec = summary.get("focus_seconds") or 0
74
+ idle_sec = summary.get("idle_seconds") or 0
75
+ total_sec = summary.get("total_seconds") or 0
76
+ focus_score = get_focus_score(focus_sec, total_sec)
77
+
78
+ top_apps = db.get_by_app(today_start, today_end, limit=1)
79
+ top_app = top_apps[0]["app_name"] if top_apps else "—"
80
+
81
+ c1, c2, c3, c4 = st.columns(4)
82
+ with c1:
83
+ st.metric("🎯 Focus Today", fmt_duration_long(focus_sec),
84
+ delta=f"+{fmt_duration(focus_sec)}" if focus_sec > 0 else None)
85
+ with c2:
86
+ st.metric("💤 Idle Time", fmt_duration_long(idle_sec))
87
+ with c3:
88
+ pct_color = "normal" if focus_score >= 60 else "inverse"
89
+ st.metric("📊 Focus Score", f"{focus_score}%",
90
+ delta="Good" if focus_score >= 60 else "Low",
91
+ delta_color=pct_color)
92
+ with c4:
93
+ st.metric("🏆 Top App", top_app[:20] if top_app != "—" else "—")
94
+
95
+ st.markdown("<div style='height:1rem'></div>", unsafe_allow_html=True)
96
+
97
+ # ── Controls ──────────────────────────────────────────────────────────────
98
+ st.markdown("**Tracker Controls**")
99
+ col1, col2, col3, col4 = st.columns([1, 1, 1, 4])
100
+ with col1:
101
+ if st.button("▶ Start", use_container_width=True):
102
+ db.set_setting("tracker_running", "true")
103
+ st.toast("✅ Tracker started!", icon="▶")
104
+ st.rerun()
105
+ with col2:
106
+ if st.button("⏸ Pause", use_container_width=True):
107
+ db.set_setting("tracker_running", "paused")
108
+ st.toast("⏸ Tracker paused", icon="⏸")
109
+ st.rerun()
110
+ with col3:
111
+ if st.button("⏹ Stop", use_container_width=True):
112
+ db.set_setting("tracker_running", "false")
113
+ st.toast("⏹ Tracker stopped", icon="⏹")
114
+ st.rerun()
115
+
116
+ st.markdown("<div style='height:0.5rem'></div>", unsafe_allow_html=True)
117
+
118
+ # ── Charts Row ────────────────────────────────────────────────────────────
119
+ col_left, col_right = st.columns([1.1, 1.9])
120
+
121
+ with col_left:
122
+ st.markdown("#### Time by Category")
123
+ cat_data = db.get_by_category(today_start, today_end)
124
+ if cat_data:
125
+ df_cat = pd.DataFrame(cat_data)
126
+ df_cat["minutes"] = df_cat["total_seconds"] / 60
127
+ df_cat["label"] = df_cat.apply(
128
+ lambda r: f"{r['category']} ({fmt_duration(r['total_seconds'])})", axis=1
129
+ )
130
+ colors = [CATEGORY_COLORS.get(c, "#6366f1") for c in df_cat["category"]]
131
+ fig = go.Figure(go.Pie(
132
+ labels=df_cat["category"],
133
+ values=df_cat["minutes"],
134
+ hole=0.55,
135
+ marker=dict(colors=colors, line=dict(width=2, color="#0a0a0f")),
136
+ textinfo="label+percent",
137
+ textfont=dict(size=11, family="Inter"),
138
+ hovertemplate="<b>%{label}</b><br>%{value:.0f} min<br>%{percent}<extra></extra>",
139
+ ))
140
+ fig.update_layout(
141
+ showlegend=False,
142
+ margin=dict(t=20, b=20, l=20, r=20),
143
+ height=300,
144
+ paper_bgcolor="rgba(0,0,0,0)",
145
+ plot_bgcolor="rgba(0,0,0,0)",
146
+ font=dict(color="#9090b0", family="Inter"),
147
+ annotations=[dict(
148
+ text=f"<b>{fmt_duration(focus_sec)}</b>",
149
+ x=0.5, y=0.5, font_size=16,
150
+ font_family="Syne", font_color="#f0f0ff",
151
+ showarrow=False
152
+ )]
153
+ )
154
+ st.plotly_chart(fig, use_container_width=True, config={"displayModeBar": False})
155
+ else:
156
+ st.markdown("""
157
+ <div style="height:280px; display:flex; align-items:center; justify-content:center;
158
+ color:#5a5a7a; font-size:0.9rem; border:1px dashed #2a2a3a; border-radius:12px;">
159
+ No data yet today. Start the tracker to begin.
160
+ </div>""", unsafe_allow_html=True)
161
+
162
+ with col_right:
163
+ st.markdown("#### Hourly Activity Timeline")
164
+ hourly = db.get_hourly_timeline(date.today())
165
+ if hourly:
166
+ df_h = pd.DataFrame(hourly)
167
+ df_h["hour_label"] = df_h["hour"].apply(lambda h: f"{int(h):02d}:00")
168
+ df_h["minutes"] = df_h["total_seconds"] / 60
169
+ df_h["color"] = df_h["category"].map(lambda c: CATEGORY_COLORS.get(c, "#6366f1"))
170
+
171
+ fig2 = px.bar(
172
+ df_h, x="hour_label", y="minutes",
173
+ color="category",
174
+ color_discrete_map=CATEGORY_COLORS,
175
+ labels={"hour_label": "Hour", "minutes": "Minutes"},
176
+ barmode="stack",
177
+ )
178
+ fig2.update_layout(
179
+ margin=dict(t=20, b=30, l=0, r=0),
180
+ height=300,
181
+ paper_bgcolor="rgba(0,0,0,0)",
182
+ plot_bgcolor="rgba(0,0,0,0)",
183
+ font=dict(color="#9090b0", family="Inter"),
184
+ xaxis=dict(showgrid=False, tickfont=dict(size=10)),
185
+ yaxis=dict(showgrid=True, gridcolor="#2a2a3a", tickfont=dict(size=10)),
186
+ legend=dict(
187
+ orientation="h", yanchor="bottom", y=1.02,
188
+ xanchor="left", x=0, font=dict(size=10)
189
+ ),
190
+ bargap=0.15,
191
+ )
192
+ st.plotly_chart(fig2, use_container_width=True, config={"displayModeBar": False})
193
+ else:
194
+ st.markdown("""
195
+ <div style="height:280px; display:flex; align-items:center; justify-content:center;
196
+ color:#5a5a7a; font-size:0.9rem; border:1px dashed #2a2a3a; border-radius:12px;">
197
+ No hourly data yet for today.
198
+ </div>""", unsafe_allow_html=True)
199
+
200
+ # ── Top Apps Table ────────────────────────────────────────────────────────
201
+ st.markdown("#### Top Apps Today")
202
+ top_apps_data = db.get_by_app(today_start, today_end, limit=8)
203
+ if top_apps_data:
204
+ df_apps = pd.DataFrame(top_apps_data)
205
+ df_apps["time"] = df_apps["total_seconds"].apply(fmt_duration_long)
206
+ df_apps["pct"] = df_apps["total_seconds"].apply(
207
+ lambda s: f"{(s / focus_sec * 100):.0f}%" if focus_sec > 0 else "—"
208
+ )
209
+ # Render as styled rows
210
+ html_rows = ""
211
+ for _, row in df_apps.iterrows():
212
+ cat = row.get("category", "uncategorized")
213
+ color = CATEGORY_COLORS.get(cat, "#6366f1")
214
+ bar_w = int((row["total_seconds"] / (df_apps["total_seconds"].max() or 1)) * 100)
215
+ html_rows += f"""
216
+ <tr style="border-bottom:1px solid #1e1e2e;">
217
+ <td style="padding:10px 12px; font-weight:500; color:#f0f0ff;">{row['app_name'][:40]}</td>
218
+ <td style="padding:10px 12px;">
219
+ <span style="background:{color}22; color:{color}; border:1px solid {color}44;
220
+ border-radius:20px; padding:2px 8px; font-size:0.7rem; font-family:'DM Mono',monospace;">{cat}</span>
221
+ </td>
222
+ <td style="padding:10px 12px; font-family:'DM Mono',monospace; font-size:0.85rem;">{row['time']}</td>
223
+ <td style="padding:10px 24px 10px 12px; min-width:120px;">
224
+ <div style="background:#1e1e2e; border-radius:4px; height:6px; overflow:hidden;">
225
+ <div style="background:{color}; width:{bar_w}%; height:100%; border-radius:4px;"></div>
226
+ </div>
227
+ </td>
228
+ </tr>"""
229
+
230
+ st.markdown(f"""
231
+ <table style="width:100%; border-collapse:collapse; font-size:0.85rem; font-family:'Inter',sans-serif;">
232
+ <thead>
233
+ <tr style="color:#5a5a7a; font-size:0.72rem; text-transform:uppercase; letter-spacing:0.08em; border-bottom:1px solid #2a2a3a;">
234
+ <th style="text-align:left; padding:8px 12px; font-weight:500;">App</th>
235
+ <th style="text-align:left; padding:8px 12px; font-weight:500;">Category</th>
236
+ <th style="text-align:left; padding:8px 12px; font-weight:500;">Time</th>
237
+ <th style="text-align:left; padding:8px 24px 8px 12px; font-weight:500;">Share</th>
238
+ </tr>
239
+ </thead>
240
+ <tbody>{html_rows}</tbody>
241
+ </table>
242
+ """, unsafe_allow_html=True)
243
+ else:
244
+ st.markdown("<p style='color:#5a5a7a; font-size:0.85rem;'>No app data yet. Start tracking!</p>",
245
+ unsafe_allow_html=True)
246
+
247
+ # Auto-refresh every 10 seconds
248
+ if st.session_state.get("auto_refresh", True):
249
+ import time
250
+ st.markdown("""
251
+ <script>
252
+ setTimeout(() => window.location.reload(), 15000);
253
+ </script>""", unsafe_allow_html=True)
ui_pages/settings.py ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ FocusTrack - Page 4: Settings
3
+ Configure tracker behavior, categories, and data management.
4
+ """
5
+
6
+ import streamlit as st
7
+ import json
8
+ import shutil
9
+ from datetime import datetime
10
+ from pathlib import Path
11
+
12
+ from ui_utils import privacy_badge, page_header, CATEGORY_COLORS, get_db
13
+
14
+ DB_PATH = Path(__file__).parent.parent / "data" / "activity.db"
15
+
16
+
17
+ def render():
18
+ db = get_db()
19
+ privacy_badge()
20
+ page_header("Settings", "Configure FocusTrack to your workflow")
21
+
22
+ settings = db.get_all_settings()
23
+
24
+ tab1, tab2, tab3, tab4 = st.tabs(["⚙️ Tracker", "🏷️ Categories", "🗄️ Data & Backup", "🎨 Appearance"])
25
+
26
+ # ─── Tab 1: Tracker Settings ──────────────────────────────────────────────
27
+ with tab1:
28
+ st.markdown("#### Tracking Behavior")
29
+
30
+ col1, col2 = st.columns(2)
31
+ with col1:
32
+ idle_threshold = st.number_input(
33
+ "Idle threshold (seconds)",
34
+ min_value=30, max_value=3600,
35
+ value=int(settings.get("idle_threshold_seconds", 300)),
36
+ step=30,
37
+ help="User is considered idle after this many seconds without mouse/keyboard activity."
38
+ )
39
+
40
+ heartbeat = st.number_input(
41
+ "Heartbeat interval (seconds)",
42
+ min_value=1, max_value=60,
43
+ value=int(settings.get("heartbeat_interval", 5)),
44
+ step=1,
45
+ help="How often activity is logged. Lower = more granular, higher = less CPU."
46
+ )
47
+
48
+ with col2:
49
+ ignored_raw = settings.get("ignored_apps", '[]')
50
+ try:
51
+ ignored_list = json.loads(ignored_raw)
52
+ except Exception:
53
+ ignored_list = []
54
+
55
+ ignored_text = st.text_area(
56
+ "Ignored apps (one per line)",
57
+ value="\n".join(ignored_list),
58
+ height=120,
59
+ help="Apps listed here will not be tracked."
60
+ )
61
+
62
+ auto_start = st.toggle(
63
+ "Auto-start tracker on launch",
64
+ value=settings.get("auto_start", "false") == "true"
65
+ )
66
+
67
+ if st.button("💾 Save Tracker Settings", use_container_width=False):
68
+ db.set_setting("idle_threshold_seconds", str(idle_threshold))
69
+ db.set_setting("heartbeat_interval", str(heartbeat))
70
+ db.set_setting("auto_start", "true" if auto_start else "false")
71
+ new_ignored = [a.strip() for a in ignored_text.strip().split("\n") if a.strip()]
72
+ db.set_setting("ignored_apps", json.dumps(new_ignored))
73
+ st.toast("✅ Tracker settings saved!", icon="✅")
74
+ st.rerun()
75
+
76
+ st.markdown("---")
77
+ st.markdown("#### Tracker Status")
78
+
79
+ status = db.get_setting("tracker_running", "true")
80
+ status_map = {"true": ("🟢 Running", "#10b981"), "paused": ("🟡 Paused", "#f59e0b"), "false": ("🔴 Stopped", "#f43f5e")}
81
+ label, color = status_map.get(status, ("Unknown", "#6366f1"))
82
+ st.markdown(
83
+ f"<span style='color:{color}; font-size:1rem; font-weight:600;'>{label}</span>",
84
+ unsafe_allow_html=True
85
+ )
86
+
87
+ col_s1, col_s2, col_s3 = st.columns([1, 1, 1])
88
+ with col_s1:
89
+ if st.button("▶ Start", use_container_width=True):
90
+ db.set_setting("tracker_running", "true")
91
+ st.toast("Tracker started")
92
+ st.rerun()
93
+ with col_s2:
94
+ if st.button("⏸ Pause", use_container_width=True):
95
+ db.set_setting("tracker_running", "paused")
96
+ st.toast("Tracker paused")
97
+ st.rerun()
98
+ with col_s3:
99
+ if st.button("⏹ Stop", use_container_width=True):
100
+ db.set_setting("tracker_running", "false")
101
+ st.toast("Tracker stopped")
102
+ st.rerun()
103
+
104
+ # ─── Tab 2: Categories ────────────────────────────────────────────────────
105
+ with tab2:
106
+ st.markdown("#### Category Rules")
107
+ st.markdown("<p style='color:#9090b0; font-size:0.85rem;'>Define which apps and keywords map to which category. The tracker uses these rules to auto-categorize activity.</p>", unsafe_allow_html=True)
108
+
109
+ cats = db.get_categories()
110
+
111
+ for cat in cats:
112
+ with st.expander(f"{'●'} {cat['name'].title()}", expanded=False):
113
+ col_n, col_c = st.columns([3, 1])
114
+ with col_n:
115
+ cat_name = st.text_input("Name", value=cat["name"], key=f"cname_{cat['id']}")
116
+ with col_c:
117
+ cat_color = st.color_picker("Color", value=cat["color"], key=f"ccolor_{cat['id']}")
118
+
119
+ try:
120
+ kw_list = json.loads(cat["keywords"] or "[]")
121
+ app_list = json.loads(cat["apps"] or "[]")
122
+ except Exception:
123
+ kw_list, app_list = [], []
124
+
125
+ col_k, col_a = st.columns(2)
126
+ with col_k:
127
+ kw_text = st.text_area(
128
+ "Keywords (one per line)",
129
+ value="\n".join(kw_list),
130
+ height=100,
131
+ key=f"kw_{cat['id']}",
132
+ help="These words are matched against app name and window title."
133
+ )
134
+ with col_a:
135
+ app_text = st.text_area(
136
+ "App names (one per line)",
137
+ value="\n".join(app_list),
138
+ height=100,
139
+ key=f"apps_{cat['id']}",
140
+ help="Partial matches against the process/app name."
141
+ )
142
+
143
+ col_save, col_del = st.columns([1, 1])
144
+ with col_save:
145
+ if st.button("💾 Save", key=f"save_cat_{cat['id']}", use_container_width=True):
146
+ new_kw = [k.strip() for k in kw_text.strip().split("\n") if k.strip()]
147
+ new_app = [a.strip() for a in app_text.strip().split("\n") if a.strip()]
148
+ db.upsert_category(cat_name, cat_color, new_kw, new_app)
149
+ st.toast(f"✅ '{cat_name}' saved")
150
+ st.rerun()
151
+ with col_del:
152
+ if cat["name"] not in ("idle", "uncategorized"):
153
+ if st.button("🗑 Delete", key=f"del_cat_{cat['id']}", use_container_width=True):
154
+ db.delete_category(cat["name"])
155
+ st.toast(f"Deleted '{cat['name']}'")
156
+ st.rerun()
157
+
158
+ st.markdown("---")
159
+ st.markdown("#### Add New Category")
160
+ nc1, nc2, nc3 = st.columns([2, 1, 1])
161
+ with nc1:
162
+ new_cat_name = st.text_input("Category name", placeholder="e.g. learning")
163
+ with nc2:
164
+ new_cat_color = st.color_picker("Color", value="#6366f1")
165
+ with nc3:
166
+ st.markdown("<div style='margin-top:28px'></div>", unsafe_allow_html=True)
167
+ if st.button("➕ Add Category", use_container_width=True):
168
+ if new_cat_name.strip():
169
+ db.upsert_category(new_cat_name.strip(), new_cat_color, [], [])
170
+ st.toast(f"✅ Added '{new_cat_name}'")
171
+ st.rerun()
172
+
173
+ # ─── Tab 3: Data & Backup ─────────────────────────────────────────────────
174
+ with tab3:
175
+ st.markdown("#### Database Info")
176
+
177
+ db_size = db.get_db_size_mb()
178
+ from datetime import date
179
+ from datetime import datetime as dt2
180
+ from ui_utils import get_date_range
181
+ start, end = get_date_range("Last 30 days")
182
+ count = db.get_activity_count(start, end)
183
+
184
+ col_i1, col_i2, col_i3 = st.columns(3)
185
+ with col_i1:
186
+ st.metric("Database Size", f"{db_size:.2f} MB")
187
+ with col_i2:
188
+ st.metric("Records (30d)", f"{count:,}")
189
+ with col_i3:
190
+ st.metric("DB Location", "Local only ✅")
191
+
192
+ st.code(str(DB_PATH), language=None)
193
+
194
+ st.markdown("---")
195
+ st.markdown("#### Backup Database")
196
+ col_b1, col_b2 = st.columns([1, 2])
197
+ with col_b1:
198
+ if st.button("📦 Download Backup", use_container_width=True):
199
+ if DB_PATH.exists():
200
+ with open(DB_PATH, "rb") as f:
201
+ data = f.read()
202
+ st.download_button(
203
+ "💾 Save activity.db",
204
+ data,
205
+ file_name=f"focustrack_backup_{datetime.now().strftime('%Y%m%d_%H%M%S')}.db",
206
+ mime="application/octet-stream",
207
+ use_container_width=True,
208
+ )
209
+
210
+ st.markdown("---")
211
+ st.markdown("#### Restore Database")
212
+ uploaded = st.file_uploader("Upload a backup .db file", type=["db"])
213
+ if uploaded:
214
+ if st.button("⚠️ Restore from backup (overwrites current data)"):
215
+ DB_PATH.write_bytes(uploaded.read())
216
+ if "db" in st.session_state:
217
+ del st.session_state["db"]
218
+ st.toast("✅ Database restored! Please refresh the page.", icon="✅")
219
+
220
+ st.markdown("---")
221
+ st.markdown("#### Danger Zone")
222
+ st.markdown(
223
+ "<div style='background:#1a0a0f; border:1px solid #4a1a2a; border-radius:12px; padding:1.25rem; margin-bottom:1rem;'>"
224
+ "<p style='color:#f43f5e; font-weight:600; margin:0 0 8px;'>⚠️ Clear All Data</p>"
225
+ "<p style='color:#9090b0; font-size:0.85rem; margin:0;'>This permanently deletes all tracked activity. This action cannot be undone.</p>"
226
+ "</div>",
227
+ unsafe_allow_html=True,
228
+ )
229
+ confirm = st.text_input("Type DELETE to confirm")
230
+ if st.button("🗑 Clear All Activity Data", type="secondary"):
231
+ if confirm == "DELETE":
232
+ db.clear_all_data()
233
+ st.toast("All data cleared.")
234
+ st.rerun()
235
+ else:
236
+ st.error("Please type DELETE to confirm.")
237
+
238
+ # ─── Tab 4: Appearance ────────────────────────────────────────────────────
239
+ with tab4:
240
+ st.markdown("#### Theme")
241
+ current_theme = db.get_setting("theme", "dark")
242
+ theme = st.radio(
243
+ "Color mode",
244
+ ["dark", "light"],
245
+ index=0 if current_theme == "dark" else 1,
246
+ horizontal=True,
247
+ )
248
+ if theme != current_theme:
249
+ db.set_setting("theme", theme)
250
+ st.toast("Theme updated — refresh to apply.")
251
+ st.rerun()
252
+
253
+ st.markdown("---")
254
+ st.markdown("#### About FocusTrack")
255
+ st.markdown("""
256
+ <div style="background:#16161f; border:1px solid #2a2a3a; border-radius:12px; padding:1.5rem;">
257
+ <h3 style="font-family:'Syne',sans-serif; margin:0 0 8px; color:#f0f0ff;">FocusTrack v1.0</h3>
258
+ <p style="color:#9090b0; font-size:0.85rem; margin:0 0 4px;">100% local, privacy-first productivity tracker.</p>
259
+ <p style="color:#9090b0; font-size:0.85rem; margin:0 0 4px;">Built with Python 3.11+ · Streamlit · SQLite · Plotly</p>
260
+ <p style="color:#5a5a7a; font-size:0.8rem; margin:0;">No internet • No accounts • No cloud • Your data never leaves your device.</p>
261
+ </div>
262
+ """, unsafe_allow_html=True)