back to logic gates

This commit is contained in:
Matei Adriel 2019-08-01 23:21:40 +03:00
parent 2c6fa3a281
commit 76e48bf8d5
6 changed files with 37 additions and 14 deletions

View file

@ -4,23 +4,42 @@ import ListItemIcon from '@material-ui/core/ListItemIcon'
import ListItemText from '@material-ui/core/ListItemText' import ListItemText from '@material-ui/core/ListItemText'
import Icon from '@material-ui/core/Icon' import Icon from '@material-ui/core/Icon'
import { useTranslation } from '../../internalisation/helpers/useLanguage' import { useTranslation } from '../../internalisation/helpers/useLanguage'
import { Link } from 'react-router-dom' import { Link, Route } from 'react-router-dom'
const BackToSimulation = () => {
const translation = useTranslation()
const linkButton = (to: string, text: string, contained = true) => {
const a = 'arrow_back_ios'
return ( return (
<Link to="/"> <Link to={to}>
<ListItem button className="contained"> <ListItem button className={contained ? 'contained' : ''}>
<ListItemIcon> <ListItemIcon>
<Icon>arrow_back_ios</Icon> <Icon>
{contained ? 'device_hub' : 'keyboard_arrow_left'}
</Icon>
</ListItemIcon> </ListItemIcon>
<ListItemText> <ListItemText>{text}</ListItemText>
{translation.sidebar.backToSimulation}
</ListItemText>
</ListItem> </ListItem>
</Link> </Link>
) )
} }
const BackToSimulation = () => {
const translation = useTranslation()
return (
<>
{linkButton('/', translation.sidebar.backToSimulation)}
<Route
path="/info/:name"
component={() => {
return linkButton(
'/gates',
translation.sidebar.backToGates,
false
)
}}
/>
</>
)
}
export default BackToSimulation export default BackToSimulation

View file

@ -11,7 +11,8 @@ export const EnglishTranslation: Translation = {
openSimulation: 'Open simulations', openSimulation: 'Open simulations',
simulation: 'Simulation', simulation: 'Simulation',
language: 'Language', language: 'Language',
backToSimulation: 'Back to simulation' backToSimulation: 'Back to simulation',
backToGates: 'Back to logic gates'
}, },
createSimulation: { createSimulation: {
mode: { mode: {

View file

@ -11,7 +11,8 @@ export const DutchTranslation: Translation = {
openSimulation: 'Open simulatie', openSimulation: 'Open simulatie',
simulation: 'Todo', simulation: 'Todo',
language: 'Taal', language: 'Taal',
backToSimulation: 'Todo' backToSimulation: 'Todo',
backToGates: 'Todo'
}, },
actions: { actions: {
'delete selection': 'Todo', 'delete selection': 'Todo',

View file

@ -11,7 +11,8 @@ export const RomanianTranslation: Translation = {
logicGates: 'Porți logice', logicGates: 'Porți logice',
simulation: 'Simulație', simulation: 'Simulație',
language: 'Limba', language: 'Limba',
backToSimulation: 'Înapoi la simulație' backToSimulation: 'Înapoi la simulație',
backToGates: 'Înapoi la porțile logice'
}, },
createSimulation: { createSimulation: {
mode: { mode: {

View file

@ -17,6 +17,7 @@ export interface Translation {
simulation: string simulation: string
language: string language: string
backToSimulation: string backToSimulation: string
backToGates: string
} }
createSimulation: { createSimulation: {
mode: { mode: {

View file

@ -58,7 +58,7 @@ export const descriptions: Record<string, string> = {
only true if a === b and the 3rd input is only true if a < b. only true if a === b and the 3rd input is only true if a < b.
`, `,
'parallel delayer': ` 'parallel delayer': `
Delays the inputs by a certain delay. ${delay} Delays the inputs by a amount of time. ${delay}
`, `,
'sequential delayer': ` 'sequential delayer': `
Delays the input by a certain amount of time relative to the last change. ${delay} Delays the input by a certain amount of time relative to the last change. ${delay}