Update content.tsx
This commit is contained in:
@@ -7,6 +7,10 @@ import { statsConfig } from "@/config/dashboard"
|
|||||||
import type { OrderStatsData } from "@/lib/types"
|
import type { OrderStatsData } from "@/lib/types"
|
||||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
|
||||||
import { ShoppingCart } from "lucide-react"
|
import { ShoppingCart } from "lucide-react"
|
||||||
|
import { ArrowUpCircle, CreditCard, DollarSign, Users } from "lucide-react"
|
||||||
|
import { Skeleton } from "@/components/ui/skeleton"
|
||||||
|
import { OrderStats as DashboardOrderStats } from "@/components/dashboard/order-stats"
|
||||||
|
import OrderStatsData from "@/types/orderStats"
|
||||||
|
|
||||||
interface ContentProps {
|
interface ContentProps {
|
||||||
username: string
|
username: string
|
||||||
@@ -22,14 +26,36 @@ interface TopProduct {
|
|||||||
revenue: number;
|
revenue: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add quotes array
|
||||||
|
const businessQuotes = [
|
||||||
|
{ text: "Your most unhappy customers are your greatest source of learning.", author: "Bill Gates" },
|
||||||
|
{ text: "The secret of getting ahead is getting started.", author: "Mark Twain" },
|
||||||
|
{ text: "Success is not final; failure is not fatal: It is the courage to continue that counts.", author: "Winston Churchill" },
|
||||||
|
{ text: "The way to get started is to quit talking and begin doing.", author: "Walt Disney" },
|
||||||
|
{ text: "Opportunities don't happen. You create them.", author: "Chris Grosser" },
|
||||||
|
{ text: "The best way to predict the future is to create it.", author: "Peter Drucker" },
|
||||||
|
{ text: "Don't watch the clock; do what it does. Keep going.", author: "Sam Levenson" },
|
||||||
|
{ text: "The future belongs to those who believe in the beauty of their dreams.", author: "Eleanor Roosevelt" },
|
||||||
|
{ text: "Entrepreneurship is living a few years of your life like most people won't so you can spend the rest of your life like most people can't.", author: "Anonymous" },
|
||||||
|
{ text: "Your work is going to fill a large part of your life, and the only way to be truly satisfied is to do what you believe is great work.", author: "Steve Jobs" }
|
||||||
|
];
|
||||||
|
|
||||||
export default function Content({ username, orderStats }: ContentProps) {
|
export default function Content({ username, orderStats }: ContentProps) {
|
||||||
const [greeting, setGreeting] = useState("")
|
const [greeting, setGreeting] = useState("")
|
||||||
const [topProducts, setTopProducts] = useState<TopProduct[]>([])
|
const [topProducts, setTopProducts] = useState<TopProduct[]>([])
|
||||||
const [isLoading, setIsLoading] = useState(true)
|
const [isLoading, setIsLoading] = useState(true)
|
||||||
|
const [randomQuote, setRandomQuote] = useState(() => {
|
||||||
|
const randomIndex = Math.floor(Math.random() * businessQuotes.length)
|
||||||
|
return businessQuotes[randomIndex]
|
||||||
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setGreeting(getGreeting())
|
setGreeting(getGreeting())
|
||||||
|
|
||||||
|
// Pick a random quote when component mounts
|
||||||
|
const randomIndex = Math.floor(Math.random() * businessQuotes.length)
|
||||||
|
setRandomQuote(businessQuotes[randomIndex])
|
||||||
|
|
||||||
// Fetch top products for the vendor
|
// Fetch top products for the vendor
|
||||||
const fetchTopProducts = async () => {
|
const fetchTopProducts = async () => {
|
||||||
try {
|
try {
|
||||||
@@ -88,9 +114,14 @@ export default function Content({ username, orderStats }: ContentProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
|
<div>
|
||||||
<h1 className="text-2xl font-semibold text-foreground">
|
<h1 className="text-2xl font-semibold text-foreground">
|
||||||
{greeting}, {username}!
|
{greeting}, {username}!
|
||||||
</h1>
|
</h1>
|
||||||
|
<p className="text-muted-foreground mt-1 italic text-sm">
|
||||||
|
"The secret of getting ahead is getting started." — <span className="font-medium">Mark Twain</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6">
|
||||||
{statsConfig.map((stat) => (
|
{statsConfig.map((stat) => (
|
||||||
|
|||||||
Reference in New Issue
Block a user