Hide SF display when no SFs owned

This commit is contained in:
nickofolas 2022-04-08 10:21:40 -05:00
parent 81f971b52e
commit a4bc793cf1

@ -65,12 +65,15 @@ export function SourceFilesElement(): React.ReactElement {
const [selectedSf, setSelectedSf] = useState<any>(sourceSfs[0]); const [selectedSf, setSelectedSf] = useState<any>(sourceSfs[0]);
if (sourceSfs.length === 0) {
return <></>;
}
return ( return (
<Box sx={{ width: "100%", mt: 1 }}> <Box sx={{ width: "100%", mt: 1 }}>
<Paper sx={{ p: 1 }}> <Paper sx={{ p: 1 }}>
<Typography variant="h5">Source Files</Typography> <Typography variant="h5">Source Files</Typography>
</Paper> </Paper>
{sourceSfs.length > 0 ? (
<Paper sx={{ display: "grid", gridTemplateColumns: "1fr 3fr" }}> <Paper sx={{ display: "grid", gridTemplateColumns: "1fr 3fr" }}>
<Box> <Box>
<List <List
@ -102,12 +105,7 @@ export function SourceFilesElement(): React.ReactElement {
const maxLevel = sfObj?.n === 12 ? "∞" : "3"; const maxLevel = sfObj?.n === 12 ? "∞" : "3";
return ( return (
<ListItemButton <ListItemButton key={i + 1} onClick={() => setSelectedSf(e)} selected={selectedSf === e} sx={{ py: 0 }}>
key={i + 1}
onClick={() => setSelectedSf(e)}
selected={selectedSf === e}
sx={{ py: 0 }}
>
<ListItemText <ListItemText
disableTypography disableTypography
primary={<Typography>{sfObj.name}</Typography>} primary={<Typography>{sfObj.name}</Typography>}
@ -155,9 +153,6 @@ export function SourceFilesElement(): React.ReactElement {
</Typography> </Typography>
</Box> </Box>
</Paper> </Paper>
) : (
<></>
)}
</Box> </Box>
); );
} }