1- using System ;
2- using System . Diagnostics ;
31using Abies . Conduit . Routing ;
4- using Abies ;
5- using static Abies . Option . Extensions ;
6- using static Abies . Html . Elements ;
7- using static Abies . Html . Attributes ;
8- using static Abies . Html . Events ;
9- using Abies . Html ;
102using static Abies . Conduit . Main . Message . Event ;
113using static Abies . UrlRequest ;
12- using static Abies . Url ;
134using static Abies . Navigation . Command ;
14- using System . Collections . Generic ;
155
166namespace Abies . Conduit . Main ;
177
@@ -20,13 +10,13 @@ public record struct UserName(string Value);
2010
2111public record struct Slug ( string Value ) ;
2212
23- public record Model ( Page Page , Route CurrentRoute ) ;
13+ public record Model ( Page Page , Routing . Route CurrentRoute ) ;
2414
2515public interface Message : Abies . Message
2616{
2717 public interface Command : Message
2818 {
29- public sealed record ChangeRoute ( Route ? Route ) : Command ;
19+ public sealed record ChangeRoute ( Routing . Route ? Route ) : Command ;
3020 }
3121
3222 public interface Event : Message
@@ -66,17 +56,17 @@ public class Application : Application<Model, Arguments>
6656 /// <returns>The next model.</returns>
6757 private static Model GetNextModel ( Url url )
6858 {
69- Route currentRoute = Route . FromUrl ( Route . Match , url ) ;
59+ Routing . Route currentRoute = Routing . Route . FromUrl ( Routing . Route . Match , url ) ;
7060 return currentRoute switch
7161 {
72- Route . Home => new ( new Page . Home ( new Conduit . Page . Home . Model ( ) ) , currentRoute ) ,
73- Route . Settings => new ( new Page . Settings ( new Conduit . Page . Settings . Model ( ) ) , currentRoute ) ,
74- Route . Login => new ( new Page . Login ( new Conduit . Page . Login . Model ( ) ) , currentRoute ) ,
75- Route . Register => new ( new Page . Register ( new Conduit . Page . Register . Model ( ) ) , currentRoute ) ,
76- Route . Profile profile => new ( new Page . Profile ( new Conduit . Page . Profile . Model ( profile . UserName ) ) , currentRoute ) ,
77- Route . Article article => new ( new Page . Article ( new Conduit . Page . Article . Model ( article . Slug ) ) , currentRoute ) ,
78- Route . Redirect => new ( new Page . Redirect ( ) , currentRoute ) ,
79- Route . NewArticle => new ( new Page . NewArticle ( new Conduit . Page . Article . Model ( new Slug ( "" ) ) ) , currentRoute ) ,
62+ Routing . Route . Home => new ( new Page . Home ( new Conduit . Page . Home . Model ( ) ) , currentRoute ) ,
63+ Routing . Route . Settings => new ( new Page . Settings ( new Conduit . Page . Settings . Model ( ) ) , currentRoute ) ,
64+ Routing . Route . Login => new ( new Page . Login ( new Conduit . Page . Login . Model ( ) ) , currentRoute ) ,
65+ Routing . Route . Register => new ( new Page . Register ( new Conduit . Page . Register . Model ( ) ) , currentRoute ) ,
66+ Routing . Route . Profile profile => new ( new Page . Profile ( new Conduit . Page . Profile . Model ( profile . UserName ) ) , currentRoute ) ,
67+ Routing . Route . Article article => new ( new Page . Article ( new Conduit . Page . Article . Model ( article . Slug ) ) , currentRoute ) ,
68+ Routing . Route . Redirect => new ( new Page . Redirect ( ) , currentRoute ) ,
69+ Routing . Route . NewArticle => new ( new Page . NewArticle ( new Conduit . Page . Article . Model ( new Slug ( "" ) ) ) , currentRoute ) ,
8070 _ => new ( new Page . NotFound ( ) , currentRoute ) ,
8171 } ;
8272 }
@@ -101,8 +91,8 @@ private static (Model model, IEnumerable<Command>) HandleUrlChanged(Url url, Mod
10191 private static ( Model model , IEnumerable < Command > ) HandleLinkClicked ( UrlRequest urlRequest , Model model )
10292 => urlRequest switch
10393 {
104- Internal @internal => ( model with { CurrentRoute = Route . FromUrl ( Route . Match , @internal . Url ) } , new List < Command > { new PushState ( @internal . Url ) } ) ,
105- External externalUrl => ( model , new List < Command > { new Load ( Create ( new Decoded . String ( externalUrl . Url ) ) ) } ) ,
94+ Internal @internal => ( model with { CurrentRoute = Abies . Conduit . Routing . Route . FromUrl ( Abies . Conduit . Routing . Route . Match , @internal . Url ) } , new List < Command > { new PushState ( @internal . Url ) } ) ,
95+ External externalUrl => ( model , new List < Command > { new Load ( Url . Create ( externalUrl . Url ) ) } ) ,
10696 _ => ( model , new List < Command > ( ) )
10797 } ;
10898
0 commit comments