updated home modules

This commit is contained in:
2024-06-14 23:59:36 -04:00
parent 5ac547f25c
commit 60e3bf7432
6 changed files with 279 additions and 132 deletions
+1
View File
@@ -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",
+38
View File
@@ -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:
+1 -1
View File
@@ -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>
+1 -1
View File
@@ -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) => (
+83 -23
View File
@@ -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,7 +70,11 @@ export const PortfolioModule = () => {
};
return (
<HomepageModule title="Portfolio">
<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>
@@ -77,35 +89,54 @@ export const PortfolioModule = () => {
}}
/>
</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>
</HomepageModule>
</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">
<Card className="flex flex-col">
<CardHeader className="p-4">
<CardTitle>Market Heatmap</CardTitle>
</CardHeader>
<CardContent className=" h-full p-0">
<MarketHeatmap data={heatmapData} />
</HomepageModule>
</CardContent>
</Card>
);
};
export const MoversModule = () => {
return (
<HomepageModule title="Movers">
<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>
@@ -126,7 +157,7 @@ export const MoversModule = () => {
))}
</div>
</div>
<div className="mt-4 px-4 2xl:mt-6">
<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) => (
@@ -146,7 +177,8 @@ export const MoversModule = () => {
</div>
</div>
</div>
</HomepageModule>
</CardContent>
</Card>
);
};
@@ -175,9 +207,13 @@ 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">
<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}
@@ -208,14 +244,16 @@ export const MarketsModule = () => {
: "negative"
}
>
<div>{getPercentDifference(marketItem.chart, 1) + "%"}</div>
<div>
{getPercentDifference(marketItem.chart, 1) + "%"}
</div>
</Badge>
</div>
</div>
</div>
))}
</div>
<div className="relative h-full max-w-[60%] grow">
<div className="relative h-full w-96 grow">
<div className="absolute ml-4 mt-1">S&P 500</div>
<Chart
series={[sp500IndexLine, sma5Line]}
@@ -236,30 +274,52 @@ export const MarketsModule = () => {
/>
</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">
<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} />
</HomepageModule>
</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>
);
};
+48
View File
@@ -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 }