Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: redesign MeatSpace overview as compact grid dashboard and remove nutrition tracking

Adam Eivyc56c579c4f62
diff --git a/.changelog/v1.13.x.md b/.changelog/v1.13.x.md
new file mode 100644
index 0000000000..187f3bb668
--- /dev/null
+++ b/.changelog/v1.13.x.md
@@ -0,0 +1,16 @@
+# Release v1.13.x - Changelog
+
+Released: YYYY-MM-DD
+
+## Overview
+
+Redesigned MeatSpace overview as a compact grid dashboard surfacing all health data above the fold. Removed unused nutrition tracking.
+
+## Features
+
+- **MeatSpace overview dashboard redesign** — compact 3-row grid layout replacing the tall single-column stack: hero row with inline death clock countdown + LEV tracker, vitals row with age/remaining/healthy years, and 7 clickable health tiles (Alcohol, Body, Blood, Epigenetic, Eyes, Lifestyle, Data) that navigate to their respective tabs
+- **Expanded data fetching** — overview now calls 6 endpoints in parallel (overview, alcohol, body, blood, epigenetic, eyes) to populate health tiles with live metrics
+
+## Removed
+
+- **Nutrition tracking** — removed NutritionTab component, sidebar nav item, page tab, API endpoints (`/meatspace/nutrition`, `/meatspace/nutrition/daily`), server service functions, and associated tests; sparse historical data was not being actively tracked
diff --git a/PLAN.md b/PLAN.md
index fb2f253f1f..eda6c0ebbb 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -77,7 +77,7 @@ pm2 logs
- [ ] **M34 P5-P7**: Digital Twin - Multi-modal capture, advanced testing, personas
- [x] **M42 P4**: Unified Digital Twin Identity System - Identity Tab UI dashboard with completeness header, 5 summary cards, derive actions
- [ ] **M42 P5**: Unified Digital Twin Identity System - Cross-Insights Engine. See [Identity System](./docs/features/identity-system.md)
-- [x] **M44 P1-P5**: MeatSpace - Health tracker with death clock, LEV 2045 tracker, alcohol logging, blood/body/epigenetic tracking, nutrition, lifestyle questionnaire, TSV import, dashboard widget
+- [x] **M44 P1-P5**: MeatSpace - Health tracker with death clock, LEV 2045 tracker, alcohol logging, blood/body/epigenetic tracking, lifestyle questionnaire, TSV import, dashboard widget, compact grid overview
- [ ] **M44 P6**: MeatSpace - Genome/Epigenetic Migration from Digital Twin to MeatSpace
---
diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx
index edcc90063f..dd49de915e 100644
--- a/client/src/components/Layout.jsx
+++ b/client/src/components/Layout.jsx
@@ -133,7 +133,6 @@ const navItems = [
{ to: '/meatspace/alcohol', label: 'Alcohol', icon: Activity },
{ to: '/meatspace/blood', label: 'Blood & Body', icon: HeartPulse },
{ to: '/meatspace/lifestyle', label: 'Lifestyle', icon: ClipboardList },
- { to: '/meatspace/nutrition', label: 'Nutrition', icon: Flame },
{ to: '/meatspace/overview', label: 'Overview', icon: Activity }
]
},
diff --git a/client/src/components/meatspace/DeathClockCountdown.jsx b/client/src/components/meatspace/DeathClockCountdown.jsx
index 8c2c853533..b36de0019a 100644
--- a/client/src/components/meatspace/DeathClockCountdown.jsx
+++ b/client/src/components/meatspace/DeathClockCountdown.jsx
@@ -1,8 +1,8 @@
import { useDeathClock } from '../../hooks/useDeathClock';
-const TimeUnit = ({ value, label }) => (
+const TimeUnit = ({ value, label, color }) => (
<div className="flex flex-col items-center">
- <span className="text-3xl md:text-5xl font-mono font-bold text-port-error tabular-nums">
+ <span className={`text-3xl md:text-5xl font-mono font-bold tabular-nums ${color}`}>
{String(value).padStart(2, '0')}
</span>
<span className="text-xs text-gray-500 uppercase mt-1">{label}</span>
@@ -38,19 +38,19 @@ export default function DeathClockCountdown({ deathDate, lifeExpectancy, percent
{/* Countdown timer */}
<div className="flex items-start gap-2 md:gap-3 justify-center flex-wrap">
- <TimeUnit value={countdown.years} label="years" />
+ <TimeUnit value={countdown.years} label="years" color="text-port-accent" />
<Separator />
- <TimeUnit value={countdown.months} label="months" />
+ <TimeUnit value={countdown.months} label="months" color="text-purple-400" />
<Separator />
- <TimeUnit value={countdown.weeks} label="weeks" />
+ <TimeUnit value={countdown.weeks} label="weeks" color="text-teal-400" />
<Separator />
- <TimeUnit value={countdown.days} label="days" />
+ <TimeUnit value={countdown.days} label="days" color="text-port-success" />
<Separator />
- <TimeUnit value={countdown.hours} label="hours" />
+ <TimeUnit value={countdown.hours} label="hours" color="text-port-warning" />
<Separator />
- <TimeUnit value={countdown.minutes} label="min" />
+ <TimeUnit value={countdown.minutes} label="min" color="text-orange-400" />
<Separator />
- <TimeUnit value={countdown.seconds} label="sec" />
+ <TimeUnit value={countdown.seconds} label="sec" color="text-port-error" />
</div>
{/* Life expectancy details */}
diff --git a/client/src/components/meatspace/constants.js b/client/src/components/meatspace/constants.js
index a74dd47b6a..7f6f382b44 100644
--- a/client/src/components/meatspace/constants.js
+++ b/client/src/components/meatspace/constants.js
@@ -3,7 +3,6 @@ import {
Beer,
HeartPulse,
ClipboardList,
- Apple,
Activity
} from 'lucide-react';
@@ -11,8 +10,7 @@ export const TABS = [
{ id: 'overview', label: 'Overview', icon: Activity },
{ id: 'alcohol', label: 'Alcohol', icon: Beer },
{ id: 'blood', label: 'Blood & Body', icon: HeartPulse },
- { id: 'lifestyle', label: 'Lifestyle', icon: ClipboardList },
- { id: 'nutrition', label: 'Nutrition', icon: Apple }
+ { id: 'lifestyle', label: 'Lifestyle', icon: ClipboardList }
];
// Lifestyle adjustment table for death clock
diff --git a/client/src/components/meatspace/tabs/ImportTab.jsx b/client/src/components/meatspace/tabs/ImportTab.jsx
index 1f84532c14..1dbdfe72a0 100644
--- a/client/src/components/meatspace/tabs/ImportTab.jsx
+++ b/client/src/components/meatspace/tabs/ImportTab.jsx
@@ -53,7 +53,7 @@ export default function ImportTab({ onRefresh }) {
<p className="text-sm text-gray-400 mb-4">
Import your health tracking spreadsheet. Expects a TSV file with 3 header rows,
- 2 summary rows, then daily data. Covers nutrition, alcohol, body composition,
+ 2 summary rows, then daily data. Covers alcohol, body composition,
blood tests, epigenetic results, and eye prescriptions.
</p>
<p className="text-xs text-gray-500 mb-4">
diff --git a/client/src/components/meatspace/tabs/NutritionTab.jsx b/client/src/components/meatspace/tabs/NutritionTab.jsx
deleted file mode 100644
index d74d5328f2..0000000000
--- a/client/src/components/meatspace/tabs/NutritionTab.jsx
+++ /dev/null
@@ -1,130 +0,0 @@
-import { useState, useEffect, useCallback } from 'react';
-import { Apple } from 'lucide-react';
-import * as api from '../../../services/api';
-import BrailleSpinner from '../../BrailleSpinner';
-
-const MACRO_LABELS = {
- calories: { label: 'Calories', unit: 'kcal', color: 'text-port-accent' },
- fatG: { label: 'Fat', unit: 'g', color: 'text-yellow-400' },
- satFatG: { label: 'Sat Fat', unit: 'g', color: 'text-yellow-500' },
- transFatG: { label: 'Trans Fat', unit: 'g', color: 'text-red-400' },
- polyFatG: { label: 'Poly Fat', unit: 'g', color: 'text-yellow-300' },
- monoFatG: { label: 'Mono Fat', unit: 'g', color: 'text-yellow-300' },
- carbG: { label: 'Carbs', unit: 'g', color: 'text-blue-400' },
- fiberG: { label: 'Fiber', unit: 'g', color: 'text-green-400' },
- sugarG: { label: 'Sugar', unit: 'g', color: 'text-pink-400' }
-};
-
-export default function NutritionTab() {
- const [summary, setSummary] = useState(null);
- const [loading, setLoading] = useState(true);
-
- const fetchData = useCallback(async () => {
- const data = await api.getNutritionSummary().catch(() => ({
- totalEntries: 0, averages: null, recentEntries: []
- }));
- setSummary(data);
- setLoading(false);
- }, []);
-
- useEffect(() => {
- fetchData();
- }, [fetchData]);
-
- if (loading) {
- return (
- <div className="flex justify-center py-12">
- <BrailleSpinner text="Loading nutrition data" />
- </div>
- );
- }
-
- if (!summary || summary.totalEntries === 0) {
- return (
- <div className="bg-port-card border border-port-border rounded-xl p-6">
- <div className="flex items-center gap-2 mb-4">
- <Apple size={18} className="text-port-accent" />
- <h3 className="text-sm font-medium text-gray-400 uppercase tracking-wider">Nutrition</h3>
- </div>
- <p className="text-gray-500 text-sm">No nutrition data. Import your health spreadsheet to see macro trends.</p>
- </div>
- );
- }
-
- const { averages, recentEntries, totalEntries } = summary;
-
- return (
- <div className="space-y-6">
- {/* Averages Summary */}
- {averages && (
- <div className="bg-port-card border border-port-border rounded-xl p-6">
- <div className="flex items-center justify-between mb-4">
- <div className="flex items-center gap-2">
- <Apple size={18} className="text-port-accent" />
- <h3 className="text-sm font-medium text-gray-400 uppercase tracking-wider">Daily Averages</h3>
- </div>
- <span className="text-xs text-gray-600">{totalEntries} days tracked</span>
- </div>
- <div className="grid grid-cols-3 md:grid-cols-5 gap-3">
- {Object.entries(MACRO_LABELS).map(([key, meta]) => {
- const val = averages[key];
- if (val == null) return null;
- return (
- <div key={key} className="bg-port-bg/50 rounded-lg px-3 py-2">
- <p className="text-xs text-gray-500">{meta.label}</p>
- <p className={`text-lg font-mono font-bold ${meta.color}`}>
- {Math.round(val)}
- <span className="text-xs text-gray-600 ml-1">{meta.unit}</span>
- </p>
- </div>
- );
- })}
- </div>
- </div>
- )}
-
- {/* Recent Entries */}
- {recentEntries?.length > 0 && (
- <div className="bg-port-card border border-port-border rounded-xl p-6">
- <h3 className="text-sm font-medium text-gray-400 uppercase tracking-wider mb-4">Recent Days</h3>
- <div className="overflow-x-auto">
- <table className="w-full text-sm">
- <thead>
- <tr className="text-xs text-gray-500 uppercase border-b border-port-border">
- <th className="text-left py-2 pr-3">Date</th>
- <th className="text-right py-2 px-2">Cal</th>
- <th className="text-right py-2 px-2">Fat</th>
- <th className="text-right py-2 px-2">Carbs</th>
- <th className="text-right py-2 px-2">Fiber</th>
- <th className="text-right py-2 px-2">Sugar</th>
- </tr>
- </thead>
- <tbody>
- {recentEntries.map(entry => (
- <tr key={entry.date} className="border-b border-port-border/50">
- <td className="py-1.5 pr-3 font-mono text-gray-400">{entry.date}</td>
- <td className="py-1.5 px-2 text-right font-mono text-gray-300">
- {entry.nutrition?.calories ?? '—'}
- </td>
- <td className="py-1.5 px-2 text-right font-mono text-gray-300">
- {entry.nutrition?.fatG ?? '—'}
- </td>
- <td className="py-1.5 px-2 text-right font-mono text-gray-300">
- {entry.nutrition?.carbG ?? '—'}
- </td>
- <td className="py-1.5 px-2 text-right font-mono text-gray-300">
- {entry.nutrition?.fiberG ?? '—'}
- </td>
- <td className="py-1.5 px-2 text-right font-mono text-gray-300">
- {entry.nutrition?.sugarG ?? '—'}
- </td>
- </tr>
- ))}
- </tbody>
- </table>
- </div>
- </div>
- )}
- </div>
- );
-}
diff --git a/client/src/components/meatspace/tabs/OverviewTab.jsx b/client/src/components/meatspace/tabs/OverviewTab.jsx
index 729eb8953b..a9ddd110fc 100644
--- a/client/src/components/meatspace/tabs/OverviewTab.jsx
+++ b/client/src/components/meatspace/tabs/OverviewTab.jsx
@@ -1,16 +1,178 @@
import { useState, useEffect, useCallback } from 'react';
+import { useNavigate } from 'react-router-dom';
+import { Beer, Scale, HeartPulse, Dna, Eye, Dumbbell, Database, Rocket } from 'lucide-react';
import * as api from '../../../services/api';
-import DeathClockCountdown from '../DeathClockCountdown';
-import LEVTracker from '../LEVTracker';
+import { useDeathClock } from '../../../hooks/useDeathClock';
import BrailleSpinner from '../../BrailleSpinner';
+function HealthTile({ icon: Icon, iconColor, label, metrics, onClick }) {
+ return (
+ <div
+ onClick={onClick}
+ className={`bg-port-card border border-port-border rounded-lg p-3 ${
+ onClick ? 'cursor-pointer hover:border-port-accent/50 transition-colors' : ''
+ }`}
+ >
+ <div className="flex items-center gap-2 mb-2">
+ <Icon size={14} className={iconColor} />
+ <span className="text-xs font-medium text-gray-400 uppercase tracking-wider">{label}</span>
+ </div>
+ <div className="space-y-1">
+ {metrics.map((m, i) => (
+ <div key={i} className="flex justify-between items-center">
+ <span className="text-xs text-gray-500">{m.label}</span>
+ <span className={`text-xs font-medium ${m.color || 'text-gray-300'}`}>{m.value}</span>
+ </div>
+ ))}
+ </div>
+ </div>
+ );
+}
+
+function CompactCountdown({ deathDate, lifeExpectancy, percentComplete }) {
+ const countdown = useDeathClock(deathDate);
+
+ if (!countdown) {
+ return <p className="text-gray-500 text-sm">Death clock unavailable. Set birth date in Digital Twin &gt; Goals.</p>;
+ }
+
+ if (countdown.expired) {
+ return <p className="text-port-error font-bold">Time expired. You&apos;re on borrowed time.</p>;
+ }
+
+ const units = [
+ { value: countdown.years, label: 'y', color: 'text-port-accent' },
+ { value: countdown.months, label: 'mo', color: 'text-purple-400' },
+ { value: countdown.weeks, label: 'w', color: 'text-teal-400' },
+ { value: countdown.days, label: 'd', color: 'text-port-success' },
+ { value: countdown.hours, label: 'h', color: 'text-port-warning' },
+ { value: countdown.minutes, label: 'm', color: 'text-orange-400' },
+ { value: countdown.seconds, label: 's', color: 'text-port-error' },
+ ];
+
+ return (
+ <div>
+ <h3 className="text-xs font-medium text-gray-400 uppercase tracking-wider mb-2">Time Remaining</h3>
+ <div className="flex items-baseline gap-1 flex-wrap mb-3">
+ {units.map((u, i) => (
+ <span key={i} className="whitespace-nowrap">
+ <span className={`text-2xl font-mono font-bold tabular-nums ${u.color}`}>
+ {String(u.value).padStart(2, '0')}
+ </span>
+ <span className="text-xs text-gray-500">{u.label}</span>
+ {i < units.length - 1 && <span className="text-gray-600 mx-0.5">:</span>}
+ </span>
+ ))}
+ </div>
+
+ {lifeExpectancy && (
+ <p className="text-xs text-gray-400 mb-3">
+ SSA: <span className="text-gray-300">{lifeExpectancy.baseline}y</span>
+ {' · '}Genome: <span className="text-gray-300">{lifeExpectancy.genomeAdjusted}y</span>
+ {' · '}Lifestyle: <span className={lifeExpectancy.lifestyleAdjustment >= 0 ? 'text-port-success' : 'text-port-error'}>
+ {lifeExpectancy.lifestyleAdjustment >= 0 ? '+' : ''}{lifeExpectancy.lifestyleAdjustment}y
+ </span>
+ {' · '}Total: <span className="text-white font-medium">{lifeExpectancy.total}y</span>
+ </p>
+ )}
+
+ {percentComplete != null && (
+ <div>
+ <div className="flex justify-between text-xs text-gray-500 mb-1">
+ <span>Life progress</span>
+ <span>{percentComplete}%</span>
+ </div>
+ <div className="h-1.5 bg-port-border rounded-full overflow-hidden">
+ <div
+ className="h-full rounded-full transition-all duration-1000"
+ style={{
+ width: `${Math.min(100, percentComplete)}%`,
+ background: percentComplete > 80 ? '#ef4444' : percentComplete > 60 ? '#f59e0b' : '#3b82f6'
+ }}
+ />
+ </div>
+ </div>
+ )}
+ </div>
+ );
+}
+
+function CompactLEV({ lev }) {
+ if (!lev) return null;
+ const { ageAtLEV, yearsToLEV, onTrack, adjustedLifeExpectancy } = lev;
+ const margin = Math.round((adjustedLifeExpectancy - ageAtLEV) * 10) / 10;
+
+ return (
+ <div>
+ <div className="flex items-center gap-2 mb-3">
+ <Rocket size={14} className="text-port-accent" />
+ <h3 className="text-xs font-medium text-gray-400 uppercase tracking-wider">LEV Tracker</h3>
+ </div>
+
+ <div className="mb-3">
+ <span className={`inline-flex items-center gap-1.5 px-2.5 py-0.5 rounded-full text-xs font-medium ${
+ onTrack ? 'bg-port-success/10 text-port-success' : 'bg-port-error/10 text-port-error'
+ }`}>
+ <span className={`w-1.5 h-1.5 rounded-full ${onTrack ? 'bg-port-success' : 'bg-port-error'}`} />
+ {onTrack ? 'On Track' : 'At Risk'}
+ </span>
+ </div>
+
+ <div className="space-y-1.5">
+ <div className="flex justify-between">
+ <span className="text-xs text-gray-500">Years to LEV</span>
+ <span className="text-sm font-bold text-white">{yearsToLEV}</span>
+ </div>
+ <div className="flex justify-between">
+ <span className="text-xs text-gray-500">Age at LEV</span>
+ <span className="text-sm font-bold text-white">{ageAtLEV}</span>
+ </div>
+ <div className="flex justify-between">
+ <span className="text-xs text-gray-500">Margin</span>
+ <span className={`text-sm font-bold ${onTrack ? 'text-port-success' : 'text-port-error'}`}>
+ {onTrack ? '+' : ''}{margin}y
+ </span>
+ </div>
+ <div className="flex justify-between">
+ <span className="text-xs text-gray-500">Adjusted LE</span>
+ <span className="text-sm font-bold text-white">{adjustedLifeExpectancy}y</span>
+ </div>
+ </div>
+ </div>
+ );
+}
+
+function riskColor(level) {
+ if (level === 'low') return 'text-port-success';
+ if (level === 'moderate') return 'text-port-warning';
+ return 'text-port-error';
+}
+
export default function OverviewTab() {
const [data, setData] = useState(null);
+ const [alcohol, setAlcohol] = useState(null);
+ const [body, setBody] = useState(null);
+ const [blood, setBlood] = useState(null);
+ const [epigenetic, setEpigenetic] = useState(null);
+ const [eyes, setEyes] = useState(null);
const [loading, setLoading] = useState(true);
+ const navigate = useNavigate();
const fetchData = useCallback(async () => {
- const result = await api.getMeatspaceOverview().catch(() => null);
- setData(result);
+ const [overview, alc, bod, bld, epi, eye] = await Promise.all([
+ api.getMeatspaceOverview().catch(() => null),
+ api.getAlcoholSummary().catch(() => null),
+ api.getBodyHistory().catch(() => null),
+ api.getBloodTests().catch(() => null),
+ api.getEpigeneticTests().catch(() => null),
+ api.getEyeExams().catch(() => null),
+ ]);
+ setData(overview);
+ setAlcohol(alc);
+ setBody(bod);
+ setBlood(bld);
+ setEpigenetic(epi);
+ setEyes(eye);
setLoading(false);
}, []);
@@ -33,72 +195,132 @@ export default function OverviewTab() {
}
const { deathClock, lev, summary } = data;
+ const latestBody = Array.isArray(body) ? body[body.length - 1] : null;
+ const latestBlood = blood?.tests?.[blood.tests.length - 1] ?? null;
+ const latestEpigenetic = epigenetic?.tests?.[epigenetic.tests.length - 1] ?? null;
+ const latestEye = eyes?.exams?.[eyes.exams.length - 1] ?? null;
return (
- <div className="space-y-6">
- {/* Death Clock */}
- {deathClock?.error ? (
- <div className="bg-port-card border border-port-border rounded-xl p-6">
- <p className="text-port-warning">{deathClock.error}</p>
+ <div className="space-y-4">
+ {/* Row 1 — Hero: Death Clock + LEV */}
+ <div className="grid grid-cols-1 lg:grid-cols-3 gap-4">
+ <div className="lg:col-span-2 bg-port-card border border-port-border rounded-xl p-4">
+ {deathClock?.error ? (
+ <p className="text-port-warning">{deathClock.error}</p>
+ ) : (
+ <CompactCountdown
+ deathDate={deathClock?.deathDate}
+ lifeExpectancy={deathClock?.lifeExpectancy}
+ percentComplete={deathClock?.percentComplete}
+ />
+ )}
</div>
- ) : (
- <DeathClockCountdown
- deathDate={deathClock?.deathDate}
- lifeExpectancy={deathClock?.lifeExpectancy}
- percentComplete={deathClock?.percentComplete}
- />
- )}
-
- {/* LEV Tracker */}
- <LEVTracker lev={lev} />
-
- {/* Health Summary */}
- <div className="bg-port-card border border-port-border rounded-xl p-6">
- <h3 className="text-sm font-medium text-gray-400 uppercase tracking-wider mb-4">Data Summary</h3>
- <div className="grid grid-cols-2 md:grid-cols-4 gap-4">
- <div>
- <span className="text-xs text-gray-500">Daily Entries</span>
- <p className="text-2xl font-bold text-white">{summary?.totalEntries || 0}</p>
- </div>
- <div>
- <span className="text-xs text-gray-500">Last Entry</span>
- <p className="text-lg font-semibold text-gray-300">{summary?.lastEntryDate || 'None'}</p>
- </div>
- <div>
- <span className="text-xs text-gray-500">Genome Data</span>
- <p className={`text-lg font-semibold ${summary?.hasGenomeData ? 'text-port-success' : 'text-gray-500'}`}>
- {summary?.hasGenomeData ? 'Active' : 'Missing'}
- </p>
- </div>
- <div>
- <span className="text-xs text-gray-500">Lifestyle Profile</span>
- <p className={`text-lg font-semibold ${summary?.hasLifestyleData ? 'text-port-success' : 'text-gray-500'}`}>
- {summary?.hasLifestyleData ? 'Active' : 'Not Set'}
- </p>
- </div>
+ <div className="bg-port-card border border-port-border rounded-xl p-4">
+ <CompactLEV lev={lev} />
</div>
</div>
- {/* Quick Info */}
+ {/* Row 2 — Vitals */}
{deathClock && !deathClock.error && (
- <div className="bg-port-card border border-port-border rounded-xl p-6">
- <h3 className="text-sm font-medium text-gray-400 uppercase tracking-wider mb-4">Vitals</h3>
- <div className="grid grid-cols-2 md:grid-cols-3 gap-4">
- <div>
- <span className="text-xs text-gray-500">Current Age</span>
- <p className="text-xl font-bold text-white">{deathClock.ageYears}y</p>
- </div>
- <div>
- <span className="text-xs text-gray-500">Years Remaining</span>
- <p className="text-xl font-bold text-port-warning">{deathClock.yearsRemaining}y</p>
- </div>
- <div>
- <span className="text-xs text-gray-500">Healthy Years</span>
- <p className="text-xl font-bold text-port-success">{deathClock.healthyYearsRemaining}y</p>
- </div>
+ <div className="grid grid-cols-1 sm:grid-cols-3 gap-3">
+ <div className="bg-port-card border border-port-border rounded-lg p-3">
+ <span className="text-xs text-gray-500">Current Age</span>
+ <p className="text-xl font-bold text-white">{deathClock.ageYears}y</p>
+ </div>
+ <div className="bg-port-card border border-port-border rounded-lg p-3">
+ <span className="text-xs text-gray-500">Years Remaining</span>
+ <p className="text-xl font-bold text-port-warning">{deathClock.yearsRemaining}y</p>
+ </div>
+ <div className="bg-port-card border border-port-border rounded-lg p-3">
+ <span className="text-xs text-gray-500">Healthy Years</span>
+ <p className="text-xl font-bold text-port-success">{deathClock.healthyYearsRemaining}y</p>
</div>
</div>
)}
+
+ {/* Row 3 — Health Tiles */}
+ <div className="grid grid-cols-2 md:grid-cols-4 gap-3">
+ <HealthTile
+ icon={Beer}
+ iconColor="text-amber-400"
+ label="Alcohol"
+ onClick={() => navigate('/meatspace/alcohol')}
+ metrics={[
+ { label: 'Today', value: alcohol ? `${alcohol.grams?.today?.toFixed(1) ?? '0'}g` : '—' },
+ { label: '7d avg', value: alcohol ? `${alcohol.grams?.avg7day?.toFixed(1) ?? '0'}g` : '—' },
+ { label: 'Risk', value: alcohol?.riskLevel ?? '—', color: alcohol ? riskColor(alcohol.riskLevel) : 'text-gray-500' },
+ ]}
+ />
+ <HealthTile
+ icon={Scale}
+ iconColor="text-blue-400"
+ label="Body"
+ onClick={() => navigate('/meatspace/blood')}
+ metrics={[
+ { label: 'Weight', value: latestBody?.weightLbs ? `${latestBody.weightLbs} lbs` : '—' },
+ { label: 'Body fat', value: latestBody?.fatPct != null ? `${latestBody.fatPct}%` : '—' },
+ { label: 'Muscle', value: latestBody?.musclePct != null ? `${latestBody.musclePct}%` : '—' },
+ ]}
+ />
+ <HealthTile
+ icon={HeartPulse}
+ iconColor="text-red-400"
+ label="Blood"
+ onClick={() => navigate('/meatspace/blood')}
+ metrics={[
+ { label: 'Tests', value: blood?.tests?.length ?? '—' },
+ { label: 'Latest', value: latestBlood?.date ?? '—' },
+ ]}
+ />
+ <HealthTile
+ icon={Dna}
+ iconColor="text-violet-400"
+ label="Epigenetic"
+ onClick={() => navigate('/meatspace/blood')}
+ metrics={[
+ { label: 'Bio age', value: latestEpigenetic?.biologicalAge != null ? `${latestEpigenetic.biologicalAge}y` : '—',
+ color: latestEpigenetic?.biologicalAge != null && latestEpigenetic?.chronologicalAge != null
+ ? (latestEpigenetic.biologicalAge < latestEpigenetic.chronologicalAge ? 'text-port-success' : 'text-port-error')
+ : 'text-gray-300' },
+ { label: 'Pace', value: latestEpigenetic?.paceOfAging != null ? latestEpigenetic.paceOfAging.toFixed(2) : '—' },
+ { label: 'Chrono', value: latestEpigenetic?.chronologicalAge != null ? `${latestEpigenetic.chronologicalAge}y` : '—' },
+ ]}
+ />
+ <HealthTile
+ icon={Eye}
+ iconColor="text-cyan-400"
+ label="Eyes"
+ onClick={() => navigate('/meatspace/blood')}
+ metrics={[
+ { label: 'Exams', value: eyes?.exams?.length ?? '—' },
+ { label: 'Latest', value: latestEye?.date ?? '—' },
+ { label: 'L SPH', value: latestEye?.leftSphere != null ? latestEye.leftSphere.toFixed(2) : '—' },
+ ]}
+ />
+ <HealthTile
+ icon={Dumbbell}
+ iconColor="text-orange-400"
+ label="Lifestyle"
+ onClick={() => navigate('/meatspace/lifestyle')}
+ metrics={[
+ { label: 'Status', value: summary?.hasLifestyleData ? 'Active' : 'Not Set',
+ color: summary?.hasLifestyleData ? 'text-port-success' : 'text-gray-500' },
+ { label: 'Diet', value: summary?.hasLifestyleData ? 'Set' : '—' },
+ { label: 'Exercise', value: summary?.hasLifestyleData ? 'Set' : '—' },
+ ]}
+ />
+ <HealthTile
+ icon={Database}
+ iconColor="text-gray-400"
+ label="Data"
+ metrics={[
+ { label: 'Entries', value: summary?.totalEntries ?? '—' },
+ { label: 'Last date', value: summary?.lastEntryDate ?? '—' },
+ { label: 'Genome', value: summary?.hasGenomeData ? 'Active' : 'Missing',
+ color: summary?.hasGenomeData ? 'text-port-success' : 'text-gray-500' },
+ ]}
+ />
+ </div>
</div>
);
}
diff --git a/client/src/pages/MeatSpace.jsx b/client/src/pages/MeatSpace.jsx
index c877732ec6..7d13b71a74 100644
--- a/client/src/pages/MeatSpace.jsx
+++ b/client/src/pages/MeatSpace.jsx
@@ -7,7 +7,6 @@ import OverviewTab from '../components/meatspace/tabs/OverviewTab';
import AlcoholTab from '../components/meatspace/tabs/AlcoholTab';
import BloodTab from '../components/meatspace/tabs/BloodTab';
import LifestyleTab from '../components/meatspace/tabs/LifestyleTab';
-import NutritionTab from '../components/meatspace/tabs/NutritionTab';
export default function MeatSpace() {
const { tab } = useParams();
@@ -28,8 +27,6 @@ export default function MeatSpace() {
return <BloodTab />;
case 'lifestyle':
return <LifestyleTab />;
- case 'nutrition':
- return <NutritionTab />;
default:
return <OverviewTab />;
}
diff --git a/client/src/services/api.js b/client/src/services/api.js
index 3da1c8f899..fbf7fa5d2f 100644
--- a/client/src/services/api.js
+++ b/client/src/services/api.js
@@ -1321,14 +1321,6 @@ export const updateEyeExam = (index, data) => request(`/meatspace/eyes/${index}`
export const removeEyeExam = (index) => request(`/meatspace/eyes/${index}`, {
method: 'DELETE'
});
-export const getNutritionSummary = () => request('/meatspace/nutrition');
-export const getDailyNutrition = (from, to) => {
- const params = new URLSearchParams();
- if (from) params.set('from', from);
- if (to) params.set('to', to);
- return request(`/meatspace/nutrition/daily?${params}`);
-};
-
// JIRA
export const getJiraInstances = () => request('/jira/instances');
export const getJiraProjects = (instanceId) => request(`/jira/instances/${instanceId}/projects`);
diff --git a/package-lock.json b/package-lock.json
index 93a5d62c3a..9260a87fa6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "portos",
- "version": "1.12.3",
+ "version": "1.13.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "portos",
- "version": "1.12.3",
+ "version": "1.13.0",
"license": "MIT",
"dependencies": {
"express": "^4.21.2",
diff --git a/package.json b/package.json
index fefb6d2db3..e00f657cfb 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "portos",
- "version": "1.12.3",
+ "version": "1.13.0",
"private": true,
"description": "Local dev machine App OS portal",
"author": "Adam Eivy (@antic|@atomantic)",
diff --git a/server/routes/meatspace.js b/server/routes/meatspace.js
index ac19766184..5916be0be0 100644
--- a/server/routes/meatspace.js
+++ b/server/routes/meatspace.js
@@ -254,28 +254,6 @@ router.delete('/eyes/:index', asyncHandler(async (req, res) => {
res.json(removed);
}));
-// =============================================================================
-// NUTRITION
-// =============================================================================
-
-/**
- * GET /api/meatspace/nutrition
- * Nutrition summary + averages
- */
-router.get('/nutrition', asyncHandler(async (req, res) => {
- const summary = await healthService.getNutritionSummary();
- res.json(summary);
-}));
-
-/**
- * GET /api/meatspace/nutrition/daily
- * Daily nutrition entries
- */
-router.get('/nutrition/daily', asyncHandler(async (req, res) => {
- const entries = await healthService.getDailyNutrition(req.query.from, req.query.to);
- res.json(entries);
-}));
-
// =============================================================================
// IMPORT
// =============================================================================
diff --git a/server/services/meatspaceHealth.js b/server/services/meatspaceHealth.js
index a40f93e23a..86f749e2b0 100644
--- a/server/services/meatspaceHealth.js
+++ b/server/services/meatspaceHealth.js
@@ -125,57 +125,3 @@ export async function removeEyeExam(index) {
return removed;
}
-// === Nutrition ===
-
-export async function getNutritionSummary() {
- const log = await readJSONFile(DAILY_LOG_FILE, { entries: [] });
- const entries = (log.entries || []).filter(e => e.nutrition && Object.keys(e.nutrition).length > 0);
-
- if (entries.length === 0) {
- return { entries: [], averages: null, totalEntries: 0 };
- }
-
- // Compute averages
- const sums = {};
- const counts = {};
- for (const entry of entries) {
- for (const [key, val] of Object.entries(entry.nutrition)) {
- if (val != null) {
- sums[key] = (sums[key] || 0) + val;
- counts[key] = (counts[key] || 0) + 1;
- }
- }
- }
-
- const averages = {};
- for (const key of Object.keys(sums)) {
- averages[key] = Math.round((sums[key] / counts[key]) * 10) / 10;
- }
-
- // Last 7 days of nutrition
- const today = new Date().toISOString().split('T')[0];
- const weekAgo = new Date();
- weekAgo.setDate(weekAgo.getDate() - 7);
- const weekAgoStr = weekAgo.toISOString().split('T')[0];
-
- const recentEntries = entries
- .filter(e => e.date >= weekAgoStr && e.date <= today)
- .sort((a, b) => b.date.localeCompare(a.date));
-
- return {
- totalEntries: entries.length,
- averages,
- recentEntries
- };
-}
-
-export async function getDailyNutrition(from, to) {
- const log = await readJSONFile(DAILY_LOG_FILE, { entries: [] });
- let entries = (log.entries || []).filter(e => e.nutrition && Object.keys(e.nutrition).length > 0);
-
- if (from) entries = entries.filter(e => e.date >= from);
- if (to) entries = entries.filter(e => e.date <= to);
-
- return entries.map(e => ({ date: e.date, ...e.nutrition }))
- .sort((a, b) => b.date.localeCompare(a.date));
-}
diff --git a/server/services/meatspaceHealth.test.js b/server/services/meatspaceHealth.test.js
index 9fe88f2f54..1e89532966 100644
--- a/server/services/meatspaceHealth.test.js
+++ b/server/services/meatspaceHealth.test.js
@@ -2,27 +2,6 @@ import { describe, it, expect } from 'vitest';
// Inline pure functions to avoid mocking file I/O
-function computeNutritionAverages(entries) {
- if (entries.length === 0) return null;
-
- const sums = {};
- const counts = {};
- for (const entry of entries) {
- for (const [key, val] of Object.entries(entry.nutrition)) {
- if (val != null) {
- sums[key] = (sums[key] || 0) + val;
- counts[key] = (counts[key] || 0) + 1;
- }
- }
- }
-
- const averages = {};
- for (const key of Object.keys(sums)) {
- averages[key] = Math.round((sums[key] / counts[key]) * 10) / 10;
- }
- return averages;
-}
-
function extractBodyHistory(entries) {
return entries
.filter(e => e.body && Object.keys(e.body).length > 0)
@@ -38,64 +17,6 @@ function sortByDate(items) {
return [...items].sort((a, b) => a.date.localeCompare(b.date));
}
-// =============================================================================
-// NUTRITION AVERAGES TESTS
-// =============================================================================
-
-describe('computeNutritionAverages', () => {
- it('returns null for empty entries', () => {
- expect(computeNutritionAverages([])).toBeNull();
- });
-
- it('computes averages for single entry', () => {
- const entries = [{ nutrition: { calories: 2000, fatG: 80, carbG: 250 } }];
- const result = computeNutritionAverages(entries);
- expect(result.calories).toBe(2000);
- expect(result.fatG).toBe(80);
- expect(result.carbG).toBe(250);
- });
-
- it('computes averages across multiple entries', () => {
- const entries = [
- { nutrition: { calories: 1500, fatG: 60 } },
- { nutrition: { calories: 2500, fatG: 100 } }
- ];
- const result = computeNutritionAverages(entries);
- expect(result.calories).toBe(2000);
- expect(result.fatG).toBe(80);
- });
-
- it('handles sparse data (some fields missing)', () => {
- const entries = [
- { nutrition: { calories: 1800, fiberG: 30 } },
- { nutrition: { calories: 2200 } }
- ];
- const result = computeNutritionAverages(entries);
- expect(result.calories).toBe(2000);
- expect(result.fiberG).toBe(30); // only 1 entry had fiber
- });
-
- it('skips null values in averages', () => {
- const entries = [
- { nutrition: { calories: 2000, fatG: null } },
- { nutrition: { calories: 1800, fatG: 70 } }
- ];
- const result = computeNutritionAverages(entries);
- expect(result.calories).toBe(1900);
- expect(result.fatG).toBe(70); // only counted non-null
- });
-
- it('rounds to one decimal place', () => {
- const entries = [
- { nutrition: { calories: 1000 } },
- { nutrition: { calories: 1001 } },
- { nutrition: { calories: 1002 } }
- ];
- const result = computeNutritionAverages(entries);
- expect(result.calories).toBe(1001);
- });
-});
-
// =============================================================================
// BODY HISTORY TESTS
// =============================================================================