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

Open file dialog #170

Merged
merged 6 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
404 changes: 202 additions & 202 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-ai",
"version": "1.0.0-r260",
"version": "1.0.0-r268",
"main": "src/index.jsx",
"homepage": "https://github.com/bldrs-ai/Share",
"bugs": {
Expand Down
9 changes: 2 additions & 7 deletions src/Components/BaseGroup.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from 'react'
import {makeStyles} from '@mui/styles'
import AboutControl from './AboutControl'
import {TooltipToggleButton} from './Buttons'
import OpenIcon from '../assets/2D_Icons/Open.svg'
import OpenModelControl from './OpenModelControl'


/**
Expand All @@ -16,11 +15,7 @@ export default function BaseGroup({installPrefix, fileOpen}) {
const classes = useStyles()
return (
<div className={classes.root}>
<TooltipToggleButton
title='Upload model'
icon={<OpenIcon/>}
onClick={fileOpen}
placement='top'/>
<OpenModelControl installPrefix={installPrefix} fileOpen = {fileOpen}/>
<AboutControl installPrefix={installPrefix}/>
</div>
)
Expand Down
95 changes: 95 additions & 0 deletions src/Components/OpenModelControl.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import React, {useState} from 'react'
import {makeStyles} from '@mui/styles'
import Dialog from './Dialog'
import OpenIcon from '../assets/2D_Icons/Open.svg'
import LocalFileOpen from '../assets/2D_Icons/LocalFileOpen.svg'
import {ControlButton} from './Buttons'


/**
* Displays open warning.
* @return {Object} React component
*/
export default function OpenModelControl({fileOpen}) {
const [isDialogDisplayed, setIsDialogDisplayed] = useState(false)
return (
<ControlButton
title='Shortcut keys'
isDialogDisplayed={isDialogDisplayed}
setIsDialogDisplayed={setIsDialogDisplayed}
icon={<OpenIcon/>}
dialog={
<OpenModelDialog
fileOpen={fileOpen}
isDialogDisplayed={isDialogDisplayed}
setIsDialogDisplayed={setIsDialogDisplayed}/>}/>)
}


/**
* @param {boolean} isDialogDisplayed
* @param {function} setIsDialogDisplayed
* @return {Object} React component
*/
function OpenModelDialog({isDialogDisplayed, setIsDialogDisplayed, fileOpen}) {
const classes = useStyles()
return (
<Dialog
icon={<OpenIcon/>}
headerText='Model Access'
isDialogDisplayed={isDialogDisplayed}
setIsDialogDisplayed={setIsDialogDisplayed}
content={
<div className={classes.content}>
{/* <LocalFileOpen/>
<p className={classes.bullet}>
To take advantage of all features of BLDRS, we recommend using GitHub for model hosting.
<br/>
For more info visit our &nbsp;
<a
className = {classes.link}
target="_blank"
href = 'https://github.com/bldrs-ai/Share/wiki/GitHub-model-hosting'
rel="noreferrer">wiki</a>
<br/>
<b>To access models hosted on GitHub, paste the model link into the search bar.</b>
</p> */}
<LocalFileOpen/>
<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>
</div>
}/>
)
}


const useStyles = makeStyles({
content: {
width: '270px',
},
bullet: {
textAlign: 'left',
},
link: {
color: 'blue',
borderBottom: '1px solid blue',
cursor: 'pointer',
},
openIcon: {
textAlign: 'center',
},
})
4 changes: 4 additions & 0 deletions src/assets/2D_Icons/LocalFileOpen.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.