-
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.
Merge pull request #1 from MetaCell/feature/CELE-17
Feature/cele 17
- Loading branch information
Showing
19 changed files
with
1,086 additions
and
616 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
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
72 changes: 72 additions & 0 deletions
72
applications/visualizer/frontend/src/components/AppLauncher.tsx
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,72 @@ | ||
import React from 'react'; | ||
import {Typography, Card, CardContent, CardActionArea, Grid, Container} from '@mui/material'; | ||
import {createEmptyWorkspace} from "../helpers/initialWorkspacesHelper.ts"; | ||
import {useGlobalContext} from "../contexts/GlobalContext.tsx"; | ||
|
||
function AppLauncher() { | ||
|
||
const {workspaces, addWorkspace, switchWorkspace} = useGlobalContext(); | ||
|
||
|
||
const handleTemplateClick = () => { | ||
console.log('Template option clicked'); | ||
}; | ||
|
||
const handleBlankClick = () => { | ||
const workspace =createEmptyWorkspace(`Workspace ${Object.keys(workspaces).length + 1}`) | ||
addWorkspace(workspace) | ||
switchWorkspace(workspace.id) | ||
}; | ||
|
||
const handlePasteUrlClick = () => { | ||
console.log('Paste URL option clicked'); | ||
}; | ||
|
||
return ( | ||
<Container maxWidth="md" style={{marginTop: '50px'}}> | ||
<Typography variant="h3" component="h1" gutterBottom align="center"> | ||
Welcome to C. Elegans | ||
</Typography> | ||
<Typography variant="h6" component="p" gutterBottom align="center"> | ||
Choose one of the options below to get started. | ||
</Typography> | ||
<Grid container spacing={4} justifyContent="center" style={{marginTop: '20px'}}> | ||
<Grid item xs={12} sm={6} md={4}> | ||
<Card> | ||
<CardActionArea onClick={handleTemplateClick}> | ||
<CardContent> | ||
<Typography variant="h5" component="h2" align="center"> | ||
Start from Template | ||
</Typography> | ||
</CardContent> | ||
</CardActionArea> | ||
</Card> | ||
</Grid> | ||
<Grid item xs={12} sm={6} md={4}> | ||
<Card> | ||
<CardActionArea onClick={handleBlankClick}> | ||
<CardContent> | ||
<Typography variant="h5" component="h2" align="center"> | ||
Start with a Blank Canvas | ||
</Typography> | ||
</CardContent> | ||
</CardActionArea> | ||
</Card> | ||
</Grid> | ||
<Grid item xs={12} sm={6} md={4}> | ||
<Card> | ||
<CardActionArea onClick={handlePasteUrlClick}> | ||
<CardContent> | ||
<Typography variant="h5" component="h2" align="center"> | ||
Paste URL | ||
</Typography> | ||
</CardContent> | ||
</CardActionArea> | ||
</Card> | ||
</Grid> | ||
</Grid> | ||
</Container> | ||
); | ||
} | ||
|
||
export default AppLauncher; |
43 changes: 15 additions & 28 deletions
43
applications/visualizer/frontend/src/components/LeftComponent.tsx
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,46 +1,33 @@ | ||
import { Box, Button, Typography } from "@mui/material"; | ||
import { useEffect, useState } from "react"; | ||
import { Dataset, DatasetsService, HeathcheckService, Neuron, NeuronsService } from "../rest"; | ||
import {Box, Typography} from "@mui/material"; | ||
|
||
export default function LeftComponent() { | ||
const [ready, setReady] = useState("Not ready") | ||
const [dataset, setDataset] = useState<Dataset>() | ||
const [allDataset, setAllDataset] = useState<Dataset[]>() | ||
const [currentPage, setCurrentPage] = useState<{ page: number, loadedElements: number, totalElements: number }>({ page: 0, loadedElements: 0, totalElements: 1 }) | ||
const [neurons, setNeurons] = useState<Neuron[]>([]) | ||
|
||
useEffect(() => { | ||
HeathcheckService.ready().then(answer => setReady(answer)) | ||
DatasetsService.getDataset({ dataset: 'white_1986_whole' }).then(answer => setDataset(answer)) | ||
DatasetsService.getAllDatasets().then(answer => setAllDataset(answer)) | ||
loadMoreNeurons() | ||
}, []) | ||
import {useGlobalContext} from "../contexts/GlobalContext.tsx"; | ||
|
||
const loadMoreNeurons = async () => { | ||
const page = currentPage.page + 1 | ||
const neuronPage = await NeuronsService.getAllCells({ page: page }) | ||
setNeurons([...neurons, ...neuronPage.items]) | ||
setCurrentPage({ page: page, loadedElements: neurons.length, totalElements: neuronPage.count }) | ||
} | ||
export default function LeftComponent() { | ||
const {datasets, neurons} = useGlobalContext(); | ||
|
||
const datasetArray = datasets ? Object.values(datasets) : []; | ||
const neuronArray = neurons ? Object.values(neurons) : []; | ||
return ( | ||
<Box> | ||
<Typography variant="h1">Vite + React + Typescript</Typography> | ||
<Typography variant="h3">API state: {ready}</Typography> | ||
<Typography variant="h3">Dataset: {JSON.stringify(dataset)}</Typography> | ||
<Typography variant="h3">All datasets names:</Typography> | ||
<Box> | ||
{ | ||
allDataset?.map(x => <Typography key={x.name} variant="body1">{x.name}</Typography>) | ||
// Render each dataset name | ||
datasetArray.map(dataset => ( | ||
<Typography key={dataset.id} variant="body1">{dataset.name}</Typography> | ||
)) | ||
} | ||
</Box> | ||
<Typography variant="h3">Neurons:</Typography> | ||
<Box> | ||
{ | ||
neurons?.map(x => <Typography key={x.name} variant="body1">{x.name} ({JSON.stringify(x)})</Typography>) | ||
// Render each neuron name | ||
neuronArray.map(neuron => ( | ||
<Typography key={neuron.id} variant="body1">{neuron.name}</Typography> | ||
)) | ||
} | ||
<Button disabled={currentPage.loadedElements >= currentPage.totalElements} onClick={loadMoreNeurons}>Load more</Button> | ||
</Box> | ||
</Box> | ||
) | ||
); | ||
} |
Oops, something went wrong.