import React, { useEffect, useMemo, useState } from 'react';
import {
Camera,
Bell,
FileText,
Users,
Settings,
Menu,
X,
Zap,
Code,
MessageSquare,
Package,
ShieldCheck,
Activity,
Sparkles,
MonitorSmartphone,
} from 'lucide-react';
import { useLocation } from 'wouter';
import { isMobile } from '@/lib/platform';
import { App as CapApp } from '@capacitor/app';
import { haptics } from '@/lib/haptics';
import { PullToRefresh } from '@/components/mobile/PullToRefresh';
import { SwipeableCardList } from '@/components/mobile/SwipeableCard';
import { MobileBottomNav, DEFAULT_MOBILE_TABS } from '@/components/MobileBottomNav';
export default function SimpleMobileDashboard() {
const [location, navigate] = useLocation();
const [showMenu, setShowMenu] = useState(false);
const [activeTab, setActiveTab] = useState('home');
const [cards, setCards] = useState(() => defaultCards());
// Handle Android back button
useEffect(() => {
if (!isMobile()) return;
const backHandler = CapApp.addListener('backButton', ({ canGoBack }) => {
if (location === '/' || location === '/mobile') {
CapApp.exitApp();
} else {
window.history.back();
}
});
return () => {
backHandler.remove();
};
}, [location]);
const handleRefresh = async () => {
haptics.light();
await new Promise((resolve) => setTimeout(resolve, 900));
haptics.success();
};
const quickStats = useMemo(
() => [
{ label: 'Projects', value: '5', icon: , tone: 'from-cyan-500 to-emerald-500' },
{ label: 'Alerts', value: '3', icon: , tone: 'from-red-500 to-pink-500' },
{ label: 'Messages', value: '12', icon: , tone: 'from-violet-500 to-blue-500' },
],
[]
);
const handleNav = (path: string) => {
haptics.light();
navigate(path);
setShowMenu(false);
};
if (!isMobile()) {
return null;
}
return (
{/* Animated background */}
{/* Header */}
{/* Main Content */}
{/* Welcome */}
AeThex OS · Android
Launchpad
{/* Primary Resume */}
{/* Full OS entry point */}
{/* Quick stats */}
{quickStats.map((stat) => (
{stat.icon}
{stat.value}
{stat.label}
))}
{/* Quick Actions Grid */}
} label="Capture" color="from-blue-900/40 to-purple-900/40" onPress={() => handleNav('/camera')} />
} label="Alerts" color="from-red-900/40 to-pink-900/40" badge="3" onPress={() => handleNav('/notifications')} />
} label="Modules" color="from-emerald-900/40 to-cyan-900/40" onPress={() => handleNav('/hub/code-gallery')} />
} label="Messages" color="from-violet-900/40 to-purple-900/40" onPress={() => handleNav('/hub/messaging')} />
} label="Desktop OS" color="from-cyan-900/40 to-emerald-900/40" onPress={() => handleNav('/os')} />
{/* Swipeable shortcuts */}
card.id}
onItemSwipeLeft={(card) => {
haptics.medium();
setCards((prev) => prev.filter((c) => c.id !== card.id));
}}
onItemSwipeRight={(card) => {
haptics.medium();
setCards((prev) => prev.map((c) => (c.id === card.id ? { ...c, pinned: true } : c)));
}}
renderItem={(card) => (
)}
emptyMessage="No shortcuts yet"
/>
{/* Status Bar */}
PLATFORM
ANDROID
STATUS
READY
SYNC
LIVE
{/* Bottom navigation */}
{
setActiveTab(tabId);
haptics.selection();
navigate(tabId === 'home' ? '/' : `/${tabId}`);
}}
/>
{/* Slide-out Menu */}
{showMenu && (
<>
setShowMenu(false)}
/>
>
)}
);
}
function defaultCards() {
return [
{
id: 'projects',
title: 'Projects',
description: 'View and manage builds',
icon:
,
color: 'from-blue-500 to-cyan-500',
badge: 3,
path: '/hub/projects',
},
{
id: 'messages',
title: 'Messages',
description: 'Recent conversations',
icon:
,
color: 'from-purple-500 to-pink-500',
badge: 5,
path: '/hub/messaging',
},
{
id: 'alerts',
title: 'Alerts',
description: 'System notifications',
icon:
,
color: 'from-red-500 to-orange-500',
path: '/notifications',
},
{
id: 'modules',
title: 'Modules',
description: 'Code gallery and tools',
icon:
,
color: 'from-emerald-500 to-cyan-500',
path: '/hub/code-gallery',
},
];
}
function QuickTile({
icon,
label,
color,
badge,
onPress,
}: {
icon: React.ReactNode;
label: string;
color: string;
badge?: string;
onPress: () => void;
}) {
return (
);
}