Update and fix colors
This commit is contained in:
@@ -151,21 +151,22 @@ const MiniRealtimeAnalytics = () => {
|
|||||||
dataKey="minute"
|
dataKey="minute"
|
||||||
tickFormatter={(value) => value + "m"}
|
tickFormatter={(value) => value + "m"}
|
||||||
className="text-xs"
|
className="text-xs"
|
||||||
tick={{ fill: "#BAE6FD" }}
|
tick={{ fill: "#e0f2fe" }}
|
||||||
/>
|
/>
|
||||||
<YAxis
|
<YAxis
|
||||||
className="text-xs"
|
className="text-xs"
|
||||||
tick={{ fill: "#BAE6FD" }}
|
tick={{ fill: "#e0f2fe" }}
|
||||||
/>
|
/>
|
||||||
<Tooltip
|
<Tooltip
|
||||||
content={({ active, payload }) => {
|
content={({ active, payload }) => {
|
||||||
if (active && payload && payload.length) {
|
if (active && payload && payload.length) {
|
||||||
const timestamp = new Date(payload[0].payload.timestamp);
|
const timestamp = payload[0].payload.timestamp;
|
||||||
|
const formattedTime = timestamp ? format(new Date(timestamp), "h:mm a") : "N/A";
|
||||||
return (
|
return (
|
||||||
<Card className="p-2 shadow-lg bg-sky-800 border-none">
|
<Card className="p-2 shadow-lg bg-sky-800 border-none">
|
||||||
<CardContent className="p-0 space-y-1">
|
<CardContent className="p-0 space-y-1">
|
||||||
<p className="font-medium text-sm text-sky-100 border-b border-sky-700 pb-1 mb-1">
|
<p className="font-medium text-sm text-sky-100 border-b border-sky-700 pb-1 mb-1">
|
||||||
{format(timestamp, "h:mm a")}
|
{formattedTime}
|
||||||
</p>
|
</p>
|
||||||
<div className="flex justify-between items-center text-sm">
|
<div className="flex justify-between items-center text-sm">
|
||||||
<span className="text-sky-200">
|
<span className="text-sky-200">
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ const MiniStatCard = memo(({
|
|||||||
<span
|
<span
|
||||||
className={`flex items-center gap-0 px-1 py-0.5 rounded-full ${
|
className={`flex items-center gap-0 px-1 py-0.5 rounded-full ${
|
||||||
trend === 'up'
|
trend === 'up'
|
||||||
? 'text-sm bg-emerald-300 text-emerald-900'
|
? 'text-sm font-bold bg-emerald-300 text-emerald-900'
|
||||||
: 'text-sm bg-rose-300 text-rose-900'
|
: 'text-sm font-bold bg-rose-300 text-rose-900'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{trend === "up" ? (
|
{trend === "up" ? (
|
||||||
@@ -241,13 +241,13 @@ const MiniSalesChart = ({ className = "" }) => {
|
|||||||
previousValue={formatCurrency(summaryStats.prevRevenue, false)}
|
previousValue={formatCurrency(summaryStats.prevRevenue, false)}
|
||||||
trend={summaryStats.growth.revenue >= 0 ? "up" : "down"}
|
trend={summaryStats.growth.revenue >= 0 ? "up" : "down"}
|
||||||
trendValue={`${Math.abs(Math.round(summaryStats.growth.revenue))}%`}
|
trendValue={`${Math.abs(Math.round(summaryStats.growth.revenue))}%`}
|
||||||
colorClass="text-emerald-200"
|
colorClass="text-rose-200"
|
||||||
titleClass="text-emerald-100 font-bold text-md"
|
titleClass="text-rose-100 font-bold text-md"
|
||||||
descriptionClass="text-emerald-200 text-md font-semibold"
|
descriptionClass="text-rose-200 text-md font-semibold"
|
||||||
icon={PiggyBank}
|
icon={PiggyBank}
|
||||||
iconColor="text-emerald-900"
|
iconColor="text-rose-900"
|
||||||
iconBackground="bg-emerald-300"
|
iconBackground="bg-rose-300"
|
||||||
background="h-[150px] bg-gradient-to-br from-emerald-900 to-emerald-800"
|
background="h-[150px] bg-gradient-to-br from-rose-900 to-rose-800"
|
||||||
onClick={() => toggleMetric('revenue')}
|
onClick={() => toggleMetric('revenue')}
|
||||||
active={visibleMetrics.revenue}
|
active={visibleMetrics.revenue}
|
||||||
/>
|
/>
|
||||||
@@ -257,27 +257,27 @@ const MiniSalesChart = ({ className = "" }) => {
|
|||||||
previousValue={summaryStats.prevOrders.toLocaleString()}
|
previousValue={summaryStats.prevOrders.toLocaleString()}
|
||||||
trend={summaryStats.growth.orders >= 0 ? "up" : "down"}
|
trend={summaryStats.growth.orders >= 0 ? "up" : "down"}
|
||||||
trendValue={`${Math.abs(Math.round(summaryStats.growth.orders))}%`}
|
trendValue={`${Math.abs(Math.round(summaryStats.growth.orders))}%`}
|
||||||
colorClass="text-blue-200"
|
colorClass="text-indigo-200"
|
||||||
titleClass="text-blue-100 font-bold text-md"
|
titleClass="text-indigo-100 font-bold text-md"
|
||||||
descriptionClass="text-blue-200 text-md font-semibold"
|
descriptionClass="text-indigo-200 text-md font-semibold"
|
||||||
icon={Truck}
|
icon={Truck}
|
||||||
iconColor="text-blue-900"
|
iconColor="text-indigo-900"
|
||||||
iconBackground="bg-blue-300"
|
iconBackground="bg-indigo-300"
|
||||||
background="h-[150px] bg-gradient-to-br from-blue-900 to-blue-800"
|
background="h-[150px] bg-gradient-to-br from-indigo-900 to-indigo-800"
|
||||||
onClick={() => toggleMetric('orders')}
|
onClick={() => toggleMetric('orders')}
|
||||||
active={visibleMetrics.orders}
|
active={visibleMetrics.orders}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Chart Card */}
|
{/* Chart Card */}
|
||||||
<Card className="bg-gradient-to-br from-purple-900 to-purple-800 backdrop-blur-sm">
|
<Card className="bg-gradient-to-br from-slate-700 to-slate-600 backdrop-blur-sm">
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<CardContent className="p-4">
|
<CardContent className="p-4">
|
||||||
<SkeletonChart />
|
<SkeletonChart />
|
||||||
</CardContent>
|
</CardContent>
|
||||||
) : !data.length ? (
|
) : !data.length ? (
|
||||||
<CardContent className="p-4">
|
<CardContent className="p-4">
|
||||||
<div className="flex items-center justify-center h-[200px] text-purple-200">
|
<div className="flex items-center justify-center h-[200px] text-stone-200">
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<TrendingUp className="h-8 w-8 mx-auto mb-2" />
|
<TrendingUp className="h-8 w-8 mx-auto mb-2" />
|
||||||
<div className="text-sm">No sales data available</div>
|
<div className="text-sm">No sales data available</div>
|
||||||
@@ -290,29 +290,29 @@ const MiniSalesChart = ({ className = "" }) => {
|
|||||||
<ResponsiveContainer width="100%" height="100%">
|
<ResponsiveContainer width="100%" height="100%">
|
||||||
<LineChart
|
<LineChart
|
||||||
data={data}
|
data={data}
|
||||||
margin={{ top: 0, right: -30, left: -10, bottom: -10 }}
|
margin={{ top: 0, right: -30, left: -5, bottom: -10 }}
|
||||||
>
|
>
|
||||||
<CartesianGrid strokeDasharray="3 3" className="stroke-purple-700" />
|
<CartesianGrid strokeDasharray="3 3" className="stroke-stone-700" />
|
||||||
<XAxis
|
<XAxis
|
||||||
dataKey="timestamp"
|
dataKey="timestamp"
|
||||||
tickFormatter={formatXAxis}
|
tickFormatter={formatXAxis}
|
||||||
className="text-[10px]"
|
className="text-xs"
|
||||||
tick={{ fill: "#E9D5FF" }}
|
tick={{ fill: "#f5f5f4" }}
|
||||||
/>
|
/>
|
||||||
{visibleMetrics.revenue && (
|
{visibleMetrics.revenue && (
|
||||||
<YAxis
|
<YAxis
|
||||||
yAxisId="revenue"
|
yAxisId="revenue"
|
||||||
tickFormatter={(value) => formatCurrency(value, false)}
|
tickFormatter={(value) => formatCurrency(value, false)}
|
||||||
className="text-[10px]"
|
className="text-xs"
|
||||||
tick={{ fill: "#E9D5FF" }}
|
tick={{ fill: "#f5f5f4" }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{visibleMetrics.orders && (
|
{visibleMetrics.orders && (
|
||||||
<YAxis
|
<YAxis
|
||||||
yAxisId="orders"
|
yAxisId="orders"
|
||||||
orientation="right"
|
orientation="right"
|
||||||
className="text-[10px]"
|
className="text-xs"
|
||||||
tick={{ fill: "#E9D5FF" }}
|
tick={{ fill: "#f5f5f4" }}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Tooltip
|
<Tooltip
|
||||||
@@ -320,9 +320,9 @@ const MiniSalesChart = ({ className = "" }) => {
|
|||||||
if (active && payload && payload.length) {
|
if (active && payload && payload.length) {
|
||||||
const timestamp = new Date(payload[0].payload.timestamp);
|
const timestamp = new Date(payload[0].payload.timestamp);
|
||||||
return (
|
return (
|
||||||
<Card className="p-2 shadow-lg bg-purple-800 border-none">
|
<Card className="p-2 shadow-lg bg-stone-800 border-none">
|
||||||
<CardContent className="p-0 space-y-1">
|
<CardContent className="p-0 space-y-1">
|
||||||
<p className="font-medium text-sm text-purple-100 border-b border-purple-700 pb-1 mb-1">
|
<p className="font-medium text-sm text-stone-100 border-b border-stone-700 pb-1 mb-1">
|
||||||
{timestamp.toLocaleDateString([], {
|
{timestamp.toLocaleDateString([], {
|
||||||
weekday: "short",
|
weekday: "short",
|
||||||
month: "short",
|
month: "short",
|
||||||
@@ -333,10 +333,10 @@ const MiniSalesChart = ({ className = "" }) => {
|
|||||||
.filter(entry => visibleMetrics[entry.dataKey])
|
.filter(entry => visibleMetrics[entry.dataKey])
|
||||||
.map((entry, index) => (
|
.map((entry, index) => (
|
||||||
<div key={index} className="flex justify-between items-center text-sm">
|
<div key={index} className="flex justify-between items-center text-sm">
|
||||||
<span className="text-purple-200">
|
<span className="text-stone-200">
|
||||||
{entry.name}:
|
{entry.name}:
|
||||||
</span>
|
</span>
|
||||||
<span className="font-medium ml-4 text-purple-100">
|
<span className="font-medium ml-4 text-stone-100">
|
||||||
{entry.dataKey === 'revenue'
|
{entry.dataKey === 'revenue'
|
||||||
? formatCurrency(entry.value)
|
? formatCurrency(entry.value)
|
||||||
: entry.value.toLocaleString()}
|
: entry.value.toLocaleString()}
|
||||||
@@ -354,9 +354,9 @@ const MiniSalesChart = ({ className = "" }) => {
|
|||||||
<Line
|
<Line
|
||||||
yAxisId="revenue"
|
yAxisId="revenue"
|
||||||
type="monotone"
|
type="monotone"
|
||||||
dataKey="revenue"
|
dataKey="revenue"re
|
||||||
name="Revenue"
|
name="Revenue"
|
||||||
stroke="#A855F7"
|
stroke="#f43f5e"
|
||||||
strokeWidth={2}
|
strokeWidth={2}
|
||||||
dot={false}
|
dot={false}
|
||||||
/>
|
/>
|
||||||
@@ -367,7 +367,7 @@ const MiniSalesChart = ({ className = "" }) => {
|
|||||||
type="monotone"
|
type="monotone"
|
||||||
dataKey="orders"
|
dataKey="orders"
|
||||||
name="Orders"
|
name="Orders"
|
||||||
stroke="#38BDF8"
|
stroke="#6366f1"
|
||||||
strokeWidth={2}
|
strokeWidth={2}
|
||||||
dot={false}
|
dot={false}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user