mirror of
https://github.com/dylanbenzi/yellowbird.git
synced 2026-11-27 09:17:00 +00:00
i dont even remember tbh, some calendar thing i think
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
"@dnd-kit/core": "^6.1.0",
|
"@dnd-kit/core": "^6.1.0",
|
||||||
"@dnd-kit/sortable": "^8.0.0",
|
"@dnd-kit/sortable": "^8.0.0",
|
||||||
"@dnd-kit/utilities": "^3.2.2",
|
"@dnd-kit/utilities": "^3.2.2",
|
||||||
|
"@nivo/calendar": "^0.85.0",
|
||||||
"@nivo/line": "^0.84.0",
|
"@nivo/line": "^0.84.0",
|
||||||
"@nivo/treemap": "^0.84.0",
|
"@nivo/treemap": "^0.84.0",
|
||||||
"@radix-ui/react-slot": "^1.0.2",
|
"@radix-ui/react-slot": "^1.0.2",
|
||||||
|
|||||||
Generated
+114
@@ -14,6 +14,9 @@ dependencies:
|
|||||||
'@dnd-kit/utilities':
|
'@dnd-kit/utilities':
|
||||||
specifier: ^3.2.2
|
specifier: ^3.2.2
|
||||||
version: 3.2.2([email protected])
|
version: 3.2.2([email protected])
|
||||||
|
'@nivo/calendar':
|
||||||
|
specifier: ^0.85.0
|
||||||
|
version: 0.85.0([email protected])([email protected])
|
||||||
'@nivo/line':
|
'@nivo/line':
|
||||||
specifier: ^0.84.0
|
specifier: ^0.84.0
|
||||||
version: 0.84.0([email protected])([email protected])
|
version: 0.84.0([email protected])([email protected])
|
||||||
@@ -365,6 +368,26 @@ packages:
|
|||||||
- react-dom
|
- react-dom
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@nivo/[email protected]([email protected])([email protected]):
|
||||||
|
resolution: {integrity: sha512-O4FbFUvOQmFqCW2oDBI0NyX1xkmanz2CAtjNI/gh38DMSHtMFd8VVhGVfh4SO06dqbl9kCgaOcFrIIeY8Mm8pA==}
|
||||||
|
peerDependencies:
|
||||||
|
react: '>= 16.14.0 < 19.0.0'
|
||||||
|
dependencies:
|
||||||
|
'@nivo/core': 0.85.0([email protected])([email protected])
|
||||||
|
'@nivo/legends': 0.85.0([email protected])([email protected])
|
||||||
|
'@nivo/tooltip': 0.85.0([email protected])([email protected])
|
||||||
|
'@types/d3-scale': 3.3.5
|
||||||
|
'@types/d3-time': 1.1.4
|
||||||
|
'@types/d3-time-format': 3.0.4
|
||||||
|
d3-scale: 3.3.0
|
||||||
|
d3-time: 1.1.0
|
||||||
|
d3-time-format: 3.0.0
|
||||||
|
lodash: 4.17.21
|
||||||
|
react: 18.2.0
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- react-dom
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@nivo/[email protected]([email protected])([email protected]):
|
/@nivo/[email protected]([email protected])([email protected]):
|
||||||
resolution: {integrity: sha512-wNG1uYyDP5Owc1Pdkz0zesdZCrPAywmSssNzQ2Aju7nVs7Ru7iHNBIvOAGgyXTe2gcrIO9VSasXWR+jEYyxN2Q==}
|
resolution: {integrity: sha512-wNG1uYyDP5Owc1Pdkz0zesdZCrPAywmSssNzQ2Aju7nVs7Ru7iHNBIvOAGgyXTe2gcrIO9VSasXWR+jEYyxN2Q==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -385,6 +408,26 @@ packages:
|
|||||||
- react-dom
|
- react-dom
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@nivo/[email protected]([email protected])([email protected]):
|
||||||
|
resolution: {integrity: sha512-epAeKYof9Xol1SngeHZztK5kt4BGvRdAAPgwrMBVZXHXCwBJAdrmtO6KzwxZ1xpG9qSmPotk4HCvFE1CzecRzQ==}
|
||||||
|
peerDependencies:
|
||||||
|
react: '>= 16.14.0 < 19.0.0'
|
||||||
|
dependencies:
|
||||||
|
'@nivo/core': 0.85.0([email protected])([email protected])
|
||||||
|
'@types/d3-color': 3.1.3
|
||||||
|
'@types/d3-scale': 3.3.5
|
||||||
|
'@types/d3-scale-chromatic': 3.0.3
|
||||||
|
'@types/prop-types': 15.7.11
|
||||||
|
d3-color: 3.1.0
|
||||||
|
d3-scale: 3.3.0
|
||||||
|
d3-scale-chromatic: 3.0.0
|
||||||
|
lodash: 4.17.21
|
||||||
|
prop-types: 15.8.1
|
||||||
|
react: 18.2.0
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- react-dom
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@nivo/[email protected]([email protected])([email protected])([email protected]):
|
/@nivo/[email protected]([email protected])([email protected])([email protected]):
|
||||||
resolution: {integrity: sha512-HyQM4x4B7d4X9+xLPKkPxqIxhSDzbJUywGTDWHWx1daeX9VP8O+MqkTBsNsoB+tjxrbKrRJ0+ceS2w89JB+qrA==}
|
resolution: {integrity: sha512-HyQM4x4B7d4X9+xLPKkPxqIxhSDzbJUywGTDWHWx1daeX9VP8O+MqkTBsNsoB+tjxrbKrRJ0+ceS2w89JB+qrA==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -409,6 +452,29 @@ packages:
|
|||||||
- react-dom
|
- react-dom
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@nivo/[email protected]([email protected])([email protected]):
|
||||||
|
resolution: {integrity: sha512-eHchfuvHdwXraYllUhO1YZMy3XQMVvMaQjfGzCnVo5A0P2075yN9I7uA0Ir6M20XlSuwVSP+58L3JDf9SSbCrA==}
|
||||||
|
peerDependencies:
|
||||||
|
react: '>= 16.14.0 < 19.0.0'
|
||||||
|
dependencies:
|
||||||
|
'@nivo/recompose': 0.85.0([email protected])
|
||||||
|
'@nivo/tooltip': 0.85.0([email protected])([email protected])
|
||||||
|
'@react-spring/web': 9.7.3([email protected])([email protected])
|
||||||
|
'@types/d3-shape': 2.1.7
|
||||||
|
d3-color: 3.1.0
|
||||||
|
d3-format: 1.4.5
|
||||||
|
d3-interpolate: 3.0.1
|
||||||
|
d3-scale: 3.3.0
|
||||||
|
d3-scale-chromatic: 3.0.0
|
||||||
|
d3-shape: 1.3.7
|
||||||
|
d3-time-format: 3.0.0
|
||||||
|
lodash: 4.17.21
|
||||||
|
prop-types: 15.8.1
|
||||||
|
react: 18.2.0
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- react-dom
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@nivo/[email protected]([email protected])([email protected]):
|
/@nivo/[email protected]([email protected])([email protected]):
|
||||||
resolution: {integrity: sha512-o0s1cXoIH6Km9A2zoKB8Ey99Oc1w5nymz0j8s7hR2B0EHo5HgVbYjSs2sZD7NSwLt3QM57Nzxw9VzJ+sqfV30Q==}
|
resolution: {integrity: sha512-o0s1cXoIH6Km9A2zoKB8Ey99Oc1w5nymz0j8s7hR2B0EHo5HgVbYjSs2sZD7NSwLt3QM57Nzxw9VzJ+sqfV30Q==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -425,6 +491,22 @@ packages:
|
|||||||
- react-dom
|
- react-dom
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@nivo/[email protected]([email protected])([email protected]):
|
||||||
|
resolution: {integrity: sha512-TJMbXIxQeucNv9qLGA04Mo+UAFrz5BYWLfKDSEs4E8/LjHCeltkBu/AgUnlv9mWiYomAFLkVugjbNY/NYw9qtw==}
|
||||||
|
peerDependencies:
|
||||||
|
react: '>= 16.14.0 < 19.0.0'
|
||||||
|
dependencies:
|
||||||
|
'@nivo/colors': 0.85.0([email protected])([email protected])
|
||||||
|
'@nivo/core': 0.85.0([email protected])([email protected])
|
||||||
|
'@types/d3-scale': 3.3.5
|
||||||
|
'@types/prop-types': 15.7.11
|
||||||
|
d3-scale: 3.3.0
|
||||||
|
prop-types: 15.8.1
|
||||||
|
react: 18.2.0
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- react-dom
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@nivo/[email protected]([email protected])([email protected]):
|
/@nivo/[email protected]([email protected])([email protected]):
|
||||||
resolution: {integrity: sha512-QE0JwZ7oIwMnsDQeSr1Q6iyqD2UBVLtBMdfMsJLhnlI3V62VkY98/L3o8M7+7Wy/V2UiEMJ+14C2qhXd+XLgsA==}
|
resolution: {integrity: sha512-QE0JwZ7oIwMnsDQeSr1Q6iyqD2UBVLtBMdfMsJLhnlI3V62VkY98/L3o8M7+7Wy/V2UiEMJ+14C2qhXd+XLgsA==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -458,6 +540,18 @@ packages:
|
|||||||
react-lifecycles-compat: 3.0.4
|
react-lifecycles-compat: 3.0.4
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@nivo/[email protected]([email protected]):
|
||||||
|
resolution: {integrity: sha512-UptKwVJ9mlGQKn4a/JiORWbZgo6hT+qEpKBKIs9BUHRIW0a4T0BIE2PA+uDMPpNxzNFgOCu/y8iM5Rhs6QmrmA==}
|
||||||
|
peerDependencies:
|
||||||
|
react: '>= 16.14.0 < 19.0.0'
|
||||||
|
dependencies:
|
||||||
|
'@types/prop-types': 15.7.11
|
||||||
|
'@types/react-lifecycles-compat': 3.0.4
|
||||||
|
prop-types: 15.8.1
|
||||||
|
react: 18.2.0
|
||||||
|
react-lifecycles-compat: 3.0.4
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@nivo/[email protected]:
|
/@nivo/[email protected]:
|
||||||
resolution: {integrity: sha512-Cayo9jFMpoF7Ha7eqOAucHLUG6zZLGpxiAtyZ/vTUCkRZPHmd/YMvrm8E6OyQCTBVf+aRtOKk9tQnMv8E9fWiw==}
|
resolution: {integrity: sha512-Cayo9jFMpoF7Ha7eqOAucHLUG6zZLGpxiAtyZ/vTUCkRZPHmd/YMvrm8E6OyQCTBVf+aRtOKk9tQnMv8E9fWiw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -481,6 +575,18 @@ packages:
|
|||||||
- react-dom
|
- react-dom
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@nivo/[email protected]([email protected])([email protected]):
|
||||||
|
resolution: {integrity: sha512-o3nOwOtBvC1GuHZf7P74j7XAyg/0XgDme2qt/LVopQTXqqhUpozsTPLjixakAIiebDAU/e/VFnSeqeDRn1lj0A==}
|
||||||
|
peerDependencies:
|
||||||
|
react: '>= 16.14.0 < 19.0.0'
|
||||||
|
dependencies:
|
||||||
|
'@nivo/core': 0.85.0([email protected])([email protected])
|
||||||
|
'@react-spring/web': 9.7.3([email protected])([email protected])
|
||||||
|
react: 18.2.0
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- react-dom
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@nivo/[email protected]([email protected])([email protected])([email protected]):
|
/@nivo/[email protected]([email protected])([email protected])([email protected]):
|
||||||
resolution: {integrity: sha512-B9WrrqofDarsNxYb/sOBDTA0/N852Fq4A7TsiPuSvyq+pDaBR0m7tru3obbcElwkajU5W9aWLh/1afrnISsY7g==}
|
resolution: {integrity: sha512-B9WrrqofDarsNxYb/sOBDTA0/N852Fq4A7TsiPuSvyq+pDaBR0m7tru3obbcElwkajU5W9aWLh/1afrnISsY7g==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -647,6 +753,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-tbaFGDmJWHqnenvk3QGSvD3RVwr631BjKRD7Sc7VLRgrdX5mk5hTyoeBL6rXZaeoXzmZwIl1D2HPogEdt1rHBg==}
|
resolution: {integrity: sha512-tbaFGDmJWHqnenvk3QGSvD3RVwr631BjKRD7Sc7VLRgrdX5mk5hTyoeBL6rXZaeoXzmZwIl1D2HPogEdt1rHBg==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@types/[email protected]:
|
||||||
|
resolution: {integrity: sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@types/[email protected]:
|
/@types/[email protected]:
|
||||||
resolution: {integrity: sha512-GEQuDXVKQvHulQ+ecKyCubOmVjXrifAj7VR26rWVAER/IbWemaT/Tmo84ESiTtoDghg5ILdMZH7pYXQEt/Vu9A==}
|
resolution: {integrity: sha512-GEQuDXVKQvHulQ+ecKyCubOmVjXrifAj7VR26rWVAER/IbWemaT/Tmo84ESiTtoDghg5ILdMZH7pYXQEt/Vu9A==}
|
||||||
dev: false
|
dev: false
|
||||||
@@ -667,6 +777,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-OUgfg6wmoZVhs0/pV8HZhsMw7pYJnS6smfNK2S5ogMaPHfDUaTMu7JA5ssZrRupwf2vWI+haPAuUpsz+M1BOKA==}
|
resolution: {integrity: sha512-OUgfg6wmoZVhs0/pV8HZhsMw7pYJnS6smfNK2S5ogMaPHfDUaTMu7JA5ssZrRupwf2vWI+haPAuUpsz+M1BOKA==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/@types/[email protected]:
|
||||||
|
resolution: {integrity: sha512-laXM4+1o5ImZv3RpFAsTRn3TEkzqkytiOY0Dz0sq5cnd1dtNlk6sHLon4OvqaiJb28T0S/TdsBI3Sjsy+keJrw==}
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@types/[email protected]:
|
/@types/[email protected]:
|
||||||
resolution: {integrity: sha512-YOpKj0kIEusRf7ofeJcSZQsvKbnTwpe1DUF+P2qsotqG53kEsjm7EzzliqQxMkAWdkZcHrg5rRhB4JiDOQPX+A==}
|
resolution: {integrity: sha512-YOpKj0kIEusRf7ofeJcSZQsvKbnTwpe1DUF+P2qsotqG53kEsjm7EzzliqQxMkAWdkZcHrg5rRhB4JiDOQPX+A==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
@@ -942,3 +942,41 @@ export const markets = [
|
|||||||
chart: seriesThree,
|
chart: seriesThree,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const earningsCalendar = [
|
||||||
|
{ "value": 6, "day": "2024-03-07" },
|
||||||
|
{ "value": 4, "day": "2024-03-08" },
|
||||||
|
{ "value": 10, "day": "2024-03-09" },
|
||||||
|
{ "value": 8, "day": "2024-03-10" },
|
||||||
|
{ "value": 1, "day": "2024-03-11" },
|
||||||
|
{ "value": 0, "day": "2024-03-12" },
|
||||||
|
{ "value": 10, "day": "2024-03-13" },
|
||||||
|
{ "value": 9, "day": "2024-03-14" },
|
||||||
|
{ "value": 5, "day": "2024-03-15" },
|
||||||
|
{ "value": 6, "day": "2024-03-16" },
|
||||||
|
{ "value": 10, "day": "2024-03-17" },
|
||||||
|
{ "value": 1, "day": "2024-03-18" },
|
||||||
|
{ "value": 10, "day": "2024-03-19" },
|
||||||
|
{ "value": 2, "day": "2024-03-20" },
|
||||||
|
{ "value": 2, "day": "2024-03-21" },
|
||||||
|
{ "value": 4, "day": "2024-03-22" },
|
||||||
|
{ "value": 9, "day": "2024-03-23" },
|
||||||
|
{ "value": 10, "day": "2024-03-24" },
|
||||||
|
{ "value": 0, "day": "2024-03-25" },
|
||||||
|
{ "value": 10, "day": "2024-03-26" },
|
||||||
|
{ "value": 9, "day": "2024-03-27" },
|
||||||
|
{ "value": 2, "day": "2024-03-28" },
|
||||||
|
{ "value": 4, "day": "2024-03-29" },
|
||||||
|
{ "value": 3, "day": "2024-03-30" },
|
||||||
|
{ "value": 7, "day": "2024-03-31" },
|
||||||
|
{ "value": 1, "day": "2024-04-01" },
|
||||||
|
{ "value": 6, "day": "2024-04-02" },
|
||||||
|
{ "value": 5, "day": "2024-04-03" },
|
||||||
|
{ "value": 6, "day": "2024-04-04" },
|
||||||
|
{ "value": 6, "day": "2024-04-05" },
|
||||||
|
{ "value": 7, "day": "2024-04-06" },
|
||||||
|
{ "value": 7, "day": "2024-04-07" },
|
||||||
|
{ "value": 2, "day": "2024-04-08" },
|
||||||
|
{ "value": 7, "day": "2024-04-09" },
|
||||||
|
{ "value": 1, "day": "2024-04-10" },
|
||||||
|
];
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
import React from "react";
|
||||||
|
import { ResponsiveTimeRange } from "@nivo/calendar";
|
||||||
|
|
||||||
|
const CalendarSquares = ({ data }: any) => {
|
||||||
|
const fromDate = new Date();
|
||||||
|
const toDate = fromDate.getDate() + 30;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ResponsiveTimeRange
|
||||||
|
data={data}
|
||||||
|
// from={fromDate.toLocaleString("en-us")}
|
||||||
|
// to={toDate.toLocaleDateString("en-us")}
|
||||||
|
from="2024-03-07"
|
||||||
|
to="2024-04-11"
|
||||||
|
emptyColor="#171717"
|
||||||
|
colors={["#61cdbb", "#97e3d5", "#e8c1a0", "#f47560"]}
|
||||||
|
margin={{ top: -70 }}
|
||||||
|
direction="vertical"
|
||||||
|
square={false}
|
||||||
|
firstWeekday="thursday"
|
||||||
|
weekdayTicks={[]}
|
||||||
|
tooltip={undefined}
|
||||||
|
// monthLegendOffset={0}
|
||||||
|
weekdayLegendOffset={0}
|
||||||
|
dayBorderWidth={1}
|
||||||
|
dayBorderColor="#ffffff"
|
||||||
|
// legends={[
|
||||||
|
// {
|
||||||
|
// anchor: "bottom-right",
|
||||||
|
// direction: "row",
|
||||||
|
// justify: false,
|
||||||
|
// itemCount: 4,
|
||||||
|
// itemWidth: 42,
|
||||||
|
// itemHeight: 36,
|
||||||
|
// itemsSpacing: 14,
|
||||||
|
// itemDirection: "right-to-left",
|
||||||
|
// translateX: -60,
|
||||||
|
// translateY: -60,
|
||||||
|
// symbolSize: 20,
|
||||||
|
// },
|
||||||
|
// ]}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default CalendarSquares;
|
||||||
@@ -6,6 +6,7 @@ import {
|
|||||||
winnerMovers,
|
winnerMovers,
|
||||||
loserMovers,
|
loserMovers,
|
||||||
markets,
|
markets,
|
||||||
|
earningsCalendar,
|
||||||
} from "@/app/MockData/MockData";
|
} from "@/app/MockData/MockData";
|
||||||
import HomepageModule from "./HomepageModuleCard";
|
import HomepageModule from "./HomepageModuleCard";
|
||||||
import PortfolioChart, {
|
import PortfolioChart, {
|
||||||
@@ -24,11 +25,22 @@ import {
|
|||||||
LineType,
|
LineType,
|
||||||
WhitespaceData,
|
WhitespaceData,
|
||||||
} from "lightweight-charts";
|
} from "lightweight-charts";
|
||||||
import { globalColors, smaFunc } from "@/lib/utils";
|
import {
|
||||||
|
cn,
|
||||||
|
getIntervalPrice,
|
||||||
|
getLastPrice,
|
||||||
|
getPercentDifference,
|
||||||
|
getPriceDifference,
|
||||||
|
globalColors,
|
||||||
|
smaFunc,
|
||||||
|
} from "@/lib/utils";
|
||||||
import { seriesOne } from "@/app/MockData/seriesOne";
|
import { seriesOne } from "@/app/MockData/seriesOne";
|
||||||
import { seriesThree } from "@/app/MockData/seriesThree";
|
import { seriesThree } from "@/app/MockData/seriesThree";
|
||||||
import { seriesFive } from "@/app/MockData/seriesFive";
|
import { seriesFive } from "@/app/MockData/seriesFive";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import { Badge } from "../ui/badge";
|
||||||
|
import { ResponsiveTimeRange } from "@nivo/calendar";
|
||||||
|
import CalendarSquares from "../charts/CalendarSquares";
|
||||||
|
|
||||||
export const PortfolioModule = () => {
|
export const PortfolioModule = () => {
|
||||||
const portfolioLine: LineSeriesPartialOptionsWithData = {
|
const portfolioLine: LineSeriesPartialOptionsWithData = {
|
||||||
@@ -135,11 +147,16 @@ export const MoversModule = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const MarketsModule = () => {
|
export const MarketsModule = () => {
|
||||||
const [selectedMarket, setSelectedMarket] = useState("S&P 500");
|
const [selectedMarket, setSelectedMarket] = useState({
|
||||||
|
symbol: "S&P 500",
|
||||||
|
symbolName: "SPDR S&P 500 ETF Trust",
|
||||||
|
symbolUrl: "https://...",
|
||||||
|
chart: seriesOne,
|
||||||
|
});
|
||||||
|
|
||||||
const sp500IndexLine: LineSeriesPartialOptionsWithData = {
|
const sp500IndexLine: LineSeriesPartialOptionsWithData = {
|
||||||
type: "line",
|
type: "line",
|
||||||
data: seriesOne,
|
data: selectedMarket.chart,
|
||||||
color: "white",
|
color: "white",
|
||||||
lineType: LineType.Curved,
|
lineType: LineType.Curved,
|
||||||
priceLineVisible: false,
|
priceLineVisible: false,
|
||||||
@@ -147,61 +164,53 @@ export const MarketsModule = () => {
|
|||||||
|
|
||||||
const sma5Line: LineSeriesPartialOptionsWithData = {
|
const sma5Line: LineSeriesPartialOptionsWithData = {
|
||||||
type: "line",
|
type: "line",
|
||||||
data: smaFunc(seriesOne, 20),
|
data: smaFunc(selectedMarket.chart, 20),
|
||||||
color: globalColors.yellow,
|
color: globalColors.yellow,
|
||||||
lineType: LineType.Curved,
|
lineType: LineType.Curved,
|
||||||
priceLineVisible: false,
|
priceLineVisible: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
// const getPrice = (data: LineData[], dataPoint: number) => {
|
|
||||||
// const price = data.at(dataPoint)?.value as number;
|
|
||||||
|
|
||||||
// return price;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const getPriceDifference = (data: LineData[], interval: number) => {
|
|
||||||
// const lastPrice = getPrice(data, -1) as number;
|
|
||||||
// const intervalPrice = getPrice(data, -(interval + 1)) as number;
|
|
||||||
|
|
||||||
// const priceDifference = (lastPrice - intervalPrice).toFixed(2);
|
|
||||||
|
|
||||||
// return priceDifference;
|
|
||||||
// };
|
|
||||||
|
|
||||||
// const getPercentDifference = (data: LineData[], interval: number) => {
|
|
||||||
// const priceDifference = getPriceDifference(data, interval);
|
|
||||||
// const intervalPrice = getPrice(data, interval);
|
|
||||||
|
|
||||||
// const percentDifference = (
|
|
||||||
// (parseFloat(priceDifference) / intervalPrice) *
|
|
||||||
// 100
|
|
||||||
// ).toFixed(2);
|
|
||||||
|
|
||||||
// return percentDifference;
|
|
||||||
// };
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<HomepageModule title="Markets">
|
<HomepageModule title="Markets">
|
||||||
<div className="flex h-full">
|
<div className="flex h-full items-center py-4">
|
||||||
<div className="w-2/5 p-4 pt-3">
|
<div className="flex flex-col justify-between w-2/5 h-full px-2">
|
||||||
{markets.map((marketItem) => (
|
{markets.map((marketItem) => (
|
||||||
<div
|
<div
|
||||||
key={marketItem.symbol}
|
key={marketItem.symbol}
|
||||||
className="py-[5px] my-1 rounded-lg hover:bg-neutral-700"
|
className="rounded-lg hover:bg-neutral-700 hover:cursor-pointer"
|
||||||
>
|
>
|
||||||
<div className="flex items-center justify-between pl-2 border-b border-neutral-700">
|
<div className="flex items-center pl-2 py-1 justify-between border-b border-neutral-700">
|
||||||
{marketItem.symbol}
|
<div className="font-semibold">{marketItem.symbol}</div>
|
||||||
<div className="flex justify-between space-x-6 text-sm pr-2">
|
<div className="flex justify-between space-x-4 text-sm pr-2">
|
||||||
<div></div>
|
<div className="w-12 text-right">
|
||||||
<div></div>
|
{getLastPrice(marketItem.chart)}
|
||||||
<div></div>
|
</div>
|
||||||
|
<div
|
||||||
|
className={cn(
|
||||||
|
getPriceDifference(marketItem.chart, 1) > 0
|
||||||
|
? "text-green-500"
|
||||||
|
: "text-red-500",
|
||||||
|
"w-12 text-right"
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{getPriceDifference(marketItem.chart, 1)}
|
||||||
|
</div>
|
||||||
|
<Badge
|
||||||
|
variant={
|
||||||
|
getPercentDifference(marketItem.chart, 1) > 0
|
||||||
|
? "positive"
|
||||||
|
: "negative"
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<div>{getPercentDifference(marketItem.chart, 1) + "%"}</div>
|
||||||
|
</Badge>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<div className="h-full w-3/5 relative">
|
<div className="h-full w-3/5 relative">
|
||||||
<div className="absolute ml-4">S&P 500</div>
|
<div className="absolute ml-4 mt-1">S&P 500</div>
|
||||||
<Chart
|
<Chart
|
||||||
series={[sp500IndexLine, sma5Line]}
|
series={[sp500IndexLine, sma5Line]}
|
||||||
colors={{
|
colors={{
|
||||||
@@ -226,7 +235,11 @@ export const MarketsModule = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const EarningsModule = () => {
|
export const EarningsModule = () => {
|
||||||
return <HomepageModule title="Earnings"></HomepageModule>;
|
return (
|
||||||
|
<HomepageModule title="Earnings">
|
||||||
|
<CalendarSquares data={earningsCalendar} />
|
||||||
|
</HomepageModule>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DocumentsModule = () => {
|
export const DocumentsModule = () => {
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import * as React from "react";
|
||||||
|
import { cva, type VariantProps } from "class-variance-authority";
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils";
|
||||||
|
|
||||||
|
const badgeVariants = cva(
|
||||||
|
"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
|
||||||
|
{
|
||||||
|
variants: {
|
||||||
|
variant: {
|
||||||
|
default:
|
||||||
|
"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
||||||
|
secondary:
|
||||||
|
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
||||||
|
destructive:
|
||||||
|
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
|
||||||
|
outline: "text-foreground",
|
||||||
|
positive: "border-transparent bg-green-600 w-14 rounded-md",
|
||||||
|
negative: "border-transparent bg-red-600 w-14 rounded-md",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
defaultVariants: {
|
||||||
|
variant: "default",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
export interface BadgeProps
|
||||||
|
extends React.HTMLAttributes<HTMLDivElement>,
|
||||||
|
VariantProps<typeof badgeVariants> {}
|
||||||
|
|
||||||
|
function Badge({ className, variant, ...props }: BadgeProps) {
|
||||||
|
return (
|
||||||
|
<div className={cn(badgeVariants({ variant }), className)} {...props} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export { Badge, badgeVariants };
|
||||||
@@ -28,6 +28,49 @@ export const smaFunc = (
|
|||||||
return smaArray;
|
return smaArray;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const getLastPrice = (data: LineData[]) => {
|
||||||
|
const lastPrice = data.at(-1)?.value;
|
||||||
|
|
||||||
|
if (lastPrice === undefined) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
const lastPriceToDecimal = parseFloat(lastPrice?.toFixed(2));
|
||||||
|
return lastPriceToDecimal;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getIntervalPrice = (data: LineData[], interval: number) => {
|
||||||
|
const intervalPrice = data.at(-interval - 1)?.value;
|
||||||
|
|
||||||
|
if (intervalPrice === undefined) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
const intervalPriceToDecimal = parseFloat(intervalPrice?.toFixed(2));
|
||||||
|
return intervalPriceToDecimal;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getPriceDifference = (data: LineData[], interval: number) => {
|
||||||
|
const lastPrice = getLastPrice(data);
|
||||||
|
const intervalPrice = getIntervalPrice(data, interval);
|
||||||
|
|
||||||
|
const priceDifference = lastPrice - intervalPrice;
|
||||||
|
const priceDifferenceToDecimal = parseFloat(priceDifference.toFixed(2));
|
||||||
|
|
||||||
|
return priceDifferenceToDecimal;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getPercentDifference = (data: LineData[], interval: number) => {
|
||||||
|
const lastPrice = getLastPrice(data);
|
||||||
|
const intervalPrice = getIntervalPrice(data, interval);
|
||||||
|
|
||||||
|
const priceDifference = lastPrice - intervalPrice;
|
||||||
|
const percentDifference = (priceDifference / intervalPrice) * 100;
|
||||||
|
const percentDifferenceToDecimal = parseFloat(percentDifference.toFixed(2));
|
||||||
|
|
||||||
|
return percentDifferenceToDecimal;
|
||||||
|
};
|
||||||
|
|
||||||
export const globalColors = {
|
export const globalColors = {
|
||||||
yellow: "#FACC15",
|
yellow: "#FACC15",
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user