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:
@@ -1,79 +0,0 @@
|
||||
# Next.js 16 Upgrade Guide
|
||||
|
||||
## Current Status
|
||||
- **Current Version**: Next.js 15.2.6
|
||||
- **Target Version**: Next.js 16.1.1
|
||||
- **React Version**: 19.0.0 ✅ (Compatible)
|
||||
|
||||
## Upgrade Steps
|
||||
|
||||
### 1. Backup First
|
||||
```bash
|
||||
git add .
|
||||
git commit -m "Before Next.js 16 upgrade"
|
||||
```
|
||||
|
||||
### 2. Update Dependencies
|
||||
```bash
|
||||
npm install next@16 react@19 react-dom@19 eslint-config-next@16
|
||||
```
|
||||
|
||||
### 3. Update Related Packages
|
||||
```bash
|
||||
npm install @next/bundle-analyzer@latest
|
||||
```
|
||||
|
||||
### 4. Test Build
|
||||
```bash
|
||||
npm run build
|
||||
```
|
||||
|
||||
### 5. Test Development Server
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## Potential Breaking Changes
|
||||
|
||||
### 1. Route Handlers
|
||||
- Check all API routes in `app/api/` for compatibility
|
||||
- Ensure async/await patterns are correct
|
||||
|
||||
### 2. Server Components
|
||||
- Verify all server components work correctly
|
||||
- Check for any client component boundaries
|
||||
|
||||
### 3. Image Optimization
|
||||
- `next/image` may have minor API changes
|
||||
- Check image imports
|
||||
|
||||
### 4. Font Loading
|
||||
- `next/font` should work the same, but verify
|
||||
|
||||
## Performance Improvements Expected
|
||||
|
||||
1. **Faster Builds**: 10-20% faster production builds
|
||||
2. **Better Caching**: Improved static generation caching
|
||||
3. **Smaller Bundles**: Better tree-shaking and code splitting
|
||||
4. **Faster Dev Server**: Turbopack improvements
|
||||
|
||||
## Rollback Plan
|
||||
|
||||
If issues occur:
|
||||
```bash
|
||||
npm install next@15.2.6 react@19 react-dom@19 eslint-config-next@15.2.3
|
||||
```
|
||||
|
||||
## Testing Checklist
|
||||
|
||||
- [ ] Build completes successfully
|
||||
- [ ] Dev server starts without errors
|
||||
- [ ] All pages load correctly
|
||||
- [ ] API routes work
|
||||
- [ ] Images load properly
|
||||
- [ ] Fonts load correctly
|
||||
- [ ] Admin dashboard works
|
||||
- [ ] Order management works
|
||||
- [ ] Analytics charts render
|
||||
- [ ] Authentication works
|
||||
|
||||
@@ -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