-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from JamesVictor-O/salesDisplay_section
worked on the sales page
- Loading branch information
Showing
13 changed files
with
1,154 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
66
paystell-frontend/src/components/dashboard/sales/Cards.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
49
paystell-frontend/src/components/dashboard/sales/Chart.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
68
paystell-frontend/src/components/dashboard/sales/Header.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
80
paystell-frontend/src/components/dashboard/sales/SalesHistory.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Oops, something went wrong.