diff --git a/Bases/LessonTypeBase.cs b/Bases/LessonTypeBase.cs index 30309f4..125288f 100644 --- a/Bases/LessonTypeBase.cs +++ b/Bases/LessonTypeBase.cs @@ -9,6 +9,9 @@ public class LessonTypeBase : ComponentBase [Inject] public ProfileService Profile { get; set; } = default!; + + [Inject] + public TextToSpeechService TTS { get; set; } = default!; [Parameter, EditorRequired] public LessonLogic Logic { get; set; } = default!; @@ -32,5 +35,10 @@ public bool NotReady() return false; } + + public void PlayOneShot() + { + _ = TTS.Speak(Logic.Included[0].RU); + } } } diff --git a/Components/LessonButton.razor b/Components/LearnPage/LessonButton.razor similarity index 100% rename from Components/LessonButton.razor rename to Components/LearnPage/LessonButton.razor diff --git a/Components/LessonButton.razor.css b/Components/LearnPage/LessonButton.razor.css similarity index 100% rename from Components/LessonButton.razor.css rename to Components/LearnPage/LessonButton.razor.css diff --git a/Components/LessonRow1.razor b/Components/LearnPage/LessonRow1.razor similarity index 100% rename from Components/LessonRow1.razor rename to Components/LearnPage/LessonRow1.razor diff --git a/Components/LessonRow2.razor b/Components/LearnPage/LessonRow2.razor similarity index 100% rename from Components/LessonRow2.razor rename to Components/LearnPage/LessonRow2.razor diff --git a/Components/LessonRow3.razor b/Components/LearnPage/LessonRow3.razor similarity index 100% rename from Components/LessonRow3.razor rename to Components/LearnPage/LessonRow3.razor diff --git a/Components/SectionHeader.razor b/Components/LearnPage/SectionHeader.razor similarity index 100% rename from Components/SectionHeader.razor rename to Components/LearnPage/SectionHeader.razor diff --git a/Components/LessonType_Select.razor b/Components/LessonPage/LessonType_Select.razor similarity index 91% rename from Components/LessonType_Select.razor rename to Components/LessonPage/LessonType_Select.razor index 1f3ed0a..1163c37 100644 --- a/Components/LessonType_Select.razor +++ b/Components/LessonPage/LessonType_Select.razor @@ -8,8 +8,10 @@ @if (FindEnglish) { - -

@Logic.Included[0].RU

+ //
+ +

@Logic.Included[0].RU

+ //
}else { @@ -38,6 +40,7 @@ if (FindEnglish) { Options.Add(Logic.Included[0].EN); + PlayOneShot(); } else { diff --git a/Components/LessonType_Teach.razor b/Components/LessonPage/LessonType_Teach.razor similarity index 75% rename from Components/LessonType_Teach.razor rename to Components/LessonPage/LessonType_Teach.razor index 70dc41c..98ba270 100644 --- a/Components/LessonType_Teach.razor +++ b/Components/LessonPage/LessonType_Teach.razor @@ -8,9 +8,10 @@ @{ VocabHeader Term = Logic.Included[0]; - - -

@Term.RU

+ //
+ +

@Term.RU

+ //
(@Term.EN)
if(Term.Category == "Noun") @@ -30,6 +31,11 @@ @code { + protected override void OnInitialized() + { + PlayOneShot(); + } + void Done() { Logic.Results.Add(Logic.Included[0].RU, true); diff --git a/Components/LessonType_VowelChange.razor b/Components/LessonPage/LessonType_VowelChange.razor similarity index 98% rename from Components/LessonType_VowelChange.razor rename to Components/LessonPage/LessonType_VowelChange.razor index 1b49439..efd3ec6 100644 --- a/Components/LessonType_VowelChange.razor +++ b/Components/LessonPage/LessonType_VowelChange.razor @@ -7,10 +7,8 @@
@{ VocabHeader Term = Logic.Included[0]; -

@Term.EN

- }
@@ -28,6 +26,7 @@ protected override void OnInitialized() { + PlayOneShot(); NormalIndex = Rand.Next(0, 4); Generated.Add(Logic.Included[0].RU); } diff --git a/Components/OpenMojiWatermark.razor b/Components/LessonPage/OpenMojiWatermark.razor similarity index 100% rename from Components/OpenMojiWatermark.razor rename to Components/LessonPage/OpenMojiWatermark.razor diff --git a/Components/VocabIcon.razor b/Components/LessonPage/VocabIcon.razor similarity index 100% rename from Components/VocabIcon.razor rename to Components/LessonPage/VocabIcon.razor diff --git a/Components/LessonTypeMatch.txt b/Components/LessonTypeMatch.txt deleted file mode 100644 index 6215a7c..0000000 --- a/Components/LessonTypeMatch.txt +++ /dev/null @@ -1,162 +0,0 @@ -@inject LessonService Lessons -@inject ProfileService Profile - -

Select Matching Words

- -@if (State == null) -{ - return; -} - -@if(State.Key != "") -{ -
-
- @for (int i = 0; i < Lessons.LessonHeaders[State.Key].Vocab.Count; i++) - { - int Index = i; - VocabHeader Item = Lessons.VocabHeaders[Lessons.LessonHeaders[State.Key].Vocab[Index]]; - - } -
-
- @for (int i = 0; i < Lessons.LessonHeaders[State.Key].Vocab.Count; i++) - { - int Index = i; - VocabHeader Item = Lessons.VocabHeaders[Lessons.LessonHeaders[State.Key].Vocab[Index]]; - - } -
-
-} else -{ - -} - - - -@code -{ - [Parameter, EditorRequired] - public LessonStateData State {get; set;} = default!; - - [Parameter] - public EventCallback StateChanged { get; set; } - - [Parameter, EditorRequired] - public Action? OnFinish { get; set; } - - string Active = ""; - - void Select(string Chosen) - { - if (Active == "") - { - Active = Chosen; - } - else - { - if (Lessons.VocabHeaders.ContainsKey(Chosen)) //if Chosen is Russian - { - if (!Lessons.VocabHeaders.ContainsKey(Active)) //if Active is English - { - - if (Lessons.VocabHeaders[Chosen].EN == Active) - { - State.Tested.Add(Chosen); - State.Results.Add(true); - StateChanged.InvokeAsync(State); - - Active = ""; - } - else - { - //State.Tested.Add(Chosen); - //State.Results.Add(false); - //StateChanged.InvokeAsync(State); - - Active = ""; - } - } - else - { - Active = Chosen; - } - } - else //if Chosen is English - { - if (Lessons.VocabHeaders.ContainsKey(Active)) //if Active is Russian - { - if (Lessons.VocabHeaders[Active].EN == Chosen) - { - State.Tested.Add(Active); - State.Results.Add(true); - StateChanged.InvokeAsync(State); - - Active = ""; - } - else - { - - //State.Tested.Add(Active); - //State.Results.Add(false); - //StateChanged.InvokeAsync(State); - - Active = ""; - } - } - else - { - Active = Chosen; - } - } - } - - if (State.Tested.Count == Lessons.LessonHeaders[State.Key].Vocab.Count) - OnFinish?.Invoke(); - - /* - if (RightSelected != -1) - { - if (Index == RightSelected) - { - State.Tested.Add(Lessons.LessonHeaders[State.Key].Vocab[Index]); - State.Results.Add(true); - StateChanged.InvokeAsync(State); - - LeftSelected = -1; - RightSelected = -1; - - if (State.Tested.Count == Lessons.LessonHeaders[State.Key].Vocab.Count) - OnFinish?.Invoke(); - } - else - { - LeftSelected = Index; - } - }*/ - } - } \ No newline at end of file diff --git a/Components/NoLearnedTerms.razor b/Components/NoLearnedTerms.razor index 226f976..fc13c88 100644 --- a/Components/NoLearnedTerms.razor +++ b/Components/NoLearnedTerms.razor @@ -2,5 +2,5 @@

You haven't learned any terms.


- +
\ No newline at end of file diff --git a/Components/TermProgress.razor b/Components/ProgressPage/TermProgress.razor similarity index 100% rename from Components/TermProgress.razor rename to Components/ProgressPage/TermProgress.razor diff --git a/Pages/DeveloperPage.razor b/Pages/DeveloperPage.razor index 68992d9..8ae6fa6 100644 --- a/Pages/DeveloperPage.razor +++ b/Pages/DeveloperPage.razor @@ -1,5 +1,6 @@ @page "/developer" @using Vetra.Components +@using Vetra.Components.ProgressPage @using System.Text.Json @using System.Text.Encodings.Web; @using System.Linq; @@ -120,7 +121,6 @@ string Status = ""; string AllKeys = ""; string EditTerm = ""; - string TermStatus = ""; protected override void OnInitialized() { diff --git a/Pages/LearnPage.razor b/Pages/LearnPage.razor index fe67db0..5f523bc 100644 --- a/Pages/LearnPage.razor +++ b/Pages/LearnPage.razor @@ -1,5 +1,5 @@ @page "/" -@using Vetra.Components +@using Vetra.Components.LearnPage Vetra - Learn diff --git a/Pages/LessonPage.razor b/Pages/LessonPage.razor index 8a5184f..9734726 100644 --- a/Pages/LessonPage.razor +++ b/Pages/LessonPage.razor @@ -1,6 +1,7 @@ @page "/Lesson/{URL}" @inherits PracticePageBase @using Vetra.Components +@using Vetra.Components.LessonPage Vetra - Lesson @@ -46,7 +47,7 @@ else

You have finished this lesson!


- + } diff --git a/Pages/PracticePage.razor b/Pages/PracticePage.razor index ec31e25..656bbd0 100644 --- a/Pages/PracticePage.razor +++ b/Pages/PracticePage.razor @@ -1,6 +1,7 @@ @page "/Practice" @inherits PracticePageBase @using Vetra.Components +@using Vetra.Components.LessonPage Vetra - Practice @@ -38,7 +39,7 @@ else

You have finished all of your terms!


- + } diff --git a/Pages/ProgressPage.razor b/Pages/ProgressPage.razor index 827deb5..eca7832 100644 --- a/Pages/ProgressPage.razor +++ b/Pages/ProgressPage.razor @@ -1,5 +1,6 @@ @page "/progress" @using Vetra.Components +@using Vetra.Components.ProgressPage @inject ProfileService Profile Vetra - Progress diff --git a/Program.cs b/Program.cs index accfc5b..b9717c0 100644 --- a/Program.cs +++ b/Program.cs @@ -13,7 +13,7 @@ builder.Services.AddBlazorBootstrap(); builder.Services.AddSingleton(); -//builder.Services.AddSingleton(); +builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton();