From 51e7e1b8687f889f0773cfeade3f75a320676c20 Mon Sep 17 00:00:00 2001 From: Michel Michels Date: Thu, 25 Apr 2024 23:30:14 +0200 Subject: [PATCH] Add a demo Blazor app for the API wrapper --- MicheMichels.ViesSharp.sln | 6 + images/logo.png | Bin 2312 -> 0 bytes images/screenshot.png | Bin 6347 -> 0 bytes .../Components/App.razor | 27 +++ .../Components/Layout/MainLayout.razor | 9 + .../Components/Layout/MainLayout.razor.css | 96 ++++++++++ .../Components/Layout/NavMenu.razor | 30 ++++ .../Components/Layout/NavMenu.razor.css | 105 +++++++++++ .../Components/Pages/Counter.razor | 19 ++ .../Components/Pages/Error.razor | 36 ++++ .../Components/Pages/Home.razor | 167 ++++++++++++++++++ .../Components/Pages/Home.razor.css | 7 + .../Components/Pages/Weather.razor | 64 +++++++ .../Components/Routes.razor | 6 + .../Components/_Imports.razor | 10 ++ .../MichelMichels.ViesSharp.Demo.csproj | 13 ++ src/MichelMichels.ViesSharp.Demo/Program.cs | 31 ++++ .../Properties/launchSettings.json | 38 ++++ .../appsettings.Development.json | 8 + .../appsettings.json | 9 + .../wwwroot/app.css | 0 .../wwwroot/favicon.png | Bin 0 -> 1148 bytes 22 files changed, 681 insertions(+) delete mode 100644 images/logo.png delete mode 100644 images/screenshot.png create mode 100644 src/MichelMichels.ViesSharp.Demo/Components/App.razor create mode 100644 src/MichelMichels.ViesSharp.Demo/Components/Layout/MainLayout.razor create mode 100644 src/MichelMichels.ViesSharp.Demo/Components/Layout/MainLayout.razor.css create mode 100644 src/MichelMichels.ViesSharp.Demo/Components/Layout/NavMenu.razor create mode 100644 src/MichelMichels.ViesSharp.Demo/Components/Layout/NavMenu.razor.css create mode 100644 src/MichelMichels.ViesSharp.Demo/Components/Pages/Counter.razor create mode 100644 src/MichelMichels.ViesSharp.Demo/Components/Pages/Error.razor create mode 100644 src/MichelMichels.ViesSharp.Demo/Components/Pages/Home.razor create mode 100644 src/MichelMichels.ViesSharp.Demo/Components/Pages/Home.razor.css create mode 100644 src/MichelMichels.ViesSharp.Demo/Components/Pages/Weather.razor create mode 100644 src/MichelMichels.ViesSharp.Demo/Components/Routes.razor create mode 100644 src/MichelMichels.ViesSharp.Demo/Components/_Imports.razor create mode 100644 src/MichelMichels.ViesSharp.Demo/MichelMichels.ViesSharp.Demo.csproj create mode 100644 src/MichelMichels.ViesSharp.Demo/Program.cs create mode 100644 src/MichelMichels.ViesSharp.Demo/Properties/launchSettings.json create mode 100644 src/MichelMichels.ViesSharp.Demo/appsettings.Development.json create mode 100644 src/MichelMichels.ViesSharp.Demo/appsettings.json create mode 100644 src/MichelMichels.ViesSharp.Demo/wwwroot/app.css create mode 100644 src/MichelMichels.ViesSharp.Demo/wwwroot/favicon.png diff --git a/MicheMichels.ViesSharp.sln b/MicheMichels.ViesSharp.sln index df4eb30..ca71755 100644 --- a/MicheMichels.ViesSharp.sln +++ b/MicheMichels.ViesSharp.sln @@ -15,6 +15,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution README.md = README.md EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MichelMichels.ViesSharp.Demo", "src\MichelMichels.ViesSharp.Demo\MichelMichels.ViesSharp.Demo.csproj", "{C44932BA-BB8C-4300-B4AC-0D667D87F3F8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -29,6 +31,10 @@ Global {5F23ABCD-1CF5-4C0B-8129-4654816007AD}.Debug|Any CPU.Build.0 = Debug|Any CPU {5F23ABCD-1CF5-4C0B-8129-4654816007AD}.Release|Any CPU.ActiveCfg = Release|Any CPU {5F23ABCD-1CF5-4C0B-8129-4654816007AD}.Release|Any CPU.Build.0 = Release|Any CPU + {C44932BA-BB8C-4300-B4AC-0D667D87F3F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C44932BA-BB8C-4300-B4AC-0D667D87F3F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C44932BA-BB8C-4300-B4AC-0D667D87F3F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C44932BA-BB8C-4300-B4AC-0D667D87F3F8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/images/logo.png b/images/logo.png deleted file mode 100644 index 0f38ba9369899ff527b5b81b77c7518185f8a18a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2312 zcmV+j3HSDiP)CLJYzcIwAce4upp!L< zZqZCM{$n=U!4S<136S8A#Hbe|VuFcr3W-jnE3gfRQ6R!_Dt8NPQA|d4?bgKzjHP8k zfo<(r_M^u?t~Bkvx9>gg%{lKm_rA|3Ie+xt^FHT!pZnx|&yTm~Ra$G}a>c1%ECAL3 ztAQmz7H9z)V;f5kCxPMrm%jr~0s97;zdG*IDHSIHt{D5}HNbtqDxkrYQz_yY@MGZT z10VRxX&(+4B|yjM=DENoU>%@bJC#C?0Cx?}y#04cH(W6RI!1rh20R0_CE`(f(ZKhC zdk1HJIleAeNn`?aoP2m0unV{_DTf3e1=bJFx-F3;XqxVe%TGL%4fv*D}HN30^xE^@Pm0wfF088KQn*+QBWDKr73Vd>CUe94i zzSSj5-|lOmu$uZU!%H3*n%DCUSN=@xUbN~&s|;FUP;QqWKR!eAddAV}+i11dFwRbA zVnzC*vWD8!KQzC4r%T7`nW6dJ;v=TtPMFPCyKi(n%9tk1dG7IoY0Pz+H z@QVL<7jFj(2@*oQol3xx*PrSFx~v*CBme3pH{~l;a^>Hvm)w*ys#yOLpt=BGkC^8x zS8?WF&a7Hs31E9v8p0?y3g729BJ5@0t*3paEDE35RT6s=6! zbVq0jpe;{JV%W>S(e~+FrAikc{$mb{32>xsRUWg%bAs)7S3@X0fFFCl3E+NeYb7v* zQIky!@8{w}yK-f&{4a%LXO9B=-)R5T*=k$}MFPCo^G%HVskC8re9@slJqPRnet)$6 zM&t8`i~l>=yqFNWJ>SH+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W7ujyNe}qu99>Zmcg|l8YgJu&j>)>yZBfr)3Dk diff --git a/src/MichelMichels.ViesSharp.Demo/Components/App.razor b/src/MichelMichels.ViesSharp.Demo/Components/App.razor new file mode 100644 index 0000000..02d39d3 --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/Components/App.razor @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/MichelMichels.ViesSharp.Demo/Components/Layout/MainLayout.razor b/src/MichelMichels.ViesSharp.Demo/Components/Layout/MainLayout.razor new file mode 100644 index 0000000..a7ebcef --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/Components/Layout/MainLayout.razor @@ -0,0 +1,9 @@ +@inherits LayoutComponentBase + +@Body + +
+ An unhandled error has occurred. + Reload + 🗙 +
\ No newline at end of file diff --git a/src/MichelMichels.ViesSharp.Demo/Components/Layout/MainLayout.razor.css b/src/MichelMichels.ViesSharp.Demo/Components/Layout/MainLayout.razor.css new file mode 100644 index 0000000..038baf1 --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/Components/Layout/MainLayout.razor.css @@ -0,0 +1,96 @@ +.page { + position: relative; + display: flex; + flex-direction: column; +} + +main { + flex: 1; +} + +.sidebar { + background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); +} + +.top-row { + background-color: #f7f7f7; + border-bottom: 1px solid #d6d5d5; + justify-content: flex-end; + height: 3.5rem; + display: flex; + align-items: center; +} + + .top-row ::deep a, .top-row ::deep .btn-link { + white-space: nowrap; + margin-left: 1.5rem; + text-decoration: none; + } + + .top-row ::deep a:hover, .top-row ::deep .btn-link:hover { + text-decoration: underline; + } + + .top-row ::deep a:first-child { + overflow: hidden; + text-overflow: ellipsis; + } + +@media (max-width: 640.98px) { + .top-row { + justify-content: space-between; + } + + .top-row ::deep a, .top-row ::deep .btn-link { + margin-left: 0; + } +} + +@media (min-width: 641px) { + .page { + flex-direction: row; + } + + .sidebar { + width: 250px; + height: 100vh; + position: sticky; + top: 0; + } + + .top-row { + position: sticky; + top: 0; + z-index: 1; + } + + .top-row.auth ::deep a:first-child { + flex: 1; + text-align: right; + width: 0; + } + + .top-row, article { + padding-left: 2rem !important; + padding-right: 1.5rem !important; + } +} + +#blazor-error-ui { + background: lightyellow; + bottom: 0; + box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); + display: none; + left: 0; + padding: 0.6rem 1.25rem 0.7rem 1.25rem; + position: fixed; + width: 100%; + z-index: 1000; +} + + #blazor-error-ui .dismiss { + cursor: pointer; + position: absolute; + right: 0.75rem; + top: 0.5rem; + } diff --git a/src/MichelMichels.ViesSharp.Demo/Components/Layout/NavMenu.razor b/src/MichelMichels.ViesSharp.Demo/Components/Layout/NavMenu.razor new file mode 100644 index 0000000..27c456b --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/Components/Layout/NavMenu.razor @@ -0,0 +1,30 @@ + + + + + + diff --git a/src/MichelMichels.ViesSharp.Demo/Components/Layout/NavMenu.razor.css b/src/MichelMichels.ViesSharp.Demo/Components/Layout/NavMenu.razor.css new file mode 100644 index 0000000..4e15395 --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/Components/Layout/NavMenu.razor.css @@ -0,0 +1,105 @@ +.navbar-toggler { + appearance: none; + cursor: pointer; + width: 3.5rem; + height: 2.5rem; + color: white; + position: absolute; + top: 0.5rem; + right: 1rem; + border: 1px solid rgba(255, 255, 255, 0.1); + background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center/1.75rem rgba(255, 255, 255, 0.1); +} + +.navbar-toggler:checked { + background-color: rgba(255, 255, 255, 0.5); +} + +.top-row { + height: 3.5rem; + background-color: rgba(0,0,0,0.4); +} + +.navbar-brand { + font-size: 1.1rem; +} + +.bi { + display: inline-block; + position: relative; + width: 1.25rem; + height: 1.25rem; + margin-right: 0.75rem; + top: -1px; + background-size: cover; +} + +.bi-house-door-fill-nav-menu { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E"); +} + +.bi-plus-square-fill-nav-menu { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E"); +} + +.bi-list-nested-nav-menu { + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E"); +} + +.nav-item { + font-size: 0.9rem; + padding-bottom: 0.5rem; +} + + .nav-item:first-of-type { + padding-top: 1rem; + } + + .nav-item:last-of-type { + padding-bottom: 1rem; + } + + .nav-item ::deep .nav-link { + color: #d7d7d7; + background: none; + border: none; + border-radius: 4px; + height: 3rem; + display: flex; + align-items: center; + line-height: 3rem; + width: 100%; + } + +.nav-item ::deep a.active { + background-color: rgba(255,255,255,0.37); + color: white; +} + +.nav-item ::deep .nav-link:hover { + background-color: rgba(255,255,255,0.1); + color: white; +} + +.nav-scrollable { + display: none; +} + +.navbar-toggler:checked ~ .nav-scrollable { + display: block; +} + +@media (min-width: 641px) { + .navbar-toggler { + display: none; + } + + .nav-scrollable { + /* Never collapse the sidebar for wide screens */ + display: block; + + /* Allow sidebar to scroll for tall menus */ + height: calc(100vh - 3.5rem); + overflow-y: auto; + } +} diff --git a/src/MichelMichels.ViesSharp.Demo/Components/Pages/Counter.razor b/src/MichelMichels.ViesSharp.Demo/Components/Pages/Counter.razor new file mode 100644 index 0000000..1a4f8e7 --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/Components/Pages/Counter.razor @@ -0,0 +1,19 @@ +@page "/counter" +@rendermode InteractiveServer + +Counter + +

Counter

+ +

Current count: @currentCount

+ + + +@code { + private int currentCount = 0; + + private void IncrementCount() + { + currentCount++; + } +} diff --git a/src/MichelMichels.ViesSharp.Demo/Components/Pages/Error.razor b/src/MichelMichels.ViesSharp.Demo/Components/Pages/Error.razor new file mode 100644 index 0000000..576cc2d --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/Components/Pages/Error.razor @@ -0,0 +1,36 @@ +@page "/Error" +@using System.Diagnostics + +Error + +

Error.

+

An error occurred while processing your request.

+ +@if (ShowRequestId) +{ +

+ Request ID: @RequestId +

+} + +

Development Mode

+

+ Swapping to Development environment will display more detailed information about the error that occurred. +

+

+ The Development environment shouldn't be enabled for deployed applications. + It can result in displaying sensitive information from exceptions to end users. + For local debugging, enable the Development environment by setting the ASPNETCORE_ENVIRONMENT environment variable to Development + and restarting the app. +

+ +@code{ + [CascadingParameter] + private HttpContext? HttpContext { get; set; } + + private string? RequestId { get; set; } + private bool ShowRequestId => !string.IsNullOrEmpty(RequestId); + + protected override void OnInitialized() => + RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier; +} diff --git a/src/MichelMichels.ViesSharp.Demo/Components/Pages/Home.razor b/src/MichelMichels.ViesSharp.Demo/Components/Pages/Home.razor new file mode 100644 index 0000000..f7cec3f --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/Components/Pages/Home.razor @@ -0,0 +1,167 @@ +@page "/" + +@rendermode InteractiveServer + +@using System.Diagnostics +@using MichelMichels.ViesSharp; +@using MichelMichels.ViesSharp.Exceptions +@using MichelMichels.ViesSharp.Models +@using System.Text.Json + +@inject IViesSharpClient viesSharpClient; + +ViesSharp | Demo +
+
+
+
+

ViesSharp

+

By Michel Michels

+
+ +
+
+

Search

+ +
+ + + + + +
+ +
+ + + + + +
+
+
+ + +
+

Result

+ + @if(LastResponse is not null) + { +
+
+ + +

@LastResponse.Name

+

@LastResponse.Address

+ + +
+
+                                    @Json
+                                
+
+ +
+
+ } else + { +
+ +

Lookup a VAT number!

+
+ } + +
+ + +
+

History

+ +
+ + @for (int i = 0; i < History.Count; i++) + { + VatNumberResponse response = History[i]; + +
+

+ +

+
+
+
+                                        @(JsonSerializer.Serialize(response, defaultSerializerOptions))
+                                    
+
+
+
+ } +
+
+
+
+ +
+ +@code +{ + private JsonSerializerOptions defaultSerializerOptions = new() + { + WriteIndented = true, + }; + + public string? VatNumber { get; set; } + public string Json { get; set; } = string.Empty; + public string SelectedCountryCode { get; set; } = string.Empty; + public bool IsLookupEnabled => !string.IsNullOrEmpty(SelectedCountryCode); + public List CountryCodes = []; + public VatNumberResponse? LastResponse { get; set; } + public List History = []; + public string BackgroundClass { get; set; } = string.Empty; + + protected override async Task OnInitializedAsync() + { + StatusResponse statusResponse = await viesSharpClient.CheckStatus(); + CountryCodes = statusResponse.Countries.Select(x => x.CountryCode).ToList(); + } + + public async Task Lookup() + { + VatNumberRequest request = new() + { + CountryCode = SelectedCountryCode, + VatNumber = VatNumber ?? string.Empty, + }; + + try + { + if(LastResponse is not null) + { + History.Add(LastResponse); + } + + LastResponse = await viesSharpClient.CheckVatNumber(request); + BackgroundClass = LastResponse.IsValid ? "bg-success" : "bg-danger"; + Json = JsonSerializer.Serialize(LastResponse, defaultSerializerOptions); + } catch(ViesSharpException ex) + { + Json = JsonSerializer.Serialize(ex.ErrorResponse, defaultSerializerOptions); + } + } +} diff --git a/src/MichelMichels.ViesSharp.Demo/Components/Pages/Home.razor.css b/src/MichelMichels.ViesSharp.Demo/Components/Pages/Home.razor.css new file mode 100644 index 0000000..937096c --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/Components/Pages/Home.razor.css @@ -0,0 +1,7 @@ +h1, h2,p { + font-family: 'Montserrat', 'sans-serif'; +} + +a { + text-decoration: none; +} \ No newline at end of file diff --git a/src/MichelMichels.ViesSharp.Demo/Components/Pages/Weather.razor b/src/MichelMichels.ViesSharp.Demo/Components/Pages/Weather.razor new file mode 100644 index 0000000..43a1ecb --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/Components/Pages/Weather.razor @@ -0,0 +1,64 @@ +@page "/weather" +@attribute [StreamRendering] + +Weather + +

Weather

+ +

This component demonstrates showing data.

+ +@if (forecasts == null) +{ +

Loading...

+} +else +{ + + + + + + + + + + + @foreach (var forecast in forecasts) + { + + + + + + + } + +
DateTemp. (C)Temp. (F)Summary
@forecast.Date.ToShortDateString()@forecast.TemperatureC@forecast.TemperatureF@forecast.Summary
+} + +@code { + private WeatherForecast[]? forecasts; + + protected override async Task OnInitializedAsync() + { + // Simulate asynchronous loading to demonstrate streaming rendering + await Task.Delay(500); + + var startDate = DateOnly.FromDateTime(DateTime.Now); + var summaries = new[] { "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" }; + forecasts = Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = startDate.AddDays(index), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = summaries[Random.Shared.Next(summaries.Length)] + }).ToArray(); + } + + private class WeatherForecast + { + public DateOnly Date { get; set; } + public int TemperatureC { get; set; } + public string? Summary { get; set; } + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + } +} diff --git a/src/MichelMichels.ViesSharp.Demo/Components/Routes.razor b/src/MichelMichels.ViesSharp.Demo/Components/Routes.razor new file mode 100644 index 0000000..f756e19 --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/Components/Routes.razor @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/MichelMichels.ViesSharp.Demo/Components/_Imports.razor b/src/MichelMichels.ViesSharp.Demo/Components/_Imports.razor new file mode 100644 index 0000000..d6bf715 --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/Components/_Imports.razor @@ -0,0 +1,10 @@ +@using System.Net.Http +@using System.Net.Http.Json +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using static Microsoft.AspNetCore.Components.Web.RenderMode +@using Microsoft.AspNetCore.Components.Web.Virtualization +@using Microsoft.JSInterop +@using MichelMichels.ViesSharp.Demo +@using MichelMichels.ViesSharp.Demo.Components diff --git a/src/MichelMichels.ViesSharp.Demo/MichelMichels.ViesSharp.Demo.csproj b/src/MichelMichels.ViesSharp.Demo/MichelMichels.ViesSharp.Demo.csproj new file mode 100644 index 0000000..ca20e08 --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/MichelMichels.ViesSharp.Demo.csproj @@ -0,0 +1,13 @@ + + + + net8.0 + enable + enable + + + + + + + diff --git a/src/MichelMichels.ViesSharp.Demo/Program.cs b/src/MichelMichels.ViesSharp.Demo/Program.cs new file mode 100644 index 0000000..05cd2ba --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/Program.cs @@ -0,0 +1,31 @@ +using MichelMichels.ViesSharp; +using MichelMichels.ViesSharp.Demo.Components; + +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddSingleton(); + +// Add services to the container. +builder.Services + .AddRazorComponents() + .AddInteractiveServerComponents(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (!app.Environment.IsDevelopment()) +{ + app.UseExceptionHandler("/Error", createScopeForErrors: true); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); +} + +app.UseHttpsRedirection(); + +app.UseStaticFiles(); +app.UseAntiforgery(); + +app.MapRazorComponents() + .AddInteractiveServerRenderMode(); + +app.Run(); diff --git a/src/MichelMichels.ViesSharp.Demo/Properties/launchSettings.json b/src/MichelMichels.ViesSharp.Demo/Properties/launchSettings.json new file mode 100644 index 0000000..c6df577 --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/Properties/launchSettings.json @@ -0,0 +1,38 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:41313", + "sslPort": 44308 + } + }, + "profiles": { + "http": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "http://localhost:5183", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "https": { + "commandName": "Project", + "dotnetRunMessages": true, + "launchBrowser": true, + "applicationUrl": "https://localhost:7029;http://localhost:5183", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } + } diff --git a/src/MichelMichels.ViesSharp.Demo/appsettings.Development.json b/src/MichelMichels.ViesSharp.Demo/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/src/MichelMichels.ViesSharp.Demo/appsettings.json b/src/MichelMichels.ViesSharp.Demo/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/src/MichelMichels.ViesSharp.Demo/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/src/MichelMichels.ViesSharp.Demo/wwwroot/app.css b/src/MichelMichels.ViesSharp.Demo/wwwroot/app.css new file mode 100644 index 0000000..e69de29 diff --git a/src/MichelMichels.ViesSharp.Demo/wwwroot/favicon.png b/src/MichelMichels.ViesSharp.Demo/wwwroot/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..8422b59695935d180d11d5dbe99653e711097819 GIT binary patch literal 1148 zcmV-?1cUpDP)9h26h2-Cs%i*@Moc3?#6qJID|D#|3|2Hn7gTIYEkr|%Xjp);YgvFmB&0#2E2b=| zkVr)lMv9=KqwN&%obTp-$<51T%rx*NCwceh-E+=&e(oLO`@Z~7gybJ#U|^tB2Pai} zRN@5%1qsZ1e@R(XC8n~)nU1S0QdzEYlWPdUpH{wJ2Pd4V8kI3BM=)sG^IkUXF2-j{ zrPTYA6sxpQ`Q1c6mtar~gG~#;lt=s^6_OccmRd>o{*=>)KS=lM zZ!)iG|8G0-9s3VLm`bsa6e ze*TlRxAjXtm^F8V`M1%s5d@tYS>&+_ga#xKGb|!oUBx3uc@mj1%=MaH4GR0tPBG_& z9OZE;->dO@`Q)nr<%dHAsEZRKl zedN6+3+uGHejJp;Q==pskSAcRcyh@6mjm2z-uG;s%dM-u0*u##7OxI7wwyCGpS?4U zBFAr(%GBv5j$jS@@t@iI8?ZqE36I^4t+P^J9D^ELbS5KMtZ z{Qn#JnSd$15nJ$ggkF%I4yUQC+BjDF^}AtB7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