forked from rust-lang/rust-playground
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from Sunscreen-tech/samtay/presets
Example presets
- Loading branch information
Showing
9 changed files
with
242 additions
and
27 deletions.
There are no files selected for viewing
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,48 @@ | ||
import React, { Fragment, useCallback } from 'react'; | ||
import { useSelector, useDispatch } from 'react-redux'; | ||
|
||
import MenuGroup from './MenuGroup'; | ||
import SelectOne from './SelectOne'; | ||
|
||
import * as actions from './actions'; | ||
import State from './state'; | ||
import { Example } from './types'; | ||
|
||
interface ExampleMenuProps { | ||
close: () => void; | ||
} | ||
|
||
const ExampleMenu: React.SFC<ExampleMenuProps> = props => { | ||
const example = useSelector((state: State) => state.configuration.example); | ||
const dispatch = useDispatch(); | ||
const changeExample = useCallback((example) => { | ||
dispatch(actions.changeExample(example)); | ||
props.close(); | ||
}, [dispatch, props] | ||
); | ||
|
||
return ( | ||
<Fragment> | ||
<MenuGroup title="Example — Choose example code to explore"> | ||
<SelectOne | ||
name="Private Information Retrieval" | ||
currentValue={example} | ||
thisValue={Example.Pir} | ||
changeValue={changeExample} | ||
> | ||
Explore privately querying a database with our FHE compiler. | ||
</SelectOne> | ||
<SelectOne | ||
name="Sudoku" | ||
currentValue={example} | ||
thisValue={Example.Sudoku} | ||
changeValue={changeExample} | ||
> | ||
Use our ZKP compiler to prove that you have a valid Sudoku solution, without revealing the solution itself. | ||
</SelectOne> | ||
</MenuGroup> | ||
</Fragment> | ||
); | ||
}; | ||
|
||
export default ExampleMenu; |
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
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
Oops, something went wrong.