Updated just now
diff --git a/app/ui/dashboard/revenue-chart.tsx b/app/ui/dashboard/revenue-chart.tsx
index 7ccc409..2ac876b 100644
--- a/app/ui/dashboard/revenue-chart.tsx
+++ b/app/ui/dashboard/revenue-chart.tsx
@@ -1,7 +1,7 @@
import { generateYAxis } from '@/app/lib/utils';
import { CalendarIcon } from '@heroicons/react/24/outline';
import { lusitana } from '@/app/ui/fonts';
-import { Revenue } from '@/app/lib/definitions';
+import { fetchRevenue } from '@/app/lib/data';
// This component is representational only.
// For data visualization UI, check out:
@@ -9,19 +9,16 @@ import { Revenue } from '@/app/lib/definitions';
// https://www.chartjs.org/
// https://airbnb.io/visx/
-export default async function RevenueChart({
- revenue,
-}: {
- revenue: Revenue[];
-}) {
+export default async function RevenueChart() {
+ const revenue = await fetchRevenue();
const chartHeight = 350;
// NOTE: comment in this code when you get to this point in the course
- // const { yAxisLabels, topLabel } = generateYAxis(revenue);
+ const { yAxisLabels, topLabel } = generateYAxis(revenue);
- // if (!revenue || revenue.length === 0) {
- // return
No data available.
;
- // }
+ if (!revenue || revenue.length === 0) {
+ return
No data available.
;
+ }
return (
@@ -30,7 +27,7 @@ export default async function RevenueChart({
{/* NOTE: comment in this code when you get to this point in the course */}
- {/*
);
}
diff --git a/package.json b/package.json
index 89c9d2e..56d898f 100644
--- a/package.json
+++ b/package.json
@@ -1,34 +1,35 @@
{
- "private": true,
- "scripts": {
- "build": "next build",
- "dev": "next dev",
- "start": "next start"
- },
- "dependencies": {
- "@heroicons/react": "^2.0.18",
- "@tailwindcss/forms": "^0.5.6",
- "@types/node": "20.5.7",
- "@vercel/postgres": "^0.5.0",
- "autoprefixer": "10.4.15",
- "bcrypt": "^5.1.1",
- "clsx": "^2.0.0",
- "next": "^14.0.0",
- "postcss": "8.4.31",
- "react": "18.2.0",
- "react-dom": "18.2.0",
- "tailwindcss": "3.3.3",
- "typescript": "5.2.2",
- "zod": "^3.22.2"
- },
- "devDependencies": {
- "@types/bcrypt": "^5.0.1",
- "@types/react": "18.2.21",
- "@types/react-dom": "18.2.14",
- "dotenv": "^16.3.1",
- "prettier": "^3.0.3"
- },
- "engines": {
- "node": ">=18"
- }
-}
+ "private": true,
+ "scripts": {
+ "build": "next build",
+ "dev": "next dev",
+ "start": "next start",
+ "seed": "node -r dotenv/config ./scripts/seed.js"
+ },
+ "dependencies": {
+ "@heroicons/react": "^2.0.18",
+ "@tailwindcss/forms": "^0.5.6",
+ "@types/node": "20.5.7",
+ "@vercel/postgres": "^0.5.0",
+ "autoprefixer": "10.4.15",
+ "bcrypt": "^5.1.1",
+ "clsx": "^2.0.0",
+ "next": "^14.0.0",
+ "postcss": "8.4.31",
+ "react": "18.2.0",
+ "react-dom": "18.2.0",
+ "tailwindcss": "3.3.3",
+ "typescript": "5.2.2",
+ "zod": "^3.22.2"
+ },
+ "devDependencies": {
+ "@types/bcrypt": "^5.0.1",
+ "@types/react": "18.2.21",
+ "@types/react-dom": "18.2.14",
+ "dotenv": "^16.3.1",
+ "prettier": "^3.0.3"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+}
\ No newline at end of file