Skip to content

Commit

Permalink
Sample models (bldrs-ai#187)
Browse files Browse the repository at this point in the history
* add sample models Dialog

* add sample model

* add description to the sample model dialog

* adjust shortcut models

* clean up

* clean up

* add test + style details

* clean up
  • Loading branch information
OlegMoshkovich committed May 19, 2022
1 parent f5f872e commit 1ae384f
Show file tree
Hide file tree
Showing 6 changed files with 265 additions and 262 deletions.
456 changes: 217 additions & 239 deletions docs/index.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bldrs",
"version": "1.0.0-r306",
"version": "1.0.0-r284",
"main": "src/index.jsx",
"homepage": "https://github.com/bldrs-ai/Share",
"bugs": {
Expand Down
41 changes: 22 additions & 19 deletions src/Components/OpenModelControl.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React, {useState} from 'react'
import {makeStyles} from '@mui/styles'
import Dialog from './Dialog'
import OpenIcon from '../assets/2D_Icons/Open.svg'
import GitHubIcon from '../assets/2D_Icons/GitHub.svg'
import OpenFolder from '../assets/2D_Icons/OpenFolder.svg'
import ModelsIcon from '../assets/2D_Icons/Model.svg'
import LocalFileOpen from '../assets/2D_Icons/LocalFileOpen.svg'
import {ControlButton} from './Buttons'

Expand All @@ -17,7 +19,7 @@ export default function OpenModelControl({fileOpen}) {
title='Open IFC'
isDialogDisplayed={isDialogDisplayed}
setIsDialogDisplayed={setIsDialogDisplayed}
icon={<OpenIcon/>}
icon={<OpenFolder/>}
dialog={
<OpenModelDialog
fileOpen={fileOpen}
Expand All @@ -35,13 +37,13 @@ function OpenModelDialog({isDialogDisplayed, setIsDialogDisplayed, fileOpen}) {
const classes = useStyles()
return (
<Dialog
icon={<OpenIcon/>}
icon={<ModelsIcon/>}
headerText='Model Access'
isDialogDisplayed={isDialogDisplayed}
setIsDialogDisplayed={setIsDialogDisplayed}
content={
<div className={classes.content}>
<LocalFileOpen/>
<GitHubIcon style = {{width: '50px', height: '50px'}}/>
<p className={classes.bullet}>
To take advantage of all features of BLDRS, we recommend using GitHub for model hosting.
<br/>
Expand All @@ -56,23 +58,23 @@ function OpenModelDialog({isDialogDisplayed, setIsDialogDisplayed, fileOpen}) {
<br/>

</p>
<LocalFileOpen/>
<LocalFileOpen style = {{width: '50px', height: '50px'}}/>
<p className={classes.bullet}>
<b>Models accessed from local drive cannot be saved or shared.</b>
<br/>
<span
className = {classes.link}
role = 'button'
tabIndex={0}
onKeyPress = {()=>{
fileOpen()
setIsDialogDisplayed(false)
}}
onClick = {()=>{
fileOpen()
setIsDialogDisplayed(false)
}}> open</span>
</p>
<span
className = {classes.link}
role = 'button'
tabIndex={0}
onKeyPress = {()=>{
fileOpen()
setIsDialogDisplayed(false)
}}
onClick = {()=>{
fileOpen()
setIsDialogDisplayed(false)
}}>OPEN</span>
</div>
}/>
)
Expand All @@ -83,10 +85,11 @@ const useStyles = makeStyles({
content: {
width: '270px',
},
bullet: {
textAlign: 'left',
snippet: {
textAlign: 'center',
},
link: {
fontWeight: 'bold',
color: 'blue',
borderBottom: '1px solid blue',
cursor: 'pointer',
Expand Down
19 changes: 19 additions & 0 deletions src/Components/SampleModelsControl.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react'
import {render, screen, fireEvent} from '@testing-library/react'
import SampleModelsControl from './SampleModelsControl'
import {MockRoutes} from '../BaseRoutesMock.test'


test('renders sample models control', async () => {
const rendered = render( <MockRoutes contentElt = {<SampleModelsControl/>} />)
const sampleModelsButton = screen.getByTitle('Sample Models')
fireEvent.mouseOver(sampleModelsButton)
fireEvent.click(sampleModelsButton)

const tooltip = await rendered.findByRole('tooltip')
const dialogText = await screen.findByText('wiki')

expect(sampleModelsButton).toBeInTheDocument()
expect(tooltip).toBeInTheDocument()
expect(dialogText).toBeVisible()
})
3 changes: 3 additions & 0 deletions src/assets/2D_Icons/OpenFolder.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1ae384f

Please sign in to comment.