From 32814269ef879f1ac30a0796d3d45a0ae27c5d14 Mon Sep 17 00:00:00 2001 From: Quinta <0pietroquintavalle0@gmail.com> Date: Sun, 30 Jun 2024 23:37:43 +0200 Subject: [PATCH] Interface to the rescue? --- app/page.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/page.tsx b/app/page.tsx index bbc4a2e..a56da15 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -15,7 +15,23 @@ import { DialogTrigger, } from "@/components/ui/dialog" -const languages = ['en', 'fr', 'it', 'de', 'es', 'ja', 'no', 'sv', 'uk', 'ru']; +type LanguageCode = 'en' | 'fr' | 'it' | 'de' | 'es' | 'ja' | 'no' | 'sv' | 'uk' | 'ru'; +type AlgorithmKey = 'bubble' | 'insertion' | 'heap' | 'quick' | 'merge' | 'radix' | 'counting' | 'bucket' | 'shell'; + +interface AlgorithmDescription { + title: string; + timeComplexity: string; + spaceComplexity: string; + description: string; +} + +type Translations = { + [key in AlgorithmKey]: { + [lang in LanguageCode]: AlgorithmDescription; + }; +}; + +const languages: LanguageCode[] = ['en', 'fr', 'it', 'de', 'es', 'ja', 'no', 'sv', 'uk', 'ru']; const translations = { bubble: {