From fb5595d9fb42546ec0bfdc2776ba60c5428915f8 Mon Sep 17 00:00:00 2001 From: Ginza Hatemi Date: Tue, 16 Sep 2025 01:38:55 -0600 Subject: [PATCH 1/2] feat: Simplify HomePage layout and add BullishMarketCard component --- src/app/page.tsx | 9 -- .../HomepageComponents/BullishMarketCard.tsx | 112 ++++++++++++++++++ src/components/PostComponents/PostsList.tsx | 2 + 3 files changed, 114 insertions(+), 9 deletions(-) create mode 100644 src/components/HomepageComponents/BullishMarketCard.tsx diff --git a/src/app/page.tsx b/src/app/page.tsx index 66c94dd..5149103 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -2,17 +2,8 @@ import PostsList from "@/components/PostComponents/PostsList"; export default function HomePage() { return ( -
-
-
-
-

SentioPulse

-
-
-
-
); } diff --git a/src/components/HomepageComponents/BullishMarketCard.tsx b/src/components/HomepageComponents/BullishMarketCard.tsx new file mode 100644 index 0000000..1b02351 --- /dev/null +++ b/src/components/HomepageComponents/BullishMarketCard.tsx @@ -0,0 +1,112 @@ +import { + Card, + CardAction, + CardContent, + CardDescription, + CardFooter, + CardHeader, + CardTitle, +} from "../ui/card"; +import { FaRegChartBar } from "react-icons/fa"; +import { CiCalendar } from "react-icons/ci"; + +// Mock data representing overall sentiment and source aggregation +const MockData = { + totalSourceCount: 1247, // explicit total source count for display + sentimentCounts: { + BULLISH: 812, + NEUTRAL: 215, + BEARISH: 220, + }, + get sentimentPercentages(): { + BULLISH: number; + NEUTRAL: number; + BEARISH: number; + } { + const { BULLISH, NEUTRAL, BEARISH } = this.sentimentCounts; + const total = BULLISH + NEUTRAL + BEARISH; + return { + BULLISH: Math.round((BULLISH / total) * 100), + NEUTRAL: Math.round((NEUTRAL / total) * 100), + BEARISH: Math.round((BEARISH / total) * 100), + }; + }, + updatedAt: new Date('2025-09-16T09:55:00Z'), // Fixed date for SSR compatibility + get minutesAgo() { + return Math.floor((Date.now() - this.updatedAt.getTime()) / 60000); + }, +}; + +export default function BullishMarketCard() { + return ( +
+ + +
+ Bullish Market + + + + + + {MockData.totalSourceCount} Sources + + +
+ +
+ + {MockData.sentimentPercentages.BULLISH}% + + Bullish +
+
+ + {MockData.sentimentPercentages.NEUTRAL}% + + Neutral +
+
+ + {MockData.sentimentPercentages.BEARISH}% + + Bearish +
+
+
+ +
+
+ + + {MockData.sentimentPercentages.BULLISH}% + +
+
+ + + {MockData.sentimentPercentages.NEUTRAL}% + +
+
+ + + {MockData.sentimentPercentages.BEARISH}% + +
+
+
+ +
+ + + + + Updated {MockData.minutesAgo} minutes ago + +
+
+
+
+ ); +} diff --git a/src/components/PostComponents/PostsList.tsx b/src/components/PostComponents/PostsList.tsx index ec1e560..e1a321c 100644 --- a/src/components/PostComponents/PostsList.tsx +++ b/src/components/PostComponents/PostsList.tsx @@ -6,6 +6,7 @@ import { SortField, SortOrder } from "./PostSortSelect"; import Spinner from "./Spinner"; import type { Post } from "@prisma/client"; import PostGallery from "./PostGallery"; +import BullishMarketCard from "../HomepageComponents/BullishMarketCard"; export default function PostsList() { const [error, setError] = useState(null); @@ -101,6 +102,7 @@ export default function PostsList() { search={search} onSearchChange={onChangeHandler} /> + ); From 59e3b94f23b495d1fe26331c687ca2a4606db87c Mon Sep 17 00:00:00 2001 From: Ginza Hatemi Date: Tue, 16 Sep 2025 02:15:56 -0600 Subject: [PATCH 2/2] fix: Adjust layout of PostsGallery for better alignment --- .../HomepageComponents/BullishMarketCard.tsx | 35 ++++++++++++++++--- src/components/PostComponents/PostGallery.tsx | 2 +- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/components/HomepageComponents/BullishMarketCard.tsx b/src/components/HomepageComponents/BullishMarketCard.tsx index 1b02351..a04a68c 100644 --- a/src/components/HomepageComponents/BullishMarketCard.tsx +++ b/src/components/HomepageComponents/BullishMarketCard.tsx @@ -1,3 +1,4 @@ +"use client"; import { Card, CardAction, @@ -31,7 +32,7 @@ const MockData = { BEARISH: Math.round((BEARISH / total) * 100), }; }, - updatedAt: new Date('2025-09-16T09:55:00Z'), // Fixed date for SSR compatibility + updatedAt: new Date("2025-09-16T09:55:00Z"), // Fixed date for SSR compatibility get minutesAgo() { return Math.floor((Date.now() - this.updatedAt.getTime()) / 60000); }, @@ -40,7 +41,7 @@ const MockData = { export default function BullishMarketCard() { return (
- +
Bullish Market @@ -77,19 +78,43 @@ export default function BullishMarketCard() {
- + {MockData.sentimentPercentages.BULLISH}%
- + {MockData.sentimentPercentages.NEUTRAL}%
- + {MockData.sentimentPercentages.BEARISH}% diff --git a/src/components/PostComponents/PostGallery.tsx b/src/components/PostComponents/PostGallery.tsx index 13fc099..c75ab9a 100644 --- a/src/components/PostComponents/PostGallery.tsx +++ b/src/components/PostComponents/PostGallery.tsx @@ -191,7 +191,7 @@ export default function PostsGallery({ posts = mockPostsData, }: PostsGalleryProps) { return ( -
+
{posts.map((post, index) => ( ))}