Show best month analytics for more date ranges
Updated AdminAnalytics to display the 'Best Month' card for YTD, full year, and previous years, not just YTD. Also removed the obsolete UPGRADE_NEXT16.md guide.
This commit is contained in:
@@ -361,10 +361,14 @@ export default function AdminAnalytics() {
|
||||
}).format(value);
|
||||
};
|
||||
|
||||
// Calculate best month from daily data (for YTD view)
|
||||
// Calculate best month from daily data (for YTD, full year, or previous years)
|
||||
const calculateBestMonth = () => {
|
||||
// Show best month for YTD, full year view, or when viewing previous years
|
||||
const showBestMonth =
|
||||
dateRange === "ytd" || dateRange === "year" || !isViewingCurrentYear;
|
||||
|
||||
if (
|
||||
dateRange !== "ytd" ||
|
||||
!showBestMonth ||
|
||||
!analyticsData?.revenue?.dailyRevenue ||
|
||||
analyticsData.revenue.dailyRevenue.length === 0
|
||||
) {
|
||||
@@ -597,7 +601,7 @@ export default function AdminAnalytics() {
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{/* Best Month Card (only show for YTD) */}
|
||||
{/* Best Month Card (show for YTD, full year, or previous years) */}
|
||||
{bestMonth && (
|
||||
<Card className="border-green-500/50 bg-green-500/5">
|
||||
<CardContent className="pt-6">
|
||||
@@ -608,7 +612,12 @@ export default function AdminAnalytics() {
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-sm font-medium text-muted-foreground">
|
||||
Best Month (YTD)
|
||||
Best Month{" "}
|
||||
{!isViewingCurrentYear
|
||||
? `of ${selectedYear}`
|
||||
: dateRange === "year"
|
||||
? "(Full Year)"
|
||||
: "(YTD)"}
|
||||
</div>
|
||||
<div className="text-xl font-bold text-green-600">
|
||||
{bestMonth.month}
|
||||
|
||||
Reference in New Issue
Block a user