From 5765c78a1d5f24907e4f4b30a4d3545b6f93a9c8 Mon Sep 17 00:00:00 2001 From: Jon Eugster Date: Fri, 3 May 2024 16:30:36 +0200 Subject: [PATCH] add submenu for inventory categories --- client/src/components/inventory.tsx | 27 +++++++++++++++++---------- client/src/css/inventory.css | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/client/src/components/inventory.tsx b/client/src/components/inventory.tsx index 0adf55de..363f3db5 100644 --- a/client/src/components/inventory.tsx +++ b/client/src/components/inventory.tsx @@ -24,22 +24,29 @@ export function Inventory({levelInfo, openDoc, lemmaTab, setLemmaTab, enableAll= }) { const { t } = useTranslation() + // TODO: this state should be preserved when loading a different level. + const [tab, setTab] = useState<"tactic"|"theorem"|"definition">("theorem") + + let newTheorems = levelInfo?.lemmas?.filter(item => item.new).length > 0 + let newTactics = levelInfo?.tactics?.filter(item => item.new).length > 0 + let newDefinitions = levelInfo?.definitions?.filter(item => item.new).length > 0 + return (
- {/* TODO: Click on Tactic: show info - TODO: click on paste icon -> paste into command line */} -

{t("Tactics")}

- {levelInfo?.tactics && +
+
{ setTab("theorem") }}>{t("Theorems")}
+
{ setTab("tactic") }}>{t("Tactics")}
+
{ setTab("definition") }}>{t("Definitions")}
+
+ { (tab == "theorem") && levelInfo?.lemmas && + + } + { (tab == "tactic") && levelInfo?.tactics && } -

{t("Definitions")}

- {levelInfo?.definitions && + { (tab == "definition") && levelInfo?.definitions && } -

{t("Theorems")}

- {levelInfo?.lemmas && - - }
) } diff --git a/client/src/css/inventory.css b/client/src/css/inventory.css index f18292c6..ee8bf0bd 100644 --- a/client/src/css/inventory.css +++ b/client/src/css/inventory.css @@ -55,7 +55,7 @@ .tab-bar { border-bottom: 0.1em solid var(--clr-dark-gray); - margin-bottom: 0.5em; + margin-bottom: 1em; } .tab { @@ -70,6 +70,22 @@ display: inline-block; } +.tab-bar.major { + display: flex; + flex-direction: row; + flex-wrap: wrap; + padding-top: .5em; + font-weight: bold; +} + +.tab-bar.major .tab { + flex: 1; + text-align: center; + font-size: 1.2em; + padding-left: 0; + padding-right: 0; +} + .tab-bar.current .tab.active { color: black; border-bottom: 0.3em solid var(--clr-primary);