mirror of
https://github.com/dylanbenzi/yellowbird.git
synced 2026-11-27 01:07:01 +00:00
updated home modules
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
"@nivo/line": "^0.84.0",
|
||||
"@nivo/treemap": "^0.84.0",
|
||||
"@radix-ui/react-dialog": "^1.0.5",
|
||||
"@radix-ui/react-scroll-area": "^1.0.5",
|
||||
"@radix-ui/react-separator": "^1.0.3",
|
||||
"@radix-ui/react-slot": "^1.0.2",
|
||||
"@radix-ui/react-tabs": "^1.0.4",
|
||||
|
||||
Generated
+38
@@ -35,6 +35,9 @@ dependencies:
|
||||
'@radix-ui/react-dialog':
|
||||
specifier: ^1.0.5
|
||||
version: 1.0.5(@types/[email protected])(@types/[email protected])([email protected])([email protected])
|
||||
'@radix-ui/react-scroll-area':
|
||||
specifier: ^1.0.5
|
||||
version: 1.0.5(@types/[email protected])(@types/[email protected])([email protected])([email protected])
|
||||
'@radix-ui/react-separator':
|
||||
specifier: ^1.0.3
|
||||
version: 1.0.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])
|
||||
@@ -938,6 +941,12 @@ packages:
|
||||
requiresBuild: true
|
||||
optional: true
|
||||
|
||||
/@radix-ui/[email protected]:
|
||||
resolution: {integrity: sha512-T5gIdVO2mmPW3NNhjNgEP3cqMXjXL9UbO0BzWcXfvdBs+BohbQxvd/K5hSVKmn9/lbTdsQVKbUcP5WLCwvUbBg==}
|
||||
dependencies:
|
||||
'@babel/runtime': 7.23.9
|
||||
dev: false
|
||||
|
||||
/@radix-ui/[email protected]:
|
||||
resolution: {integrity: sha512-yQ8oGX2GVsEYMWGxcovu1uGWPCxV5BFfeeYxqPmuAzUyLT9qmaMXSAhXpb0WrspIeqYzdJpkh2vHModJPgRIaw==}
|
||||
dependencies:
|
||||
@@ -1265,6 +1274,35 @@ packages:
|
||||
react-dom: 18.2.0([email protected])
|
||||
dev: false
|
||||
|
||||
/@radix-ui/[email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected]):
|
||||
resolution: {integrity: sha512-b6PAgH4GQf9QEn8zbT2XUHpW5z8BzqEc7Kl11TwDrvuTrxlkcjTD5qa/bxgKr+nmuXKu4L/W5UZ4mlP/VG/5Gw==}
|
||||
peerDependencies:
|
||||
'@types/react': '*'
|
||||
'@types/react-dom': '*'
|
||||
react: ^16.8 || ^17.0 || ^18.0
|
||||
react-dom: ^16.8 || ^17.0 || ^18.0
|
||||
peerDependenciesMeta:
|
||||
'@types/react':
|
||||
optional: true
|
||||
'@types/react-dom':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@babel/runtime': 7.23.9
|
||||
'@radix-ui/number': 1.0.1
|
||||
'@radix-ui/primitive': 1.0.1
|
||||
'@radix-ui/react-compose-refs': 1.0.1(@types/[email protected])([email protected])
|
||||
'@radix-ui/react-context': 1.0.1(@types/[email protected])([email protected])
|
||||
'@radix-ui/react-direction': 1.0.1(@types/[email protected])([email protected])
|
||||
'@radix-ui/react-presence': 1.0.1(@types/[email protected])(@types/[email protected])([email protected])([email protected])
|
||||
'@radix-ui/react-primitive': 1.0.3(@types/[email protected])(@types/[email protected])([email protected])([email protected])
|
||||
'@radix-ui/react-use-callback-ref': 1.0.1(@types/[email protected])([email protected])
|
||||
'@radix-ui/react-use-layout-effect': 1.0.1(@types/[email protected])([email protected])
|
||||
'@types/react': 18.2.57
|
||||
'@types/react-dom': 18.2.19
|
||||
react: 18.2.0
|
||||
react-dom: 18.2.0([email protected])
|
||||
dev: false
|
||||
|
||||
/@radix-ui/[email protected](@types/[email protected])(@types/[email protected])([email protected])([email protected]):
|
||||
resolution: {integrity: sha512-itYmTy/kokS21aiV5+Z56MZB54KrhPgn6eHDKkFeOLR34HMN2s8PaN47qZZAGnvupcjxHaFZnW4pQEh0BvvVuw==}
|
||||
peerDependencies:
|
||||
|
||||
@@ -18,7 +18,7 @@ export const metadata: Metadata = {
|
||||
export default function Home() {
|
||||
return (
|
||||
<main className="flex h-full">
|
||||
<div className="grid grid-rows-3 grid-cols-12 gap-6 flex-1 ">
|
||||
<div className="grid grid-rows-3 grid-cols-12 gap-4">
|
||||
<div className="col-span-4 sm:col-span-4">
|
||||
<PortfolioModule />
|
||||
</div>
|
||||
|
||||
@@ -32,7 +32,7 @@ export function TableNoHeader<TData, TValue>({
|
||||
});
|
||||
|
||||
return (
|
||||
<div className="h-full">
|
||||
<div>
|
||||
<Table className="h-full no-scrollbar">
|
||||
{/* <TableHeader>
|
||||
{table.getHeaderGroups().map((headerGroup) => (
|
||||
|
||||
@@ -45,6 +45,14 @@ import CalendarSquares from "../charts/CalendarSquares";
|
||||
import { DocumentsTable } from "../charts/documents/DocumentsTable";
|
||||
import { documentsColumns } from "../charts/documents/documentsColumns";
|
||||
import { TableNoHeader } from "../Table";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardFooter,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "../ui/card";
|
||||
import { ScrollArea } from "../ui/scroll-area";
|
||||
|
||||
export const PortfolioModule = () => {
|
||||
const portfolioLine: LineSeriesPartialOptionsWithData = {
|
||||
@@ -62,91 +70,115 @@ export const PortfolioModule = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<HomepageModule title="Portfolio">
|
||||
<div className="flex justify-between px-4">
|
||||
<div>$34,120.87</div>
|
||||
<div className="rounded-full bg-neutral-900 px-4">2W 1M YTD</div>
|
||||
<div className="text-green-500">^10.0% $3,412.09</div>
|
||||
</div>
|
||||
<div className="h-3/4">
|
||||
<Chart
|
||||
series={[portfolioLine, indexLine]}
|
||||
colors={{
|
||||
backgroundColor: "transparent",
|
||||
textColor: "white",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<Button className="text-white" variant="link">
|
||||
Go to Portfolio
|
||||
<ArrowRight className="ml-1" size={16} />
|
||||
</Button>
|
||||
</div>
|
||||
</HomepageModule>
|
||||
<Card className="flex flex-col">
|
||||
<CardHeader className="p-4">
|
||||
<CardTitle>Portfolio</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="h-full p-4">
|
||||
<div className="flex justify-between px-4">
|
||||
<div>$34,120.87</div>
|
||||
<div className="rounded-full bg-neutral-900 px-4">2W 1M YTD</div>
|
||||
<div className="text-green-500">^10.0% $3,412.09</div>
|
||||
</div>
|
||||
<div className="h-3/4">
|
||||
<Chart
|
||||
series={[portfolioLine, indexLine]}
|
||||
colors={{
|
||||
backgroundColor: "transparent",
|
||||
textColor: "white",
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</CardContent>
|
||||
<CardFooter className="p-4 pt-0">
|
||||
<div className="flex justify-between">
|
||||
<Button className="text-white" variant="link">
|
||||
Go to Portfolio
|
||||
<ArrowRight className="ml-1" size={16} />
|
||||
</Button>
|
||||
</div>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export const NewsModule = () => {
|
||||
return (
|
||||
<HomepageModule title="News">
|
||||
<NewsTable columns={newsColumns} data={newsData} />
|
||||
</HomepageModule>
|
||||
<Card className="flex flex-col">
|
||||
<CardHeader className="border-b border-neutral-700 p-4">
|
||||
<CardTitle>News</CardTitle>
|
||||
</CardHeader>
|
||||
<ScrollArea>
|
||||
<CardContent className="h-full p-0">
|
||||
<DocumentsTable columns={documentsColumns} data={documentsList} />
|
||||
</CardContent>
|
||||
</ScrollArea>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export const HeatmapModule = () => {
|
||||
return (
|
||||
<HomepageModule title="Heatmap">
|
||||
<MarketHeatmap data={heatmapData} />
|
||||
</HomepageModule>
|
||||
<Card className="flex flex-col">
|
||||
<CardHeader className="p-4">
|
||||
<CardTitle>Market Heatmap</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className=" h-full p-0">
|
||||
<MarketHeatmap data={heatmapData} />
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export const MoversModule = () => {
|
||||
return (
|
||||
<HomepageModule title="Movers">
|
||||
<div className="flex justify-between 2xl:px-2">
|
||||
<div className="mt-4 px-4 2xl:mt-6">
|
||||
<div className="text-lg">Gainers</div>
|
||||
<div className="mt-4 grid grid-cols-2 grid-rows-5 gap-x-2 gap-y-4 2xl:gap-x-10 2xl:gap-y-6">
|
||||
{winnerMovers.map((item) => (
|
||||
<div
|
||||
className="flex border-b border-neutral-400 pb-1 text-sm 2xl:text-base"
|
||||
key={item.symbol}
|
||||
>
|
||||
<div className="w-32 font-bold 2xl:w-24">{item.symbol}</div>
|
||||
<div className="text-right text-xs text-neutral-400 2xl:w-20 2xl:text-base">
|
||||
{item.stockPrice}
|
||||
<Card>
|
||||
<CardHeader className="p-4">
|
||||
<CardTitle>Movers</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="h-full p-4">
|
||||
<div className="flex justify-between 2xl:px-2">
|
||||
<div className="mt-4 px-4 2xl:mt-6">
|
||||
<div className="text-lg">Gainers</div>
|
||||
<div className="mt-4 grid grid-cols-2 grid-rows-5 gap-x-2 gap-y-4 2xl:gap-x-10 2xl:gap-y-6">
|
||||
{winnerMovers.map((item) => (
|
||||
<div
|
||||
className="flex border-b border-neutral-400 pb-1 text-sm 2xl:text-base"
|
||||
key={item.symbol}
|
||||
>
|
||||
<div className="w-32 font-bold 2xl:w-24">{item.symbol}</div>
|
||||
<div className="text-right text-xs text-neutral-400 2xl:w-20 2xl:text-base">
|
||||
{item.stockPrice}
|
||||
</div>
|
||||
<div className="ml-2 w-20 rounded-lg bg-green-500 bg-opacity-90 text-center text-xs 2xl:ml-4 2xl:text-base">
|
||||
+{item.percentChange}%
|
||||
</div>
|
||||
</div>
|
||||
<div className="ml-2 w-20 rounded-lg bg-green-500 bg-opacity-90 text-center text-xs 2xl:ml-4 2xl:text-base">
|
||||
+{item.percentChange}%
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-4 h-full px-4 2xl:mt-6">
|
||||
<div className="text-lg">Losers</div>
|
||||
<div className="mt-4 grid grid-cols-2 grid-rows-5 gap-x-2 gap-y-4 2xl:gap-x-10 2xl:gap-y-6">
|
||||
{loserMovers.map((item) => (
|
||||
<div
|
||||
className="flex border-b border-neutral-400 pb-1 text-sm 2xl:text-base"
|
||||
key={item.symbol}
|
||||
>
|
||||
<div className="w-32 font-bold 2xl:w-24">{item.symbol}</div>
|
||||
<div className="text-right text-xs text-neutral-400 2xl:w-20 2xl:text-base">
|
||||
{item.stockPrice}
|
||||
</div>
|
||||
<div className="ml-2 w-20 rounded-lg bg-red-500 bg-opacity-90 text-center text-xs 2xl:ml-4 2xl:text-base">
|
||||
{item.percentChange}%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-4 px-4 2xl:mt-6">
|
||||
<div className="text-lg">Losers</div>
|
||||
<div className="mt-4 grid grid-cols-2 grid-rows-5 gap-x-2 gap-y-4 2xl:gap-x-10 2xl:gap-y-6">
|
||||
{loserMovers.map((item) => (
|
||||
<div
|
||||
className="flex border-b border-neutral-400 pb-1 text-sm 2xl:text-base"
|
||||
key={item.symbol}
|
||||
>
|
||||
<div className="w-32 font-bold 2xl:w-24">{item.symbol}</div>
|
||||
<div className="text-right text-xs text-neutral-400 2xl:w-20 2xl:text-base">
|
||||
{item.stockPrice}
|
||||
</div>
|
||||
<div className="ml-2 w-20 rounded-lg bg-red-500 bg-opacity-90 text-center text-xs 2xl:ml-4 2xl:text-base">
|
||||
{item.percentChange}%
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</HomepageModule>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -175,91 +207,119 @@ export const MarketsModule = () => {
|
||||
};
|
||||
|
||||
return (
|
||||
<HomepageModule title="Markets">
|
||||
<div className="flex h-full items-center py-2 2xl:py-4">
|
||||
<div className="flex h-full max-w-[40%] grow flex-col justify-between px-2">
|
||||
{markets.map((marketItem) => (
|
||||
<div
|
||||
key={marketItem.symbol}
|
||||
className="rounded-md hover:cursor-pointer hover:bg-neutral-700"
|
||||
>
|
||||
<div className="flex items-center justify-between border-b border-neutral-700 py-1 pl-2">
|
||||
<div className="text-sm font-semibold 2xl:text-base">
|
||||
{marketItem.symbol}
|
||||
</div>
|
||||
<div className="flex justify-between space-x-4 pr-2 text-sm">
|
||||
<div className="w-12 text-right text-sm">
|
||||
{getLastPrice(marketItem.chart)}
|
||||
<Card className="flex flex-col">
|
||||
<CardHeader className="p-4">
|
||||
<CardTitle>Markets</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="p-4">
|
||||
<div className="flex h-full items-center">
|
||||
<div className="flex h-full grow flex-col justify-between px-2">
|
||||
{markets.map((marketItem) => (
|
||||
<div
|
||||
key={marketItem.symbol}
|
||||
className="rounded-md hover:cursor-pointer hover:bg-neutral-700"
|
||||
>
|
||||
<div className="flex items-center justify-between border-b border-neutral-700 py-1 pl-2">
|
||||
<div className="text-sm font-semibold 2xl:text-base">
|
||||
{marketItem.symbol}
|
||||
</div>
|
||||
<div
|
||||
className={cn(
|
||||
getPriceDifference(marketItem.chart, 1) > 0
|
||||
? "text-green-500"
|
||||
: "text-red-500",
|
||||
"w-10 text-right text-sm 2xl:w-12",
|
||||
)}
|
||||
>
|
||||
{getPriceDifference(marketItem.chart, 1)}
|
||||
<div className="flex justify-between space-x-4 pr-2 text-sm">
|
||||
<div className="w-12 text-right text-sm">
|
||||
{getLastPrice(marketItem.chart)}
|
||||
</div>
|
||||
<div
|
||||
className={cn(
|
||||
getPriceDifference(marketItem.chart, 1) > 0
|
||||
? "text-green-500"
|
||||
: "text-red-500",
|
||||
"w-10 text-right text-sm 2xl:w-12",
|
||||
)}
|
||||
>
|
||||
{getPriceDifference(marketItem.chart, 1)}
|
||||
</div>
|
||||
<Badge
|
||||
variant={
|
||||
getPercentDifference(marketItem.chart, 1) > 0
|
||||
? "positive"
|
||||
: "negative"
|
||||
}
|
||||
>
|
||||
<div>
|
||||
{getPercentDifference(marketItem.chart, 1) + "%"}
|
||||
</div>
|
||||
</Badge>
|
||||
</div>
|
||||
<Badge
|
||||
variant={
|
||||
getPercentDifference(marketItem.chart, 1) > 0
|
||||
? "positive"
|
||||
: "negative"
|
||||
}
|
||||
>
|
||||
<div>{getPercentDifference(marketItem.chart, 1) + "%"}</div>
|
||||
</Badge>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
<div className="relative h-full max-w-[60%] grow">
|
||||
<div className="absolute ml-4 mt-1">S&P 500</div>
|
||||
<Chart
|
||||
series={[sp500IndexLine, sma5Line]}
|
||||
colors={{
|
||||
backgroundColor: "transparent",
|
||||
textColor: "white",
|
||||
}}
|
||||
options={{
|
||||
grid: {
|
||||
horzLines: {
|
||||
visible: false,
|
||||
))}
|
||||
</div>
|
||||
<div className="relative h-full w-96 grow">
|
||||
<div className="absolute ml-4 mt-1">S&P 500</div>
|
||||
<Chart
|
||||
series={[sp500IndexLine, sma5Line]}
|
||||
colors={{
|
||||
backgroundColor: "transparent",
|
||||
textColor: "white",
|
||||
}}
|
||||
options={{
|
||||
grid: {
|
||||
horzLines: {
|
||||
visible: false,
|
||||
},
|
||||
vertLines: {
|
||||
visible: false,
|
||||
},
|
||||
},
|
||||
vertLines: {
|
||||
visible: false,
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</HomepageModule>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export const EarningsModule = () => {
|
||||
return (
|
||||
<HomepageModule title="Earnings">
|
||||
<CalendarSquares data={earningsCalendar} />
|
||||
</HomepageModule>
|
||||
<Card>
|
||||
<CardHeader className="p-4">
|
||||
<CardTitle>Earnings</CardTitle>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export const DocumentsModule = () => {
|
||||
return (
|
||||
<HomepageModule title="Documents">
|
||||
<TableNoHeader data={documentsList} columns={documentsColumns} />
|
||||
</HomepageModule>
|
||||
<Card className="flex flex-col">
|
||||
<CardHeader className="border-b border-neutral-700 p-4">
|
||||
<CardTitle>Forex and Bonds</CardTitle>
|
||||
</CardHeader>
|
||||
<ScrollArea>
|
||||
<CardContent className="h-full p-0">
|
||||
<TableNoHeader data={documentsList} columns={documentsColumns} />
|
||||
</CardContent>
|
||||
</ScrollArea>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export const IndicatorsModule = () => {
|
||||
return <HomepageModule title="Indicators"></HomepageModule>;
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader className="p-4">
|
||||
<CardTitle>Indicators</CardTitle>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
export const ForexAndBondsModule = () => {
|
||||
return <HomepageModule title="Forex and Bonds"></HomepageModule>;
|
||||
return (
|
||||
<Card>
|
||||
<CardHeader className="p-4">
|
||||
<CardTitle>Forex and Bonds</CardTitle>
|
||||
</CardHeader>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
"use client"
|
||||
|
||||
import * as React from "react"
|
||||
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
|
||||
const ScrollArea = React.forwardRef<
|
||||
React.ElementRef<typeof ScrollAreaPrimitive.Root>,
|
||||
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.Root>
|
||||
>(({ className, children, ...props }, ref) => (
|
||||
<ScrollAreaPrimitive.Root
|
||||
ref={ref}
|
||||
className={cn("relative overflow-hidden", className)}
|
||||
{...props}
|
||||
>
|
||||
<ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit]">
|
||||
{children}
|
||||
</ScrollAreaPrimitive.Viewport>
|
||||
<ScrollBar />
|
||||
<ScrollAreaPrimitive.Corner />
|
||||
</ScrollAreaPrimitive.Root>
|
||||
))
|
||||
ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName
|
||||
|
||||
const ScrollBar = React.forwardRef<
|
||||
React.ElementRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>,
|
||||
React.ComponentPropsWithoutRef<typeof ScrollAreaPrimitive.ScrollAreaScrollbar>
|
||||
>(({ className, orientation = "vertical", ...props }, ref) => (
|
||||
<ScrollAreaPrimitive.ScrollAreaScrollbar
|
||||
ref={ref}
|
||||
orientation={orientation}
|
||||
className={cn(
|
||||
"flex touch-none select-none transition-colors",
|
||||
orientation === "vertical" &&
|
||||
"h-full w-2.5 border-l border-l-transparent p-[1px]",
|
||||
orientation === "horizontal" &&
|
||||
"h-2.5 flex-col border-t border-t-transparent p-[1px]",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
<ScrollAreaPrimitive.ScrollAreaThumb className="relative flex-1 rounded-full bg-border" />
|
||||
</ScrollAreaPrimitive.ScrollAreaScrollbar>
|
||||
))
|
||||
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName
|
||||
|
||||
export { ScrollArea, ScrollBar }
|
||||
Reference in New Issue
Block a user