Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to .NET 8, re-write, etc. #373

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<Project>
<PropertyGroup>
<AspNetCoreVersion>7.0.0</AspNetCoreVersion>
<BlazorVersion>7.0.0</BlazorVersion>
<EntityFrameworkVersion>7.0.0</EntityFrameworkVersion>
<TargetFrameworkVersion>net7.0</TargetFrameworkVersion>
<SystemNetHttpJsonVersion>7.0.0</SystemNetHttpJsonVersion>
</PropertyGroup>
<PropertyGroup>
<AspNetCoreVersion>8.0.8</AspNetCoreVersion>
<BlazorVersion>8.0.0</BlazorVersion>
<EntityFrameworkVersion>8.0.8</EntityFrameworkVersion>
<TargetFrameworkVersion>net8.0</TargetFrameworkVersion>
<SystemNetHttpJsonVersion>8.0.0</SystemNetHttpJsonVersion>
</PropertyGroup>
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
20 changes: 20 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<DefaultTargetFramework>$(TargetFrameworkVersion)</DefaultTargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="$(AspNetCoreVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="$(AspNetCoreVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="$(AspNetCoreVersion)" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="$(EntityFrameworkVersion)" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="$(EntityFrameworkVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly" Version="$(AspNetCoreVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="$(AspNetCoreVersion)" />
<PackageVersion Include="Microsoft.Extensions.Http" Version="$(SystemNetHttpJsonVersion)" />
<PackageVersion Include="System.Net.Http.Json" Version="$(SystemNetHttpJsonVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.Components" Version="$(AspNetCoreVersion)" />
<PackageVersion Include="Microsoft.AspNetCore.Components.Web" Version="$(AspNetCoreVersion)" />
<PackageVersion Include="WebPush" Version="1.0.12" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -2,12 +2,12 @@

<PropertyGroup>
<TargetFramework>$(TargetFrameworkVersion)</TargetFramework>
<Nullable>enable</Nullable>
<RootNamespace>BlazingPizza.TemplateComponents</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Components" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" />
</ItemGroup>

</Project>
2 changes: 2 additions & 0 deletions src/BlazingComponents/TemplatedDialog.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@if (Show)

{
<div class="dialog-container">
<div class="dialog">
@@ -9,5 +10,6 @@

@code {
[Parameter, EditorRequired] public RenderFragment? ChildContent { get; set; }

[Parameter] public bool Show { get; set; }
}
10 changes: 5 additions & 5 deletions src/BlazingComponents/TemplatedList.razor
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
@typeparam TItem

@if (items is null)
@if (_items is null)
{
@Loading
}
else if (!items.Any())
else if (_items.Any() is false)
{
@Empty
}
else
{
<div class="list-group @ListGroupClass">
@foreach (var item in items)
@foreach (var item in _items)
{
<div class="list-group-item">
@if (Item is not null)
@@ -24,7 +24,7 @@ else
}

@code {
IEnumerable<TItem>? items;
IEnumerable<TItem>? _items;

[Parameter, EditorRequired] public Func<Task<IEnumerable<TItem>>>? Loader { get; set; }
[Parameter] public RenderFragment? Loading { get; set; }
@@ -36,7 +36,7 @@ else
{
if (Loader is not null)
{
items = await Loader();
_items = await Loader();
}
}
}
19 changes: 0 additions & 19 deletions src/BlazingPizza.Client/App.razor

This file was deleted.

23 changes: 0 additions & 23 deletions src/BlazingPizza.Client/BlazingPizza.Client.csproj

This file was deleted.

11 changes: 0 additions & 11 deletions src/BlazingPizza.Client/JSRuntimeExtensions.cs

This file was deleted.

55 changes: 0 additions & 55 deletions src/BlazingPizza.Client/OrderState.cs

This file was deleted.

35 changes: 0 additions & 35 deletions src/BlazingPizza.Client/OrdersClient.cs

This file was deleted.

32 changes: 0 additions & 32 deletions src/BlazingPizza.Client/Pages/Authentication.razor

This file was deleted.

48 changes: 0 additions & 48 deletions src/BlazingPizza.Client/Pages/MyOrders.razor

This file was deleted.

97 changes: 0 additions & 97 deletions src/BlazingPizza.Client/Pages/OrderDetails.razor

This file was deleted.

8 changes: 0 additions & 8 deletions src/BlazingPizza.Client/PizzaAuthenticationState.cs

This file was deleted.

21 changes: 0 additions & 21 deletions src/BlazingPizza.Client/Program.cs

This file was deleted.

97 changes: 0 additions & 97 deletions src/BlazingPizza.Client/Shared/ConfigurePizzaDialog.razor

This file was deleted.

27 changes: 0 additions & 27 deletions src/BlazingPizza.Client/Shared/LoginDisplay.razor

This file was deleted.

7 changes: 0 additions & 7 deletions src/BlazingPizza.Client/Shared/RedirectToLogin.razor

This file was deleted.

This file was deleted.

This file was deleted.

40 changes: 0 additions & 40 deletions src/BlazingPizza.Client/wwwroot/css/font/quicksand.css

This file was deleted.

33 changes: 0 additions & 33 deletions src/BlazingPizza.Client/wwwroot/index.html

This file was deleted.

16 changes: 0 additions & 16 deletions src/BlazingPizza.Client/wwwroot/manifest.json

This file was deleted.

27 changes: 0 additions & 27 deletions src/BlazingPizza.Client/wwwroot/service-worker.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -2,17 +2,21 @@

<PropertyGroup>
<TargetFramework>$(TargetFrameworkVersion)</TargetFramework>
<ImplicitUsings>true</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>BlazingPizza.ComponentsLibrary</RootNamespace>
<NoWarn>IDE0130</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="$(AspNetCoreVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Components" />
<PackageReference Include="Microsoft.AspNetCore.Components.Web" />
</ItemGroup>

<ItemGroup>
<SupportedPlatform Include="browser" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BlazingPizza.Shared\BlazingPizza.Shared.csproj" />
</ItemGroup>

</Project>
15 changes: 0 additions & 15 deletions src/BlazingPizza.ComponentsLibrary/LocalStorage.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.JSInterop;

namespace BlazingPizza.ComponentsLibrary;

public sealed class LocalStorageJSInterop(IJSRuntime jsRuntime) : IAsyncDisposable
{
private readonly Lazy<Task<IJSObjectReference>> _moduleTask =
new(valueFactory: () => jsRuntime.InvokeAsync<IJSObjectReference>(
identifier: "import",
args: "./_content/BlazingPizza.ComponentsLibrary/localStorage.js").AsTask());

public async ValueTask<T> GetLocalStorageItemAsync<T>(string key)
{
var module = await _moduleTask.Value;

return await module.InvokeAsync<T>("getLocalStorageItem", key);
}

public async ValueTask SetLocalStorageItemAsync<T>(string key, T value)
{
var module = await _moduleTask.Value;

await module.InvokeVoidAsync("setLocalStorageItem", key, value);
}

public async ValueTask DeleteLocalStorageItemAsync(string key)
{
var module = await _moduleTask.Value;

await module.InvokeVoidAsync("deleteLocalStorageItem", key);
}

public async ValueTask DisposeAsync()
{
if (_moduleTask.IsValueCreated)
{
var module = await _moduleTask.Value;

await module.DisposeAsync();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using BlazingPizza.ComponentsLibrary;

namespace Microsoft.Extensions.DependencyInjection;

public static class LocalStorageServiceCollectionExtensions
{
/// <summary>
/// Adds the <see cref="LocalStorageJSInterop"/> as a scoped-lifetime service
/// to the given <paramref name="services"/> collection.
/// </summary>
/// <param name="services">The service collection to add services to.</param>
/// <returns>The same service instance given, with the added service.</returns>
public static IServiceCollection AddLocalStorageJSInterop(this IServiceCollection services)
{
services.AddScoped<LocalStorageJSInterop>();

return services;
}
}
5 changes: 4 additions & 1 deletion src/BlazingPizza.ComponentsLibrary/Map/Map.razor
Original file line number Diff line number Diff line change
@@ -7,10 +7,13 @@
string elementId = $"map-{Guid.NewGuid().ToString("D")}";

[Parameter] public double Zoom { get; set; }
[Parameter, EditorRequired] public List<Marker> Markers { get; set; } = new();
[Parameter, EditorRequired] public List<Marker> Markers { get; set; } = [];

protected async override Task OnAfterRenderAsync(bool firstRender)
{
// First render bit isn't needed, so let's discard it.
_ = firstRender;

await JSRuntime.InvokeVoidAsync(
"deliveryMap.showOrUpdate",
elementId,
12 changes: 0 additions & 12 deletions src/BlazingPizza.ComponentsLibrary/Map/Marker.cs

This file was deleted.

9 changes: 0 additions & 9 deletions src/BlazingPizza.ComponentsLibrary/Map/Point.cs

This file was deleted.

4 changes: 2 additions & 2 deletions src/BlazingPizza.ComponentsLibrary/wwwroot/deliveryMap.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(function () {
var tileUrl = 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png';
var tileAttribution = 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>';
var tileUrl = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
var tileAttribution = '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors';

// Global export
window.deliveryMap = {
595 changes: 362 additions & 233 deletions src/BlazingPizza.ComponentsLibrary/wwwroot/leaflet/leaflet.css

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/BlazingPizza.ComponentsLibrary/wwwroot/leaflet/leaflet.js

Large diffs are not rendered by default.

18 changes: 11 additions & 7 deletions src/BlazingPizza.ComponentsLibrary/wwwroot/localStorage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
(function () {
window.blazorLocalStorage = {
get: key => key in localStorage ? JSON.parse(localStorage[key]) : null,
set: (key, value) => { localStorage[key] = JSON.stringify(value); },
delete: key => { delete localStorage[key]; }
};
})();
export function getLocalStorageItem(key) {
return key in localStorage ? JSON.parse(localStorage[key]) : null;
}

export function setLocalStorageItem(key, value) {
localStorage[key] = JSON.stringify(value);
}

export function deleteLocalStorageItem(key) {
delete localStorage[key];
}
2 changes: 0 additions & 2 deletions src/BlazingPizza.Server/.gitignore

This file was deleted.

This file was deleted.

38 changes: 0 additions & 38 deletions src/BlazingPizza.Server/Areas/Identity/Pages/_Layout.cshtml

This file was deleted.

26 changes: 0 additions & 26 deletions src/BlazingPizza.Server/BlazingPizza.Server.csproj

This file was deleted.

92 changes: 0 additions & 92 deletions src/BlazingPizza.Server/Models/AddressEntityType.cs

This file was deleted.

114 changes: 0 additions & 114 deletions src/BlazingPizza.Server/Models/DeviceFlowCodesEntityType.cs

This file was deleted.

This file was deleted.

78 changes: 0 additions & 78 deletions src/BlazingPizza.Server/Models/IdentityRoleEntityType.cs

This file was deleted.

This file was deleted.

This file was deleted.

82 changes: 0 additions & 82 deletions src/BlazingPizza.Server/Models/IdentityUserRolestringEntityType.cs

This file was deleted.

This file was deleted.

96 changes: 0 additions & 96 deletions src/BlazingPizza.Server/Models/KeyEntityType.cs

This file was deleted.

80 changes: 0 additions & 80 deletions src/BlazingPizza.Server/Models/LatLongEntityType.cs

This file was deleted.

This file was deleted.

86 changes: 0 additions & 86 deletions src/BlazingPizza.Server/Models/OrderEntityType.cs

This file was deleted.

127 changes: 0 additions & 127 deletions src/BlazingPizza.Server/Models/PersistedGrantEntityType.cs

This file was deleted.

111 changes: 0 additions & 111 deletions src/BlazingPizza.Server/Models/PizzaEntityType.cs

This file was deleted.

76 changes: 0 additions & 76 deletions src/BlazingPizza.Server/Models/PizzaSpecialEntityType.cs

This file was deleted.

28 changes: 0 additions & 28 deletions src/BlazingPizza.Server/Models/PizzaStoreContextModel.cs

This file was deleted.

69 changes: 0 additions & 69 deletions src/BlazingPizza.Server/Models/PizzaStoreContextModelBuilder.cs

This file was deleted.

Loading