Spaces:
Running
Running
File size: 3,625 Bytes
99be3c0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | ```javascript
import React from 'react';
import { Link } from 'react-router-dom';
import Sidebar from '../components/Sidebar';
const Dashboard = () => {
return (
<div className="flex h-screen overflow-hidden bg-gray-50">
<Sidebar active="dashboard" />
<div className="flex-1 overflow-auto">
<Header title="Dashboard" />
<main className="p-6">
{/* Metrics */}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
{/* Metric cards */}
<MetricCard
icon="box"
color="purple"
title="Total Apps"
value="42"
/>
<MetricCard
icon="globe"
color="blue"
title="Web Apps"
value="28"
/>
<MetricCard
icon="smartphone"
color="green"
title="USSD"
value="9"
/>
<MetricCard
icon="code"
color="yellow"
title="APIs"
value="5"
/>
</div>
{/* Recent Activity */}
<div className="bg-white rounded-lg shadow overflow-hidden">
<div className="px-6 py-4 border-b border-gray-200">
<h2 className="text-lg font-semibold text-gray-800">Recent Activity</h2>
</div>
<ActivityItem
name="Sarah Johnson"
avatar="1"
action="Added new API integration"
time="10:30 AM"
/>
<ActivityItem
name="Mike Chen"
avatar="2"
action="Updated payment gateway app"
time="9:15 AM"
/>
<ActivityItem
name="Alex Taylor"
avatar="3"
action="Deployed new USSD service"
time="8:45 AM"
/>
</div>
</main>
</div>
</div>
);
};
const Header = ({ title }) => (
<header className="bg-white shadow-sm">
<div className="flex justify-between items-center px-6 py-4">
<h1 className="text-2xl font-semibold text-gray-800">{title}</h1>
<div className="flex items-center space-x-4">
<button className="p-2 rounded-full bg-gray-100 text-gray-600 hover:bg-gray-200">
<i data-feather="bell"></i>
</button>
<button className="p-2 rounded-full bg-gray-100 text-gray-600 hover:bg-gray-200">
<i data-feather="help-circle"></i>
</button>
</div>
</div>
</header>
);
const MetricCard = ({ icon, color, title, value }) => (
<div className="bg-white rounded-lg shadow p-6">
<div className="flex items-center">
<div className={`p-3 rounded-full bg-${color}-100 text-${color}-600`}>
<i data-feather={icon} className="w-6 h-6"></i>
</div>
<div className="ml-4">
<p className="text-sm font-medium text-gray-500">{title}</p>
<p className="text-2xl font-semibold text-gray-800">{value}</p>
</div>
</div>
</div>
);
const ActivityItem = ({ name, avatar, action, time }) => (
<div className="p-6 flex items-start">
<img
className="h-10 w-10 rounded-full"
src={`http://static.photos/people/200x200/${avatar}`}
alt="User avatar"
/>
<div className="ml-4">
<p className="text-sm font-medium text-gray-800">{name}</p>
<p className="text-sm text-gray-500">{action} at {time}</p>
</div>
</div>
);
export default Dashboard;
``` |