From 9f9f4c6409911debd53fd91ec9e08a5764027c93 Mon Sep 17 00:00:00 2001 From: maddiebaka Date: Fri, 17 Nov 2023 14:15:27 -0500 Subject: [PATCH] Add Legend button under advanced search --- Toki Trainer/Localizable.xcstrings | 19 ++++++++++++++++++- .../Views/WordListViews/DictionaryView.swift | 11 +++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Toki Trainer/Localizable.xcstrings b/Toki Trainer/Localizable.xcstrings index 973c674..1c0be52 100644 --- a/Toki Trainer/Localizable.xcstrings +++ b/Toki Trainer/Localizable.xcstrings @@ -91,6 +91,16 @@ } } }, + "Legend" : { + "localizations" : { + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Légende" + } + } + } + }, "Lessons" : { "localizations" : { "fr" : { @@ -162,7 +172,14 @@ } }, "Words" : { - + "localizations" : { + "fr" : { + "stringUnit" : { + "state" : "translated", + "value" : "Mots" + } + } + } } }, "version" : "1.0" diff --git a/Toki Trainer/Views/WordListViews/DictionaryView.swift b/Toki Trainer/Views/WordListViews/DictionaryView.swift index 2a779ea..11a777d 100644 --- a/Toki Trainer/Views/WordListViews/DictionaryView.swift +++ b/Toki Trainer/Views/WordListViews/DictionaryView.swift @@ -17,6 +17,7 @@ struct DictionaryView: View { @State private var tokiInput: String = "" @State private var selectedPartOfSpeech: String? + @State private var showGenericLegend: Bool = false @State private var advancedSearchEnabled = false @State var searchMode: SearchMode = .Dictionary @@ -68,6 +69,13 @@ struct DictionaryView: View { } filterByInput() } + Button(action: { + print("Legend") + showGenericLegend.toggle() + }, label: { + Text("Legend") + }) + .padding(4) } .padding([.leading, .trailing], 8) } @@ -77,6 +85,9 @@ struct DictionaryView: View { .sheet(item: $selectedPartOfSpeech) { selectedPOS in PartsOfSpeechView(selectedPartOfSpeech: selectedPOS) } + .sheet(isPresented: $showGenericLegend, content: { + PartsOfSpeechView(selectedPartOfSpeech: nil) + }) .onChange(of: tokiInput) { newValue in filterByInput() //tokiDictViewModel.filterDictionaryEnglishMode(newValue)