Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#23 Left static sidebar #5

Merged
merged 24 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ef69bbc
#23 Left static sidebar
Salam-Dalloul May 4, 2024
2daed3e
#23 add headers
Salam-Dalloul May 4, 2024
7573da0
#23 add Datasets items
Salam-Dalloul May 6, 2024
06f659e
#23 add Neurons items
Salam-Dalloul May 9, 2024
95aff1d
#23 add filters section + color picker
Salam-Dalloul May 10, 2024
2188afd
#cele-25 Header UI
vidhya-metacell May 13, 2024
e123fd6
#CELE-25 Modal updates
vidhya-metacell May 14, 2024
bea9861
#cele-25 Modal fields update
vidhya-metacell May 15, 2024
e042665
fix conflict
Salam-Dalloul May 15, 2024
ea51ae6
use suspense for loading state
Salam-Dalloul May 15, 2024
2d88d83
Modify GH action to build without frozen-lockfile
aranega May 15, 2024
99a150f
Add missing lock-file
aranega May 15, 2024
d0d15e4
styles fixes
Salam-Dalloul May 16, 2024
0d6220b
Merge remote-tracking branch 'origin/feature/CELE-23' into feature/CE…
Salam-Dalloul May 16, 2024
1344c02
CELE-23 Fix compilation issues
aranega May 16, 2024
c787b3f
styles fixes
Salam-Dalloul May 16, 2024
d90eea5
add Suspense to Workspace rendering
Salam-Dalloul May 16, 2024
59b9cda
#cele-25 Remove cross icon
vidhya-metacell May 17, 2024
c4f8cf9
#cele-25 Fix merge conflicts
vidhya-metacell May 17, 2024
8bce19e
#cele-25 Header menu ui
vidhya-metacell May 19, 2024
8549f1b
styles fixes + fix switch issue
Salam-Dalloul May 20, 2024
1c72a8b
fix hover background color for bin icon
Salam-Dalloul May 20, 2024
91cd354
#cele-25 Compare workspace dialog
vidhya-metacell May 21, 2024
494c7b1
Merge pull request #7 from MetaCell/feature/CELE-25
ddelpiano May 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
node-version: 21.7
- name: Install dependencies
working-directory: applications/visualizer/frontend
run: yarn install --frozen-lockfile
run: yarn install
- name: Build App
working-directory: applications/visualizer/frontend
run: npm run build
run: npm run build
1 change: 1 addition & 0 deletions applications/visualizer/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@types/three": "^0.164.0",
"file-saver": "^2.0.5",
"react": "^18.2.0",
"react-color": "^2.19.3",
"react-dom": "^18.2.0",
"react-redux": "^9.1.1",
"three": "^0.163.0"
Expand Down
8 changes: 2 additions & 6 deletions applications/visualizer/frontend/src/App.css
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
#root {
width: 100vw;
height: 100vh;
margin: 0 auto;

}

.layout-manager-container {
display: flex;
flex-direction: column;
position: relative;
width: 100%;
height: 100%;
height: 100vh;
overflow: hidden;
}
69 changes: 32 additions & 37 deletions applications/visualizer/frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,49 +1,44 @@
import { Provider } from "react-redux";
import { ThemeProvider } from '@mui/material/styles';
import { ThemeProvider } from "@mui/material/styles";
import { Box, CssBaseline } from "@mui/material";
import '@metacell/geppetto-meta-ui/flex-layout/style/dark.scss';
import theme from './theme/index.tsx';
import './App.css'
import "@metacell/geppetto-meta-ui/flex-layout/style/dark.scss";
import theme from "./theme/index.tsx";
import "./App.css";
import { useGlobalContext } from "./contexts/GlobalContext.tsx";
import AppLauncher from "./components/AppLauncher.tsx";
import Workspace from "./components/Workspace.tsx";
import { ViewMode } from "./models/models.ts";

function App() {
const {
workspaces,
currentWorkspaceId,
viewMode,
selectedWorkspacesIds,
} = useGlobalContext();
const { workspaces, currentWorkspaceId, viewMode, selectedWorkspacesIds } =
useGlobalContext();

const hasLaunched = currentWorkspaceId != undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure as I'm not very skilled for everything frontend related 😅, but instead of having the hasLaunched variable and the classical ternary operator, could it be one of those scenarios where we could use <Suspense></Suspense>?


const hasLaunched = currentWorkspaceId != undefined

return (
<>
<ThemeProvider theme={theme}>
<CssBaseline />
{hasLaunched ? (
<Box className={"layout-manager-container"}>
{viewMode === ViewMode.Compare ?
Array.from(selectedWorkspacesIds).map(id => (
<Provider key={id} store={workspaces[id].store}>
<Workspace />
</Provider>
))
:
<Provider store={workspaces[currentWorkspaceId].store}>
<Workspace />
</Provider>
}

</Box>

) : <AppLauncher />}
</ThemeProvider>
</>
)
return (
<>
<ThemeProvider theme={theme}>
<CssBaseline />
{hasLaunched ? (
<Box className={"layout-manager-container"}>
{viewMode === ViewMode.Compare ? (
Array.from(selectedWorkspacesIds).map((id) => (
<Provider key={id} store={workspaces[id].store}>
<Workspace />
</Provider>
))
) : (
<Provider store={workspaces[currentWorkspaceId].store}>
<Workspace />
</Provider>
)}
</Box>
) : (
<AppLauncher />
)}
</ThemeProvider>
</>
);
}

export default App
export default App;
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import Box from '@mui/material/Box';
import ChromePicker from 'react-color';


const ColorPicker = ({ selectedColor, onChange }) => {
return (
<Box sx={{
'& > div': {
width: '100% !important',
boxShadow: 'none !important',
background: 'transparent !important',
fontFamily: "'IBM Plex Sans',sans-serif !important",

'& > div:last-of-type': {
'& > div:first-of-type': {
'& > div:first-of-type': {
'& > div': {
// border: `0.0625rem solid ${headerBorderLeftColor}`,
},
},
},
},

'& svg': {
'&:hover': {
// background: `${headerBorderLeftColor} !important`,
},
},

'& input': {
// backgroundColor: `${headerBorderLeftColor} !important`,
boxShadow: 'none !important',
// color: `${headingColor} !important`,
'&:focus': {
boxShadow: 'none !important',
outline: 'none !important',
},
},
},
}}>
<ChromePicker
color={selectedColor}
onChange={onChange}
/>
</Box>
);
};

export default ColorPicker;
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
import { Box, Button, Dialog, FormLabel, IconButton, ListSubheader, TextField, Typography, Autocomplete} from "@mui/material";
import { vars } from "../../theme/variables.ts";
import { CaretIcon, CheckIcon, CloseIcon } from "../../icons/index.tsx";
const { gray100 } = vars;


const NeuronData = [
'ADAC', "ARAC", "VBG"
];

const datasetStages = [
{
groupName: 'Development Stage 1',
options: [
{ title: 'Witvliet et al., 2020, Dataset 1 (L1)', caption: '0 hours from birth' },
{ title: 'Witvliet et al., 2020, Dataset 3 (L1)', caption: '0 hours from birth' },
{ title: 'Witvliet et al., 2020, Dataset 2 (L1)', caption: '0 hours from birth' }
]
},
{
groupName: 'Development Stage 2',
options: [
{ title: 'Witvliet et al., 2020, Dataset 1 (L1)', caption: '0 hours from birth' },
{ title: 'Witvliet et al., 2020, Dataset 3 (L1)', caption: '0 hours from birth' },
{ title: 'Witvliet et al., 2020, Dataset 2 (L1)', caption: '0 hours from birth' }
]
},
];

const CompareWorkspaceDialog = ({
onClose,
showModal,
}) => {
const allOptions = datasetStages.reduce((acc, curr) => {
return [...acc, ...curr.options.map(option => ({ ...option, groupName: curr.groupName }))];
}, []);
return (
<Dialog
onClose={onClose}
open={showModal}
fullWidth
maxWidth="lg"
>
<Box borderBottom={`0.0625rem solid ${gray100}`} px="1rem" py="0.5rem" display='flex' alignItems='center' justifyContent='space-between'>
<Typography component="h3">New workspace configuration</Typography>
<IconButton onClick={onClose}><CloseIcon /></IconButton>
</Box>
<Box px="1rem" py="1.5rem" gap={2.5} display='flex' flexDirection='column'>
<Typography>To start comparing, create workspace by configuring datasets and neurons you would want in the new workspace or start with an empty workspace.</Typography>
<Box>
<FormLabel>Workspace name</FormLabel>
<TextField fullWidth variant="outlined" placeholder="Start typing workspace name" />
</Box>

<Box>
<FormLabel>Datasets</FormLabel>
<Autocomplete
multiple
id="grouped-demo"
clearIcon={false}
options={allOptions}
ChipProps={{ deleteIcon: <IconButton sx={{ p: '0 !important', margin: '0 !important' }}><CloseIcon /></IconButton> }}
popupIcon={<CaretIcon />}
groupBy={(option) => option.groupName}
getOptionLabel={(option) => option.title}
renderInput={(params) => <TextField {...params} placeholder="Start typing to search" />}
renderOption={(props, option) => (
<li {...props}>
<CheckIcon />
<Typography>{option.title}</Typography>
<Typography component='span'>{option.caption}</Typography>
</li>
)}
renderGroup={(params) => {
console.log(params, 'params')
return (
<li className="grouped-list" key={params.key}>
<ListSubheader component="div">
{params.group}
</ListSubheader>
<ul style={{ padding: 0 }}>{params.children}</ul>
</li>
)
}}
/>
</Box>

<Box>
<FormLabel>Neurons</FormLabel>
<Autocomplete
multiple
className="secondary"
id="tags-standard"
clearIcon={false}
options={NeuronData}
getOptionLabel={(option) => option}
ChipProps={{ deleteIcon: <IconButton sx={{ p: '0 !important', margin: '0 !important' }}><CloseIcon /></IconButton> }}
renderOption={(props, option) => (
<li {...props}>
<CheckIcon />
<Typography>{option}</Typography>
</li>
)}
renderInput={(params) => (
<TextField
{...params}
placeholder="Start typing to search"
/>
)}
/>
</Box>
</Box>

<Box borderTop={`0.0625rem solid ${gray100}`} px="1rem" py="0.75rem" gap={0.5} display='flex' justifyContent='flex-end'>
<Button variant="text">Start with an empty workspace</Button>
<Button variant="contained" color="info">Configure workspace</Button>
</Box>
</Dialog>
);
};

export default CompareWorkspaceDialog;
Loading