-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: show info when graph is empty
- Loading branch information
Showing
2 changed files
with
22 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
import { Alert, Box, Grid } from '@mui/material' | ||
import { useAppStore } from '../../stores' | ||
import shallow from 'zustand/shallow' | ||
import { useAppStore, useNodeStore } from '../../stores' | ||
import Profile from './Profile' | ||
|
||
export const NodeDetails = () => { | ||
const selectedNodeId = useAppStore((state) => state.selectedNodeId) | ||
const hasNodes = useNodeStore((state) => Object.keys(state.nodes).length > 0, shallow) | ||
|
||
|
||
return <Grid item xs={6} sm={4} md={3} xl={2}> | ||
{ | ||
selectedNodeId | ||
? | ||
<Profile profileId={selectedNodeId} /> | ||
: | ||
<Box sx={{ p: 1 }}> | ||
{selectedNodeId ? | ||
<Profile profileId={selectedNodeId} /> | ||
: | ||
hasNodes ? | ||
<Box sx={{ p: 1 }} > | ||
<Alert severity='info'>Click on a node to show info</Alert> | ||
</Box> | ||
: | ||
null | ||
} | ||
</Grid> | ||
</Grid > | ||
} |