Skip to content

Commit 0da51e1

Browse files
committed
lots of lessons for path; show full data in results
1 parent 24201c1 commit 0da51e1

File tree

14 files changed

+475
-23
lines changed

14 files changed

+475
-23
lines changed

LearnJsonEverything.LessonEditor/Controls/Editor.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<Grid Grid.Column="1" Margin="5">
5656
<Grid.RowDefinitions>
5757
<RowDefinition Height="Auto"/>
58-
<RowDefinition/>
58+
<RowDefinition Height="3*"/>
5959
<RowDefinition Height="Auto"/>
6060
<RowDefinition/>
6161
</Grid.RowDefinitions>
@@ -78,7 +78,7 @@
7878
CodeContent="{Binding SelectedLesson.InitialCode, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
7979
<local:CodeInput Grid.Row="1" Label="Solution" Margin="0,5,5,5"
8080
CodeContent="{Binding SelectedLesson.Solution, ElementName=Self, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
81-
<local:CodeInput Grid.Row="2" Label="Solution" Margin="0,5,5,0"
81+
<local:CodeInput Grid.Row="2" Label="Output" Margin="0,5,5,0" IsEnabled="False"
8282
CodeContent="{Binding ValidationOutput, ElementName=Self}"/>
8383
<Button Grid.Row="1" Content="Copy from above" Click="CopyInitialToSolution"
8484
HorizontalAlignment="Right" VerticalAlignment="Top"

LearnJsonEverything.LessonEditor/Controls/Editor.xaml.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
using System.Text.Json.Nodes;
55
using System.Windows;
66
using System.Windows.Controls;
7-
using System.Windows.Data;
8-
using Json.More;
97
using LearnJsonEverything.Services;
10-
using LearnJsonEverything.Services.Runners;
8+
using LearnJsonEverything.Services.Hosts;
119

1210
namespace LearnJsonEverything.LessonEditor.Controls;
1311

@@ -92,7 +90,7 @@ public string ValidationOutput
9290
}
9391

9492
public static readonly DependencyProperty ValidationOutputProperty =
95-
DependencyProperty.Register(nameof(ValidationOutput), typeof(string), typeof(Editor), new PropertyMetadata(null, LoadFile));
93+
DependencyProperty.Register(nameof(ValidationOutput), typeof(string), typeof(Editor), new PropertyMetadata(null));
9694

9795
private void ValidateSolution(object sender, RoutedEventArgs e)
9896
{

LearnJsonEverything.LessonEditor/MainWindow.xaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:controls="clr-namespace:LearnJsonEverything.LessonEditor.Controls"
7-
xmlns:runners="clr-namespace:LearnJsonEverything.Services.Runners;assembly=LearnJsonEverything"
7+
xmlns:hosts="clr-namespace:LearnJsonEverything.Services.Hosts;assembly=LearnJsonEverything"
88
mc:Ignorable="d"
99
Title="MainWindow" Height="800" Width="1200"
1010
SnapsToDevicePixels="True"
1111
UseLayoutRounding="True"
1212
TextElement.FontSize="14"
1313
x:Name="Self">
1414
<Window.Resources>
15-
<runners:SchemaHost x:Key="SchemaHost"/>
16-
<runners:PathHost x:Key="PathHost"/>
15+
<hosts:SchemaHost x:Key="SchemaHost"/>
16+
<hosts:PathHost x:Key="PathHost"/>
1717
</Window.Resources>
1818
<TabControl>
1919
<TabItem Header="Schema">

LearnJsonEverything.LessonEditor/MainWindow.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
using System.Windows.Navigation;
1010
using System.Windows.Shapes;
1111
using LearnJsonEverything.Services;
12-
using LearnJsonEverything.Services.Runners;
1312

1413
namespace LearnJsonEverything.LessonEditor;
1514

LearnJsonEverything.Tests/ProvidedSolutionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Text.Json;
22
using LearnJsonEverything.Services;
3-
using LearnJsonEverything.Services.Runners;
3+
using LearnJsonEverything.Services.Hosts;
44

55
namespace LearnJsonEverything.Tests;
66

LearnJsonEverything/Pages/Path.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@page "/json-path"
2-
@using LearnJsonEverything.Services.Runners
2+
@using LearnJsonEverything.Services.Hosts
33

44
<Teacher LessonSource="/data/lessons/path.json" Host="@_host"></Teacher>
55

LearnJsonEverything/Pages/Schema.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@page "/json-schema"
2-
@using LearnJsonEverything.Services.Runners
2+
@using LearnJsonEverything.Services.Hosts
33

44
<Teacher LessonSource="/data/lessons/schema.json" Host="@_host"></Teacher>
55

LearnJsonEverything/Services/HelpContent.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ use the `json-everything` libraries to their full potential!
1111
provided by one of the libraries. For each lesson, you'll be given some background information,
1212
possibly some links to various documentation, and a coding challenge along with some test
1313
cases. Make all the tests pass to move on to the next lesson.
14+
15+
The site will let you build whatever solution you want, and many of the lessons can be
16+
solved in different ways. If you get stuck, there is a recommended solution that you can
17+
view at any time.
1418
1519
Want to skip ahead and work on a particular lesson? No problem: simply select the lesson
1620
you'd like to work on from the pane on the left. The navigation buttons will activate as
@@ -23,7 +27,7 @@ either to continue learning or to review the work you've done.
2327
2428
You can click <kbd>Reveal Solution</kbd> at any time to see the recommended solution, or
2529
<kbd>Reset</kbd> to get the template back and clear the lesson state.
26-
30+
2731
---
2832
2933
**This site is 100% client-side. All operations are performed in your browser.**

LearnJsonEverything/Services/Runners/ILessonHost.cs renamed to LearnJsonEverything/Services/Hosts/ILessonHost.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace LearnJsonEverything.Services.Runners;
1+
namespace LearnJsonEverything.Services.Hosts;
22

33
public interface ILessonHost
44
{

LearnJsonEverything/Services/Runners/PathHost.cs renamed to LearnJsonEverything/Services/Hosts/PathHost.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Json.More;
22
using Json.Path;
33

4-
namespace LearnJsonEverything.Services.Runners;
4+
namespace LearnJsonEverything.Services.Hosts;
55

66
public class PathHost : ILessonHost
77
{
@@ -20,7 +20,7 @@ public string[] Run(LessonData lesson)
2020
var result = runner.Run(test.AsObject());
2121
var localResult = expectedResult.IsEquivalentTo(result?.Matches?.Select(x => x.Value).ToJsonArray());
2222
correct &= localResult;
23-
results.Add($"{(localResult ? Iconography.SuccessIcon : Iconography.ErrorIcon)} {test["data"]!.Print()}");
23+
results.Add($"{(localResult ? Iconography.SuccessIcon : Iconography.ErrorIcon)} {test.Print()}");
2424
}
2525

2626
lesson.Achieved |= correct;

0 commit comments

Comments
 (0)