Skip to content

Commit

Permalink
Revert "branch (bldrs-ai#446)"
Browse files Browse the repository at this point in the history
This reverts commit 05c9e91.
  • Loading branch information
mkeshavarzi committed Nov 4, 2022
1 parent bc5bf61 commit b7218fb
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 356 deletions.
144 changes: 0 additions & 144 deletions src/Components/BranchesControl.jsx

This file was deleted.

71 changes: 0 additions & 71 deletions src/Components/BranchesControl.test.jsx

This file was deleted.

10 changes: 7 additions & 3 deletions src/Components/NavPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import NodeOpen from '../assets/2D_Icons/NodeOpened.svg'
import useStore from '../store/useStore'
import {assertDefined} from '../utils/assert'
import {ColorModeContext} from '../Context/ColorMode'
import {useIsMobile} from './Hooks'


/**
Expand All @@ -32,14 +33,15 @@ export default function NavPanel({
const theme = useContext(ColorModeContext)
const classes = useStyles({isDay: theme.isDay()})
const selectedElements = useStore((state) => state.selectedElements)
const isMobile = useIsMobile()
// TODO(pablo): the defaultExpanded array can contain bogus IDs with
// no error. Not sure of a better way to pre-open the first few
// nodes besides hardcoding.
return (
<Paper
elevation={0}
className={classes.root}
sx={{backgroundColor: theme.isDay() ? '#E8E8E8' : '#4C4C4C'}}
sx={{backgroundColor: isMobile ? (theme.isDay() ? '#E8E8E8' : '#4C4C4C') : null}}
>
<div className={classes.treeContainer}>
<TreeView
Expand Down Expand Up @@ -71,13 +73,15 @@ export default function NavPanel({

const useStyles = makeStyles((theme) => ({
root: {
'marginTop': '14px',
'position': 'absolute',
'top': '86px',
'left': '20px',
'overflow': 'auto',
'width': '300px',
'opacity': .8,
'justifyContent': 'space-around',
'alignItems': 'center',
'maxHeight': '60%',
'maxHeight': '50%',
'@media (max-width: 900px)': {
maxHeight: '150px',
width: '300px',
Expand Down
52 changes: 26 additions & 26 deletions src/Containers/CadView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {navToDefault} from '../Share'
import {hasValidUrlParams as urlHasCameraParams} from '../Components/CameraControl'
import {useIsMobile} from '../Components/Hooks'
import SearchIndex from './SearchIndex'
import BranchesControl from '../Components/BranchesControl'


/**
Expand Down Expand Up @@ -458,30 +457,24 @@ export default function CadView({
type={'info'}
open={isLoading || snackMessage !== null}
/>
{showSearchBar && (
<div className={classes.topLeftContainer}>
<div className={classes.search}>
{showSearchBar && (
<SearchBar
fileOpen={loadLocalFile}
/>
{
modelPath.repo !== undefined &&
<BranchesControl location={location}/>
}
{showNavPanel &&
<NavPanel
model={model}
element={rootElement}
defaultExpandedElements={defaultExpandedElements}
expandedElements={expandedElements}
setExpandedElements={setExpandedElements}
pathPrefix={
pathPrefix + (modelPath.gitpath ? modelPath.getRepoPath() : modelPath.filepath)
}
/>
)}
</div>
{showNavPanel &&
<NavPanel
model={model}
element={rootElement}
defaultExpandedElements={defaultExpandedElements}
expandedElements={expandedElements}
setExpandedElements={setExpandedElements}
pathPrefix={
pathPrefix + (modelPath.gitpath ? modelPath.getRepoPath() : modelPath.filepath)
}
</div>
)}

/>}
<Logo onClick={() => navToDefault(navigate, appPrefix)}/>
<div className={isDrawerOpen ?
classes.operationsGroupOpen :
Expand Down Expand Up @@ -563,15 +556,22 @@ const useStyles = makeStyles({
},

},
topLeftContainer: {
height: '500px',
searchContainer: {

},
search: {
position: 'absolute',
top: `30px`,
// TODO(pablo): we were passing this around as it's used in a few
// places, but there's now only 1 dialog object that also uses it
// and it has multiple callers; passing that variable around seems
// overkill. I don't like not having it as a variable, but going
// to hardcode for now and look into passing via the theme later.
top: `20px`,
left: '20px',
display: 'flex',
flexDirection: 'column',
flexDirection: 'row',
justifyContent: 'flex-start',
alignItems: 'flex-start',
alignItems: 'center',
},
view: {
position: 'absolute',
Expand Down
3 changes: 2 additions & 1 deletion src/Containers/CadView.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import React, {useState} from 'react'
import {render, renderHook, act, fireEvent, screen, waitFor} from '@testing-library/react'
import {__getIfcViewerAPIMockSingleton} from 'web-ifc-viewer'
import useStore from '../store/useStore'

import ShareMock from '../ShareMock'
import {actAsyncFlush} from '../utils/tests'
import {makeTestTree} from '../utils/TreeUtils.test'

import CadView from './CadView'


Expand Down Expand Up @@ -40,7 +42,6 @@ describe('CadView', () => {
const testTree = makeTestTree()
const targetEltId = testTree.children[0].expressID
const modelPath = {

filepath: `index.ifc/${targetEltId}`,
gitpath: undefined,
}
Expand Down
5 changes: 2 additions & 3 deletions src/Share.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {useEffect, useRef} from 'react'
import React, {useEffect, useRef, useState} from 'react'
import CssBaseline from '@mui/material/CssBaseline'
import {useNavigate, useParams} from 'react-router-dom'
import {ThemeProvider} from '@mui/material/styles'
Expand Down Expand Up @@ -26,9 +26,8 @@ import AccountCircle from '@mui/icons-material/AccountCircle'
export default function Share({installPrefix, appPrefix, pathPrefix}) {
const navigation = useRef(useNavigate())
const urlParams = useParams()
const [modelPath, setModelPath] = useState(null)
const setRepository = useStore((state) => state.setRepository)
const modelPath = useStore((state) => state.modelPath)
const setModelPath = useStore((state) => state.setModelPath)


/**
Expand Down
2 changes: 0 additions & 2 deletions src/Theme.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ function loadTheme(mode) {
heavy: grey[300],
heavier: grey[400],
heaviest: grey[500],
maximum: 'black',
lime,
},
}
Expand All @@ -99,7 +98,6 @@ function loadTheme(mode) {
heavy: grey[700],
heavier: grey[600],
heaviest: grey[500],
maximum: 'white',
lime,
},
}
Expand Down

0 comments on commit b7218fb

Please sign in to comment.