From 76e48bf8d576c52e16a309a16cb2075fbd299aeb Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Thu, 1 Aug 2019 23:21:40 +0300 Subject: [PATCH] back to logic gates --- .../core/components/BackToSimulation.tsx | 39 ++++++++++++++----- .../internalisation/translations/english.ts | 3 +- .../translations/nederlands.ts | 3 +- .../internalisation/translations/romanian.ts | 3 +- .../types/TranslationInterface.ts | 1 + .../logic-gate-info/data/descriptions.ts | 2 +- 6 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/modules/core/components/BackToSimulation.tsx b/src/modules/core/components/BackToSimulation.tsx index 42ebe76..1224a95 100644 --- a/src/modules/core/components/BackToSimulation.tsx +++ b/src/modules/core/components/BackToSimulation.tsx @@ -4,23 +4,42 @@ import ListItemIcon from '@material-ui/core/ListItemIcon' import ListItemText from '@material-ui/core/ListItemText' import Icon from '@material-ui/core/Icon' import { useTranslation } from '../../internalisation/helpers/useLanguage' -import { Link } from 'react-router-dom' - -const BackToSimulation = () => { - const translation = useTranslation() +import { Link, Route } from 'react-router-dom' +const linkButton = (to: string, text: string, contained = true) => { + const a = 'arrow_back_ios' return ( - - + + - arrow_back_ios + + {contained ? 'device_hub' : 'keyboard_arrow_left'} + - - {translation.sidebar.backToSimulation} - + {text} ) } +const BackToSimulation = () => { + const translation = useTranslation() + + return ( + <> + {linkButton('/', translation.sidebar.backToSimulation)} + { + return linkButton( + '/gates', + translation.sidebar.backToGates, + false + ) + }} + /> + + ) +} + export default BackToSimulation diff --git a/src/modules/internalisation/translations/english.ts b/src/modules/internalisation/translations/english.ts index b4da4b9..443ac52 100644 --- a/src/modules/internalisation/translations/english.ts +++ b/src/modules/internalisation/translations/english.ts @@ -11,7 +11,8 @@ export const EnglishTranslation: Translation = { openSimulation: 'Open simulations', simulation: 'Simulation', language: 'Language', - backToSimulation: 'Back to simulation' + backToSimulation: 'Back to simulation', + backToGates: 'Back to logic gates' }, createSimulation: { mode: { diff --git a/src/modules/internalisation/translations/nederlands.ts b/src/modules/internalisation/translations/nederlands.ts index c2ce593..6a87a42 100644 --- a/src/modules/internalisation/translations/nederlands.ts +++ b/src/modules/internalisation/translations/nederlands.ts @@ -11,7 +11,8 @@ export const DutchTranslation: Translation = { openSimulation: 'Open simulatie', simulation: 'Todo', language: 'Taal', - backToSimulation: 'Todo' + backToSimulation: 'Todo', + backToGates: 'Todo' }, actions: { 'delete selection': 'Todo', diff --git a/src/modules/internalisation/translations/romanian.ts b/src/modules/internalisation/translations/romanian.ts index 1640002..f3b5041 100644 --- a/src/modules/internalisation/translations/romanian.ts +++ b/src/modules/internalisation/translations/romanian.ts @@ -11,7 +11,8 @@ export const RomanianTranslation: Translation = { logicGates: 'Porți logice', simulation: 'Simulație', language: 'Limba', - backToSimulation: 'Înapoi la simulație' + backToSimulation: 'Înapoi la simulație', + backToGates: 'Înapoi la porțile logice' }, createSimulation: { mode: { diff --git a/src/modules/internalisation/types/TranslationInterface.ts b/src/modules/internalisation/types/TranslationInterface.ts index 5d7bc31..5ad9e36 100644 --- a/src/modules/internalisation/types/TranslationInterface.ts +++ b/src/modules/internalisation/types/TranslationInterface.ts @@ -17,6 +17,7 @@ export interface Translation { simulation: string language: string backToSimulation: string + backToGates: string } createSimulation: { mode: { diff --git a/src/modules/logic-gate-info/data/descriptions.ts b/src/modules/logic-gate-info/data/descriptions.ts index 904c737..b1081a4 100644 --- a/src/modules/logic-gate-info/data/descriptions.ts +++ b/src/modules/logic-gate-info/data/descriptions.ts @@ -58,7 +58,7 @@ export const descriptions: Record = { only true if a === b and the 3rd input is only true if a < b. `, 'parallel delayer': ` - Delays the inputs by a certain delay. ${delay} + Delays the inputs by a amount of time. ${delay} `, 'sequential delayer': ` Delays the input by a certain amount of time relative to the last change. ${delay}