-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add open dialog * update the dialog * build update * test file open method * reduce the scope of the warning dialog * simplify
- Loading branch information
1 parent
e7a70f6
commit 76cdbf7
Showing
6 changed files
with
307 additions
and
213 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 | ||
<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', | ||
}, | ||
}) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.