Skip to content

Commit 8aad16a

Browse files
committed
feat: update existing pages with improved theme support and white backgrounds
1 parent 4a2e96b commit 8aad16a

File tree

4 files changed

+1539
-873
lines changed

4 files changed

+1539
-873
lines changed

src/pages/Dashboard.jsx

Lines changed: 57 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@ import React, { useState, useEffect } from 'react';
22
import { motion } from 'framer-motion';
33
import { AreaChart, Card, Title, Badge, TabGroup, TabList, Tab } from '@tremor/react';
44
import { HiTrendingUp, HiTrendingDown, HiCurrencyDollar, HiChartPie, HiClock } from 'react-icons/hi';
5-
import axios from 'axios';
65
import PortfolioAnalytics from '../components/dashboard/PortfolioAnalytics';
76
import StockDetail from '../components/dashboard/StockDetail';
7+
import api from '../services/api';
88

9-
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL || 'https://portfolio-tracker-backend-y7ne.onrender.com/api';
109

11-
// Create axios instance with base URL
12-
const api = axios.create({
13-
baseURL: API_BASE_URL,
14-
timeout: 10000
15-
});
1610

1711
const containerVariants = {
1812
hidden: { opacity: 0 },
@@ -128,7 +122,7 @@ export default function Dashboard({ theme: propTheme }) {
128122

129123
const fetchStocks = async () => {
130124
try {
131-
console.log('Fetching stocks from:', API_BASE_URL);
125+
console.log('Fetching stocks from API');
132126
const response = await api.get('/stocks');
133127
console.log('Stocks fetched successfully:', response.data);
134128
setStocks(response.data);
@@ -481,19 +475,67 @@ export default function Dashboard({ theme: propTheme }) {
481475
<div className="flex justify-between items-center mb-4">
482476
<TabGroup
483477
defaultIndex={1}
484-
className="mb-4"
478+
className="mb-4 [&>div]:border-none"
485479
onIndexChange={(index) => {
486480
const periods = ['1D', '1W', '1M', '3M', '1Y', 'ALL'];
487481
setSelectedPeriod(periods[index]);
488482
}}
489483
>
490484
<TabList className={theme === 'dark' ? 'text-white' : ''}>
491-
<Tab className={theme === 'dark' ? 'text-white hover:text-blue-400' : ''}>1D</Tab>
492-
<Tab className={theme === 'dark' ? 'text-white hover:text-blue-400' : ''}>1W</Tab>
493-
<Tab className={theme === 'dark' ? 'text-white hover:text-blue-400' : ''}>1M</Tab>
494-
<Tab className={theme === 'dark' ? 'text-white hover:text-blue-400' : ''}>3M</Tab>
495-
<Tab className={theme === 'dark' ? 'text-white hover:text-blue-400' : ''}>1Y</Tab>
496-
<Tab className={theme === 'dark' ? 'text-white hover:text-blue-400' : ''}>ALL</Tab>
485+
<Tab className={`px-3 py-1 text-sm font-medium transition-all ${
486+
selectedPeriod === '1D'
487+
? theme === 'dark'
488+
? 'text-blue-400 font-semibold'
489+
: 'text-blue-600 font-semibold'
490+
: theme === 'dark'
491+
? 'text-gray-300 hover:text-white'
492+
: 'text-gray-600 hover:text-gray-900'
493+
}`}>1D</Tab>
494+
<Tab className={`px-3 py-1 text-sm font-medium transition-all ${
495+
selectedPeriod === '1W'
496+
? theme === 'dark'
497+
? 'text-blue-400 font-semibold'
498+
: 'text-blue-600 font-semibold'
499+
: theme === 'dark'
500+
? 'text-gray-300 hover:text-white'
501+
: 'text-gray-600 hover:text-gray-900'
502+
}`}>1W</Tab>
503+
<Tab className={`px-3 py-1 text-sm font-medium transition-all ${
504+
selectedPeriod === '1M'
505+
? theme === 'dark'
506+
? 'text-blue-400 font-semibold'
507+
: 'text-blue-600 font-semibold'
508+
: theme === 'dark'
509+
? 'text-gray-300 hover:text-white'
510+
: 'text-gray-600 hover:text-gray-900'
511+
}`}>1M</Tab>
512+
<Tab className={`px-3 py-1 text-sm font-medium transition-all ${
513+
selectedPeriod === '3M'
514+
? theme === 'dark'
515+
? 'text-blue-400 font-semibold'
516+
: 'text-blue-600 font-semibold'
517+
: theme === 'dark'
518+
? 'text-gray-300 hover:text-white'
519+
: 'text-gray-600 hover:text-gray-900'
520+
}`}>3M</Tab>
521+
<Tab className={`px-3 py-1 text-sm font-medium transition-all ${
522+
selectedPeriod === '1Y'
523+
? theme === 'dark'
524+
? 'text-blue-400 font-semibold'
525+
: 'text-blue-600 font-semibold'
526+
: theme === 'dark'
527+
? 'text-gray-300 hover:text-white'
528+
: 'text-gray-600 hover:text-gray-900'
529+
}`}>1Y</Tab>
530+
<Tab className={`px-3 py-1 text-sm font-medium transition-all ${
531+
selectedPeriod === 'ALL'
532+
? theme === 'dark'
533+
? 'text-blue-400 font-semibold'
534+
: 'text-blue-600 font-semibold'
535+
: theme === 'dark'
536+
? 'text-gray-300 hover:text-white'
537+
: 'text-gray-600 hover:text-gray-900'
538+
}`}>ALL</Tab>
497539
</TabList>
498540
</TabGroup>
499541
<div className={`flex flex-col items-end ${

0 commit comments

Comments
 (0)