From 57ea40937d1000349b5ebdd272f2003a69340f0c Mon Sep 17 00:00:00 2001 From: Ryana May Que Date: Fri, 6 Sep 2024 19:26:15 +0800 Subject: [PATCH] feat: recommendations, ui improvements --- src/components/CompanyProfileCard.tsx | 30 +++---- src/components/NavigationBar.tsx | 4 +- src/components/PeersWidget.tsx | 61 ++++++++++++++ src/components/RecommendationTrends.tsx | 106 ++++++++++++++++++++++++ src/components/SearchBar.tsx | 2 +- src/components/StockGraph.tsx | 28 +++++++ src/components/StockPrice.tsx | 74 +++++++++-------- src/components/Ticker.tsx | 10 ++- src/pages/api/peers.ts | 18 ++++ src/pages/api/recommendation-trends.ts | 18 ++++ src/pages/index.tsx | 45 ++++++---- src/utils/mockhistoricalData.ts | 16 ++++ src/utils/sparkle.ts | 6 ++ 13 files changed, 346 insertions(+), 72 deletions(-) create mode 100644 src/components/PeersWidget.tsx create mode 100644 src/components/RecommendationTrends.tsx create mode 100644 src/components/StockGraph.tsx create mode 100644 src/pages/api/peers.ts create mode 100644 src/pages/api/recommendation-trends.ts create mode 100644 src/utils/mockhistoricalData.ts diff --git a/src/components/CompanyProfileCard.tsx b/src/components/CompanyProfileCard.tsx index f72658d..77c25b1 100644 --- a/src/components/CompanyProfileCard.tsx +++ b/src/components/CompanyProfileCard.tsx @@ -1,4 +1,5 @@ import { useState, useEffect } from 'react'; +import PeersWidget from './PeersWidget'; interface CompanyProfileProps { ticker: string; @@ -51,29 +52,30 @@ const CompanyProfileCard = ({ ticker }: CompanyProfileProps) => { } return ( -
-

About this company

-
+
+

About this company

+
{`${profile.name}
-

{profile.name}

-

{profile.ticker} | {profile.finnhubIndustry}

+

{profile.name}

+

{profile.ticker} | {profile.finnhubIndustry}

-
+
-

Country: {profile.country}

-

Currency: {profile.currency}

-

Exchange: {profile.exchange}

-

Market Cap: ${profile.marketCapitalization.toFixed(2)}B

+

Country: {profile.country}

+

Currency: {profile.currency}

+

Exchange: {profile.exchange}

+

Market Cap: ${profile.marketCapitalization.toFixed(2)}B

-

IPO Date: {new Date(profile.ipo).toLocaleDateString()}

-

Outstanding Shares: {profile.shareOutstanding.toFixed(2)}M

-

Phone: {profile.phone}

-

Website: {profile.weburl}

+

IPO Date: {new Date(profile.ipo).toLocaleDateString()}

+

Outstanding Shares: {profile.shareOutstanding.toFixed(2)}M

+

Phone: {profile.phone}

+

Website: {profile.weburl}

+
); }; diff --git a/src/components/NavigationBar.tsx b/src/components/NavigationBar.tsx index da002cb..b71bdf4 100644 --- a/src/components/NavigationBar.tsx +++ b/src/components/NavigationBar.tsx @@ -24,8 +24,8 @@ const NavigationBar = ({ onSelectSymbol }: NavigationBarProps) => { } return ( -