diff --git a/src/app/history/page.tsx b/src/app/history/page.tsx index 78b65e2..15fdb0b 100644 --- a/src/app/history/page.tsx +++ b/src/app/history/page.tsx @@ -1,17 +1,17 @@ 'use client'; import { useCachedReleaseData, useCachedReleaseSymbolData, useMyStockList } from '@/lib/socket'; -import { Dialog, DialogContent, DialogTitle, FormControl, Grid, ImageList, ImageListItem, InputLabel, LinearProgress, Link, MenuItem, Select, useMediaQuery, useTheme } from '@mui/material'; +import { Dialog, DialogContent, DialogTitle, FormControl, FormControlLabel, Grid, ImageList, ImageListItem, InputLabel, LinearProgress, Link, MenuItem, Select, Switch, useMediaQuery, useTheme } from '@mui/material'; import { useState } from 'react'; -import { IconButton} from '@mui/material'; +import { IconButton } from '@mui/material'; import CloseIcon from '@mui/icons-material/Close'; -const D1 = (props: { dt: string, mytickersSymbols: string[] }) => { - const { dt, mytickersSymbols } = props; +const D1 = (props: { dt: string, mytickersSymbols: string[], showAllSymbols: boolean }) => { + const { dt, mytickersSymbols, showAllSymbols } = props; const { cachedSummarySymbolsData } = useCachedReleaseSymbolData(dt); const theme = useTheme(); const matchesXs = useMediaQuery(theme.breakpoints.down("sm")); const matchesMd = useMediaQuery(theme.breakpoints.down("md")); const numberOfItemsToDisplay = matchesXs ? 2 : matchesMd ? 3 : 4; - const ts = cachedSummarySymbolsData.filter(r => mytickersSymbols.includes(r.name)); //make sure to load only those which are part of the watchlist. + const ts = cachedSummarySymbolsData.filter(r => showAllSymbols || mytickersSymbols.includes(r.name)); //make sure to load only those which are part of the watchlist. const [openDialog, setOpenDialog] = useState(false); const [selectedImage, setSelectedImage] = useState(''); @@ -28,7 +28,8 @@ const D1 = (props: { dt: string, mytickersSymbols: string[] }) => { {ts.map((item) => ( { // transform: 'scale(1.05)', // } - }} + }} loading="lazy" onClick={() => handleImageClick(`https://mztrading-data.deno.dev/images?dt=${dt}&s=${item.name}`)} /> @@ -62,6 +63,7 @@ const D1 = (props: { dt: string, mytickersSymbols: string[] }) => { export default function Page() { const { mytickers, loading } = useMyStockList(); + const [showAllSymbols, setShowAllSymbols] = useState(false); const { cachedSummaryData, isLoadingCachedSummaryData } = useCachedReleaseData(); const [dataMode, setDataMode] = useState(''); if (isLoadingCachedSummaryData || loading) return ; @@ -85,9 +87,12 @@ export default function Page() { } - Legacy Mode + + setShowAllSymbols(v)} />} label="Show all?" /> + + {/* Legacy Mode */} - + ); }