Skip to content
This repository has been archived by the owner on Feb 22, 2025. It is now read-only.

Commit

Permalink
fix(ui): Use correct default value for timeframe
Browse files Browse the repository at this point in the history
  • Loading branch information
tklein1801 committed Nov 3, 2024
1 parent 13b36f7 commit 9789e37
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/routes/Stock.route.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {type TTimeframe} from '@budgetbuddyde/types';
import {type TStockPositionWithQuote} from '@budgetbuddyde/types';
import {ExpandMoreRounded, HelpOutlineRounded, TimelineRounded} from '@mui/icons-material';
import {
Expand Down Expand Up @@ -31,6 +30,7 @@ import {ContentGrid} from '@/components/Layout';
import {CircularProgress} from '@/components/Loading';
import {NoResults} from '@/components/NoResults';
import {TabPanel} from '@/components/TabPanel';
import {useTimeframe} from '@/components/Timeframe';
import {useAuthContext, withAuthLayout} from '@/features/Auth';
import {DeleteDialog} from '@/features/DeleteDialog';
import {useSnackbarContext} from '@/features/Snackbar';
Expand Down Expand Up @@ -73,11 +73,11 @@ interface IStockHandler {
export const Stock = () => {
const navigate = useNavigate();
const params = useParams<{isin: string}>();
const [timeframe, setTimeframe] = useTimeframe();
const {showSnackbar} = useSnackbarContext();
const {sessionUser} = useAuthContext();
const socket = getSocketIOClient();
const [keyword, setKeyword] = React.useState('');
const [chartTimeframe, setChartTimeframe] = React.useState<TTimeframe>('3m');
const [tabPane, setTabPane] = React.useState({
profit: 0,
financial: 0,
Expand All @@ -98,9 +98,9 @@ export const Stock = () => {
const {
loading: loadingQuotes,
quotes,
updateQuotes,
refresh: refreshQuotes,
} = useFetchStockQuotes([params.isin || ''], 'langschwarz', chartTimeframe);
updateQuotes,
} = useFetchStockQuotes([params.isin || ''], 'langschwarz', timeframe);
const {
isLoading: loadingStockPositions,
data: stockPositions,
Expand Down Expand Up @@ -248,7 +248,7 @@ export const Stock = () => {

React.useEffect(() => {
refreshQuotes();
}, [chartTimeframe]);
}, [timeframe]);

React.useEffect(() => {
if (!params.isin || params.isin.length !== 12) return;
Expand All @@ -273,7 +273,7 @@ export const Stock = () => {
<PriceChart
company={{name: stockDetails?.asset.name ?? ''}}
data={preparedChartData}
onTimeframeChange={setChartTimeframe}
onTimeframeChange={setTimeframe}
/>
) : (
<NoResults icon={<TimelineRounded />} text="No quotes found" />
Expand Down

0 comments on commit 9789e37

Please sign in to comment.