Skip to content

Commit

Permalink
Merge pull request #24 from JamesVictor-O/salesDisplay_section
Browse files Browse the repository at this point in the history
worked on the sales page
  • Loading branch information
MPSxDev authored Nov 28, 2024
2 parents c3ecebe + 586b151 commit 55e274a
Show file tree
Hide file tree
Showing 13 changed files with 1,154 additions and 49 deletions.
11 changes: 10 additions & 1 deletion paystell-frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,25 @@
"lint": "next lint"
},
"dependencies": {
"@radix-ui/react-avatar": "^1.1.1",
"@radix-ui/react-menubar": "^1.1.2",
"@radix-ui/react-popover": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/themes": "^3.1.5",
"@react-icons/all-files": "^4.1.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"date-fns": "^3.6.0",
"icons": "^1.0.0",
"lucide-react": "^0.456.0",
"next": "14.2.17",
"react": "^18",
"react": "^18.3.1",
"react-day-picker": "^8.10.1",
"react-dom": "^18",
"react-icons": "^5.3.0",
"recharts": "^2.13.3",
"shadcn-ui": "^0.2.3",
"tailwind-merge": "^2.5.4",
"tailwindcss-animate": "^1.0.7"
Expand Down
51 changes: 28 additions & 23 deletions paystell-frontend/src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -17,49 +17,54 @@ body {
--background: 0 0% 100%;
--foreground: 0 0% 3.9%;
--card: 0 0% 100%;
--card-foreground: 0 0% 3.9%;
--card-foreground: 240 10% 3.9%;
--popover: 0 0% 100%;
--popover-foreground: 0 0% 3.9%;
--popover-foreground: 240 10% 3.9%;
--primary: 200.2 100% 50%;
--primary-foreground: 200 40% 98%;
--secondary: 0 0% 96.1%;
--secondary-foreground: 0 0% 9%;
--muted: 0 0% 96.1%;
--muted-foreground: 0 0% 45.1%;
--accent: 0 0% 96.1%;
--accent-foreground: 0 0% 9%;
--primary-foreground: 200 40% 98%;
--secondary: 240 4.8% 95.9%;
--secondary-foreground: 240 5.9% 10%;
--muted: 240 4.8% 95.9%;
--muted-foreground: 240 3.8% 46.1%;
--accent: 240 4.8% 95.9%;
--accent-foreground: 240 5.9% 10%;
--destructive: 0 84.2% 60.2%;
--destructive-foreground: 0 0% 98%;
--border: 0 0% 89.8%;
--input: 0 0% 89.8%;
--ring: 0 0% 3.9%;
--border: 240 5.9% 90%;
--input: 240 5.9% 90%;
--ring: 240 10% 3.9%;
--chart-1: 12 76% 61%;
--chart-2: 173 58% 39%;
--chart-3: 197 37% 24%;
--chart-4: 43 74% 66%;
--chart-5: 27 87% 67%;
--radius: 0.5rem;
--chart-1: 12 76% 61%;
--chart-2: 173 58% 39%;
--chart-3: 197 37% 24%;
--chart-4: 43 74% 66%;
--chart-5: 27 87% 67%;
}
.dark {
--background: 0 0% 3.9%;
--background: 240 10% 3.9%;
--foreground: 0 0% 98%;
--card: 0 0% 3.9%;
--card: 240 10% 3.9%;
--card-foreground: 0 0% 98%;
--popover: 0 0% 3.9%;
--popover: 240 10% 3.9%;
--popover-foreground: 0 0% 98%;
--primary: 0 0% 98%;
--primary-foreground: 0 0% 9%;
--secondary: 0 0% 14.9%;
--primary-foreground: 240 5.9% 10%;
--secondary: 240 3.7% 15.9%;
--secondary-foreground: 0 0% 98%;
--muted: 0 0% 14.9%;
--muted-foreground: 0 0% 63.9%;
--accent: 0 0% 14.9%;
--muted: 240 3.7% 15.9%;
--muted-foreground: 240 5% 64.9%;
--accent: 240 3.7% 15.9%;
--accent-foreground: 0 0% 98%;
--destructive: 0 62.8% 30.6%;
--destructive-foreground: 0 0% 98%;
--border: 0 0% 14.9%;
--input: 0 0% 14.9%;
--ring: 0 0% 83.1%;
--border: 240 3.7% 15.9%;
--input: 240 3.7% 15.9%;
--ring: 240 4.9% 83.9%;
--chart-1: 220 70% 50%;
--chart-2: 160 60% 45%;
--chart-3: 30 80% 55%;
Expand Down
16 changes: 16 additions & 0 deletions paystell-frontend/src/app/sales/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Header from "@/components/dashboard/sales/Header"
import Cards from "@/components/dashboard/sales/Cards"
import SalesHistory from "@/components/dashboard/sales/SalesHistory"

const SalesPage = () => {
return (
<div className="py-10 px-8">
<Header/>
<Cards/>
<SalesHistory/>

</div>
)
}

export default SalesPage
66 changes: 66 additions & 0 deletions paystell-frontend/src/components/dashboard/sales/Cards.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { FiUsers } from "react-icons/fi";
import { MdShowChart } from "react-icons/md";
import { CiCreditCard1 } from "react-icons/ci"
import React from 'react'

const Cards = () => {
return (
<div className="grid grid-cols-2 md:grid-cols-4 gap-4 mt-10" >


<Card>
<CardHeader>
<CardTitle className="flex flex-row justify-between">
<h2> Total Revenue</h2>
<span>$</span>
</CardTitle>
</CardHeader>
<CardContent>
<div className="text-3xl font-bold">$45,231.89</div>
<p className="text-base font-normal mt-2">20.1% from last month</p>
</CardContent>
</Card>

<Card>
<CardHeader>
<CardTitle className="flex flex-row justify-between">
<h2> Subscriptions</h2>
<span><FiUsers /></span>
</CardTitle>
</CardHeader>
<CardContent>
<div className="text-3xl font-bold">+3000</div>
<p className="text-base font-normal mt-2">20.1% from last month</p>
</CardContent>
</Card>

<Card>
<CardHeader>
<CardTitle className="flex flex-row justify-between">
<h2>Sales</h2>
<span><CiCreditCard1 /></span>
</CardTitle>
</CardHeader>
<CardContent>
<div className="text-3xl font-bold">+12,234</div>
<p className="text-base font-normal mt-2">20.1% from last month</p>
</CardContent>
</Card>
<Card>
<CardHeader>
<CardTitle className="flex flex-row justify-between">
<h2>Active Now</h2>
<span><MdShowChart /></span>
</CardTitle>
</CardHeader>
<CardContent>
<div className="text-3xl font-bold">+3000</div>
<p className="text-base font-normal mt-2">20.1% from last month</p>
</CardContent>
</Card>
</div>
)
}

export default Cards
49 changes: 49 additions & 0 deletions paystell-frontend/src/components/dashboard/sales/Chart.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"use client";

import { Bar, BarChart, CartesianGrid, XAxis } from "recharts";
import { ChartTooltip, ChartTooltipContent ,ChartLegend, ChartLegendContent} from "@/components/ui/chart"
import { ChartContainer } from "@/components/ui/chart";
import { type ChartConfig } from "@/components/ui/chart";

const Chart = () => {
const chartData = [
{ month: "January", desktop: 186, mobile: 80 },
{ month: "February", desktop: 305, mobile: 200 },
{ month: "March", desktop: 237, mobile: 120 },
{ month: "April", desktop: 73, mobile: 190 },
{ month: "May", desktop: 209, mobile: 130 },
{ month: "June", desktop: 214, mobile: 140 },
{ month: "July", desktop: 214, mobile: 140 },
];
const chartConfig = {
desktop: {
label: "Snacks",
color: "#2563eb",
},
mobile: {
label: "drinks",
color: "#60a5fa",
},
} satisfies ChartConfig;

return (
<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
<BarChart accessibilityLayer data={chartData}>
<CartesianGrid vertical={false} />
<XAxis
dataKey="month"
tickLine={false}
tickMargin={10}
axisLine={false}
tickFormatter={(value) => value.slice(0, 3)}
/>
<ChartTooltip content={<ChartTooltipContent />} />
<ChartLegend content={<ChartLegendContent />} />
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
</BarChart>
</ChartContainer>
);
};

export default Chart;
68 changes: 68 additions & 0 deletions paystell-frontend/src/components/dashboard/sales/Header.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
"use client"
import React, { useState } from "react";
import {
Menubar,
MenubarContent,
MenubarItem,
MenubarMenu,
MenubarSeparator,
MenubarShortcut,
MenubarTrigger,
} from "@/components/ui/menubar";
import { format } from "date-fns"
import { Calendar as CalendarIcon } from "lucide-react"

import { cn } from "@/lib/utils"
import { Button } from "@/components/ui/button"
import { Calendar } from "@/components/ui/calendar"
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover"

const Header = () => {
const [date, setDate] = useState<Date>()
return (
<div className=" flex flex-col md:flex-row justify-between">
<Menubar className=" md:w-[25%] mb-2">
<MenubarMenu>
<MenubarTrigger>overview</MenubarTrigger>
</MenubarMenu>
<MenubarMenu>
<MenubarTrigger>Analytics</MenubarTrigger>
</MenubarMenu>
<MenubarMenu>
<MenubarTrigger>overview</MenubarTrigger>
</MenubarMenu>
<MenubarMenu>
<MenubarTrigger>overview</MenubarTrigger>
</MenubarMenu>
</Menubar>
<Popover>
<PopoverTrigger asChild>
<Button
variant={"outline"}
className={cn(
"w-[280px] justify-start text-left font-normal",
!date && "text-muted-foreground"
)}
>
<CalendarIcon className="mr-2 h-4 w-4" />
{date ? format(date, "PPP") : <span>Pick a date</span>}
</Button>
</PopoverTrigger>
<PopoverContent className="w-auto p-0">
<Calendar
mode="single"
selected={date}
onSelect={setDate}
initialFocus
/>
</PopoverContent>
</Popover>
</div>
);
};

export default Header;
80 changes: 80 additions & 0 deletions paystell-frontend/src/components/dashboard/sales/SalesHistory.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import Chart from "./Chart";
import {
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table";
const SalesHistory = () => {
return (
<div className="mt-6 flex flex-col md:flex-row">
<Table className="md:w-[90%]">
<TableCaption>A list of your recent invoices.</TableCaption>
<TableHeader>
<TableRow>
<TableHead className="w-[100px]">Invoice</TableHead>
<TableHead>Status</TableHead>
<TableHead>Method</TableHead>
<TableHead className="text-right">Amount</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell className="font-medium flex flex-row items-center justify-between">
<Avatar className="w-[2rem]">
<AvatarImage src="https://github.com/shadcn.png" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
<div className="ml-2">
<h2 className="text-base font-medium">Olivia chioma</h2>
<span className="text-xs">[email protected]</span>
</div>
</TableCell>
<TableCell>Paid</TableCell>
<TableCell>Credit Card</TableCell>
<TableCell className="text-right">$250.00</TableCell>
</TableRow>
<TableRow>
<TableCell className="font-medium flex flex-row items-center justify-between">
<Avatar className="w-[2rem]">
<AvatarImage src="https://github.com/shadcn.png" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
<div className="ml-2">
<h2 className="text-base font-medium">Olivia chioma</h2>
<span className="text-xs">[email protected]</span>
</div>
</TableCell>
<TableCell>Paid</TableCell>
<TableCell>Credit Card</TableCell>
<TableCell className="text-right">$250.00</TableCell>
</TableRow>
<TableRow>
<TableCell className="font-medium flex flex-row items-center justify-between">
<Avatar className="w-[2rem]">
<AvatarImage src="https://github.com/shadcn.png" />
<AvatarFallback>CN</AvatarFallback>
</Avatar>
<div className="ml-2">
<h2 className="text-base font-medium">Olivia chioma</h2>
<span className="text-xs">[email protected]</span>
</div>
</TableCell>
<TableCell>Pending</TableCell>
<TableCell>Credit Card</TableCell>
<TableCell className="text-right">$250.00</TableCell>
</TableRow>
</TableBody>
</Table>
<div className="mt-5 md:w-[40%]">
<Chart />
</div>
</div>
);
};

export default SalesHistory;
Loading

0 comments on commit 55e274a

Please sign in to comment.