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