-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fe4616c
commit 02e64c9
Showing
11 changed files
with
408 additions
and
643 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
body { | ||
margin: 0; | ||
} |
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React, { ChangeEvent, useState } from 'react'; | ||
|
||
import { FilterAlt as FilterIcon } from '@mui/icons-material'; | ||
import { | ||
FormControl, | ||
IconButton, | ||
InputAdornment, | ||
InputLabel, | ||
OutlinedInput, | ||
} from '@mui/material'; | ||
|
||
type Props = { | ||
handleSetFilters: (filters: Set<string>) => void; | ||
filters: Set<string>; | ||
}; | ||
|
||
export default function Filters({ handleSetFilters, filters }: Props) { | ||
const [query, setQuery] = useState<string>(''); | ||
const handleSearch = () => { | ||
if (query) { | ||
const cleanQuery = query.trim().toLowerCase(); | ||
const newSet = new Set(filters); | ||
newSet.add(cleanQuery); | ||
handleSetFilters(newSet); | ||
setQuery(''); | ||
} | ||
}; | ||
|
||
const handleChangeQuery = (event: ChangeEvent<HTMLInputElement>) => { | ||
setQuery(event.target.value); | ||
}; | ||
return ( | ||
<FormControl sx={{ m: 1, width: '25ch' }} variant="outlined"> | ||
<InputLabel htmlFor="filter">Filter</InputLabel> | ||
<OutlinedInput | ||
id="filter" | ||
type="text" | ||
value={query} | ||
onChange={handleChangeQuery} | ||
endAdornment={ | ||
<InputAdornment position="end"> | ||
<IconButton aria-label="filter" onClick={handleSearch} edge="end"> | ||
<FilterIcon /> | ||
</IconButton> | ||
</InputAdornment> | ||
} | ||
label="Filter..." | ||
/> | ||
</FormControl> | ||
); | ||
} |
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
FormControl, | ||
InputLabel, | ||
MenuItem, | ||
Select, | ||
SelectChangeEvent, | ||
} from '@mui/material'; | ||
import Button from '@mui/material/Button'; | ||
|
||
import Cytoscape from 'cytoscape'; | ||
|
||
import { DEFAULT_LAYOUT } from './constants'; | ||
|
||
type Props = { | ||
cy: Cytoscape.Core | undefined; | ||
}; | ||
export default function Layout({ cy }: Props) { | ||
const handleCenter = () => { | ||
if (cy) { | ||
const n = cy.nodes(); | ||
cy.fit(n); | ||
} | ||
}; | ||
|
||
const handleFit = () => { | ||
if (cy) { | ||
const visibleNodes = cy.nodes(':visible'); | ||
const l = visibleNodes.layout({ | ||
name: layout, | ||
}); | ||
l.run(); | ||
} | ||
}; | ||
const handleLayout = (event: SelectChangeEvent<HTMLInputElement>) => { | ||
const value = event.target.value; | ||
setLayout(String(value)); | ||
}; | ||
|
||
const [layout, setLayout] = React.useState<string>(DEFAULT_LAYOUT); | ||
|
||
return ( | ||
<> | ||
<FormControl fullWidth> | ||
<InputLabel id="layout">Layout</InputLabel> | ||
<Select | ||
labelId="layout" | ||
id="layout-id" | ||
// @ts-ignore | ||
value={layout} | ||
label="Layout" | ||
onChange={handleLayout} | ||
> | ||
<MenuItem value={'cola'}>Cola</MenuItem> | ||
<MenuItem value={'cose'}>Cose</MenuItem> | ||
<MenuItem value={'fcose'}>Fcose</MenuItem> | ||
<MenuItem value={'circle'}>Circle</MenuItem> | ||
<MenuItem value={'concentric'}>Concentric</MenuItem> | ||
<MenuItem value={'avsdf'}>Avsdf</MenuItem> | ||
<MenuItem value={'cise'}>Cise</MenuItem> | ||
<MenuItem value={'cise'}>Grid</MenuItem> | ||
<MenuItem value={'random'}>Random</MenuItem> | ||
</Select> | ||
</FormControl> | ||
<Button variant="outlined" onClick={handleCenter}> | ||
Center | ||
</Button> | ||
<Button variant="outlined" onClick={handleFit}> | ||
Fit | ||
</Button> | ||
</> | ||
); | ||
} |
Oops, something went wrong.