+
+Welcome to your new app.
diff --git a/AnchorageFiller/AnchorageFiller.Client/Pages/NotFound.razor b/AnchorageFiller/AnchorageFiller.Client/Pages/NotFound.razor
new file mode 100644
index 0000000..917ada1
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Client/Pages/NotFound.razor
@@ -0,0 +1,5 @@
+@page "/not-found"
+@layout MainLayout
+
+
Not Found
+
Sorry, the content you are looking for does not exist.
\ No newline at end of file
diff --git a/AnchorageFiller/AnchorageFiller.Client/Program.cs b/AnchorageFiller/AnchorageFiller.Client/Program.cs
new file mode 100644
index 0000000..519269f
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Client/Program.cs
@@ -0,0 +1,5 @@
+using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
+
+var builder = WebAssemblyHostBuilder.CreateDefault(args);
+
+await builder.Build().RunAsync();
diff --git a/AnchorageFiller/AnchorageFiller.Client/Routes.razor b/AnchorageFiller/AnchorageFiller.Client/Routes.razor
new file mode 100644
index 0000000..105855d
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Client/Routes.razor
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/AnchorageFiller/AnchorageFiller.Client/_Imports.razor b/AnchorageFiller/AnchorageFiller.Client/_Imports.razor
new file mode 100644
index 0000000..6f4e56c
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Client/_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 AnchorageFiller.Client
+@using AnchorageFiller.Client.Layout
diff --git a/AnchorageFiller/AnchorageFiller.sln b/AnchorageFiller/AnchorageFiller.sln
new file mode 100644
index 0000000..de5ae4b
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.sln
@@ -0,0 +1,50 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.0.0
+MinimumVisualStudioVersion = 16.0.0.0
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AnchorageFiller", "AnchorageFiller\AnchorageFiller.csproj", "{3875A7AC-5E2B-4775-8E60-91492BA72641}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AnchorageFiller.Client", "AnchorageFiller.Client\AnchorageFiller.Client.csproj", "{8D1FBD47-0F96-4529-97A0-300A7BBA34EB}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {8D1FBD47-0F96-4529-97A0-300A7BBA34EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8D1FBD47-0F96-4529-97A0-300A7BBA34EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8D1FBD47-0F96-4529-97A0-300A7BBA34EB}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {8D1FBD47-0F96-4529-97A0-300A7BBA34EB}.Debug|x64.Build.0 = Debug|Any CPU
+ {8D1FBD47-0F96-4529-97A0-300A7BBA34EB}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {8D1FBD47-0F96-4529-97A0-300A7BBA34EB}.Debug|x86.Build.0 = Debug|Any CPU
+ {8D1FBD47-0F96-4529-97A0-300A7BBA34EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8D1FBD47-0F96-4529-97A0-300A7BBA34EB}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8D1FBD47-0F96-4529-97A0-300A7BBA34EB}.Release|x64.ActiveCfg = Release|Any CPU
+ {8D1FBD47-0F96-4529-97A0-300A7BBA34EB}.Release|x64.Build.0 = Release|Any CPU
+ {8D1FBD47-0F96-4529-97A0-300A7BBA34EB}.Release|x86.ActiveCfg = Release|Any CPU
+ {8D1FBD47-0F96-4529-97A0-300A7BBA34EB}.Release|x86.Build.0 = Release|Any CPU
+ {3875A7AC-5E2B-4775-8E60-91492BA72641}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3875A7AC-5E2B-4775-8E60-91492BA72641}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3875A7AC-5E2B-4775-8E60-91492BA72641}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {3875A7AC-5E2B-4775-8E60-91492BA72641}.Debug|x64.Build.0 = Debug|Any CPU
+ {3875A7AC-5E2B-4775-8E60-91492BA72641}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {3875A7AC-5E2B-4775-8E60-91492BA72641}.Debug|x86.Build.0 = Debug|Any CPU
+ {3875A7AC-5E2B-4775-8E60-91492BA72641}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3875A7AC-5E2B-4775-8E60-91492BA72641}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3875A7AC-5E2B-4775-8E60-91492BA72641}.Release|x64.ActiveCfg = Release|Any CPU
+ {3875A7AC-5E2B-4775-8E60-91492BA72641}.Release|x64.Build.0 = Release|Any CPU
+ {3875A7AC-5E2B-4775-8E60-91492BA72641}.Release|x86.ActiveCfg = Release|Any CPU
+ {3875A7AC-5E2B-4775-8E60-91492BA72641}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {4E68DE82-CC9E-4B2E-BBB5-7E4D57EC1C4B}
+ EndGlobalSection
+EndGlobal
diff --git a/AnchorageFiller/AnchorageFiller/AnchorageFiller.csproj b/AnchorageFiller/AnchorageFiller/AnchorageFiller.csproj
new file mode 100644
index 0000000..fdac9a5
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller/AnchorageFiller.csproj
@@ -0,0 +1,15 @@
+
+
+
+ net10.0
+ enable
+ enable
+ true
+
+
+
+
+
+
+
+
diff --git a/AnchorageFiller/AnchorageFiller/Components/App.razor b/AnchorageFiller/AnchorageFiller/Components/App.razor
new file mode 100644
index 0000000..2dbff1e
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller/Components/App.razor
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AnchorageFiller/AnchorageFiller/Components/Pages/Error.razor b/AnchorageFiller/AnchorageFiller/Components/Pages/Error.razor
new file mode 100644
index 0000000..576cc2d
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller/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.
+
Welcome to your new app.
+
+@code {
+ [Inject] public required IFleetsClient FleetsClient { get; set; }
+
+ protected override async Task OnInitializedAsync()
+ {
+ var fleets = await FleetsClient.GetRandomFleetAsync();
+ }
+}
diff --git a/AnchorageFiller/AnchorageFiller.Client/Program.cs b/AnchorageFiller/AnchorageFiller.Client/Program.cs
index 519269f..38b041c 100644
--- a/AnchorageFiller/AnchorageFiller.Client/Program.cs
+++ b/AnchorageFiller/AnchorageFiller.Client/Program.cs
@@ -1,5 +1,13 @@
+using AnchorageFiller.Clients;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
+
+builder.Services
+ .AddHttpClient(client =>
+ {
+ client.BaseAddress = new(builder.HostEnvironment.BaseAddress, UriKind.Absolute);
+ });
+
await builder.Build().RunAsync();
diff --git a/AnchorageFiller/AnchorageFiller.Clients/AnchorageFiller.Clients.csproj b/AnchorageFiller/AnchorageFiller.Clients/AnchorageFiller.Clients.csproj
new file mode 100644
index 0000000..b760144
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Clients/AnchorageFiller.Clients.csproj
@@ -0,0 +1,9 @@
+
+
+
+ net10.0
+ enable
+ enable
+
+
+
diff --git a/AnchorageFiller/AnchorageFiller.Clients/FleetsClient.cs b/AnchorageFiller/AnchorageFiller.Clients/FleetsClient.cs
new file mode 100644
index 0000000..9c14c68
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Clients/FleetsClient.cs
@@ -0,0 +1,13 @@
+using System.Net.Http.Json;
+using AnchorageFiller.Clients.Responses;
+
+namespace AnchorageFiller.Clients;
+
+public class FleetsClient(HttpClient client) : IFleetsClient
+{
+ public async Task GetRandomFleetAsync(CancellationToken cancellationToken = default)
+ {
+ var response = await client.GetFromJsonAsync("/api/fleets/random", cancellationToken);
+ return response ?? throw new("Failed to retrieve fleet data.");
+ }
+}
diff --git a/AnchorageFiller/AnchorageFiller.Clients/IFleetsClient.cs b/AnchorageFiller/AnchorageFiller.Clients/IFleetsClient.cs
new file mode 100644
index 0000000..aec4cd4
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Clients/IFleetsClient.cs
@@ -0,0 +1,8 @@
+using AnchorageFiller.Clients.Responses;
+
+namespace AnchorageFiller.Clients;
+
+public interface IFleetsClient
+{
+ Task GetRandomFleetAsync(CancellationToken cancellationToken = default);
+}
\ No newline at end of file
diff --git a/AnchorageFiller/AnchorageFiller.Clients/Responses/GetFleetResponse.cs b/AnchorageFiller/AnchorageFiller.Clients/Responses/GetFleetResponse.cs
new file mode 100644
index 0000000..1466a09
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Clients/Responses/GetFleetResponse.cs
@@ -0,0 +1,7 @@
+namespace AnchorageFiller.Clients.Responses;
+
+public record GetFleetResponse(Size AnchorageSize, IReadOnlyList Fleets);
+
+public record FleetItem(Size SingleShipDimensions, string ShipDesignation, int ShipCount);
+
+public record Size(int Width, int Height);
\ No newline at end of file
diff --git a/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj b/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj
index fdac9a5..6bc4132 100644
--- a/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj
+++ b/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj
@@ -10,6 +10,7 @@
+
diff --git a/AnchorageFiller/AnchorageFiller.Server/Program.cs b/AnchorageFiller/AnchorageFiller.Server/Program.cs
index de71583..299d2b5 100644
--- a/AnchorageFiller/AnchorageFiller.Server/Program.cs
+++ b/AnchorageFiller/AnchorageFiller.Server/Program.cs
@@ -1,4 +1,7 @@
+using AnchorageFiller.Clients;
using AnchorageFiller.Server.Components;
+using Microsoft.AspNetCore.Mvc;
+using System.Text.Json;
var builder = WebApplication.CreateBuilder(args);
@@ -6,6 +9,17 @@
builder.Services.AddRazorComponents()
.AddInteractiveWebAssemblyComponents();
+
+builder.Services
+ .AddHttpClient(client =>
+ {
+ client.BaseAddress = new("https://esa.instech.no", UriKind.Absolute);
+ });
+builder.Services.ConfigureHttpJsonOptions(options =>
+{
+ options.SerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
+});
+
var app = builder.Build();
// Configure the HTTP request pipeline.
@@ -29,4 +43,7 @@
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(typeof(AnchorageFiller.Client._Imports).Assembly);
+// API Endpoints
+app.MapGet("/api/fleets/random", ([FromServices] IFleetsClient client) => client.GetRandomFleetAsync());
+
app.Run();
diff --git a/AnchorageFiller/AnchorageFiller.slnx b/AnchorageFiller/AnchorageFiller.slnx
index 51e13d1..645e151 100644
--- a/AnchorageFiller/AnchorageFiller.slnx
+++ b/AnchorageFiller/AnchorageFiller.slnx
@@ -5,5 +5,6 @@
+
From fa0f4a792e17d1a0bd6becd672fd6fe8a3298783 Mon Sep 17 00:00:00 2001
From: Fredrik <50200428+fredrik-instech@users.noreply.github.com>
Date: Thu, 11 Dec 2025 16:41:12 +0100
Subject: [PATCH 05/11] Cleanup
---
AnchorageFiller/AnchorageFiller.Clients/FleetsClient.cs | 7 ++-----
AnchorageFiller/AnchorageFiller.Clients/IFleetsClient.cs | 2 +-
.../AnchorageFiller.Server/AnchorageFiller.Server.csproj | 1 -
AnchorageFiller/AnchorageFiller.Server/Program.cs | 2 +-
4 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/AnchorageFiller/AnchorageFiller.Clients/FleetsClient.cs b/AnchorageFiller/AnchorageFiller.Clients/FleetsClient.cs
index 9c14c68..9f40a5b 100644
--- a/AnchorageFiller/AnchorageFiller.Clients/FleetsClient.cs
+++ b/AnchorageFiller/AnchorageFiller.Clients/FleetsClient.cs
@@ -5,9 +5,6 @@ namespace AnchorageFiller.Clients;
public class FleetsClient(HttpClient client) : IFleetsClient
{
- public async Task GetRandomFleetAsync(CancellationToken cancellationToken = default)
- {
- var response = await client.GetFromJsonAsync("/api/fleets/random", cancellationToken);
- return response ?? throw new("Failed to retrieve fleet data.");
- }
+ public Task GetRandomFleetAsync(CancellationToken cancellationToken = default) =>
+ client.GetFromJsonAsync("/api/fleets/random", cancellationToken);
}
diff --git a/AnchorageFiller/AnchorageFiller.Clients/IFleetsClient.cs b/AnchorageFiller/AnchorageFiller.Clients/IFleetsClient.cs
index aec4cd4..2c026eb 100644
--- a/AnchorageFiller/AnchorageFiller.Clients/IFleetsClient.cs
+++ b/AnchorageFiller/AnchorageFiller.Clients/IFleetsClient.cs
@@ -4,5 +4,5 @@ namespace AnchorageFiller.Clients;
public interface IFleetsClient
{
- Task GetRandomFleetAsync(CancellationToken cancellationToken = default);
+ Task GetRandomFleetAsync(CancellationToken cancellationToken = default);
}
\ No newline at end of file
diff --git a/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj b/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj
index 6bc4132..fdac9a5 100644
--- a/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj
+++ b/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj
@@ -10,7 +10,6 @@
-
diff --git a/AnchorageFiller/AnchorageFiller.Server/Program.cs b/AnchorageFiller/AnchorageFiller.Server/Program.cs
index 299d2b5..e1b89fd 100644
--- a/AnchorageFiller/AnchorageFiller.Server/Program.cs
+++ b/AnchorageFiller/AnchorageFiller.Server/Program.cs
@@ -46,4 +46,4 @@
// API Endpoints
app.MapGet("/api/fleets/random", ([FromServices] IFleetsClient client) => client.GetRandomFleetAsync());
-app.Run();
+await app.RunAsync();
From f9a5c6d2399e7221ffbe8060ed6683ba70a786ab Mon Sep 17 00:00:00 2001
From: Fredrik <50200428+fredrik-instech@users.noreply.github.com>
Date: Thu, 11 Dec 2025 16:47:27 +0100
Subject: [PATCH 06/11] Rename project Client -> Web
---
.../AnchorageFiller.Server/AnchorageFiller.Server.csproj | 2 +-
.../AnchorageFiller.Server/Components/_Imports.razor | 2 +-
AnchorageFiller/AnchorageFiller.Server/Program.cs | 2 +-
.../AnchorageFiller.Web.csproj} | 0
.../Layout/MainLayout.razor | 0
.../Layout/MainLayout.razor.css | 0
.../Pages/Home.razor | 0
.../Pages/NotFound.razor | 0
.../Program.cs | 0
.../Routes.razor | 0
.../_Imports.razor | 4 ++--
AnchorageFiller/AnchorageFiller.slnx | 2 +-
12 files changed, 6 insertions(+), 6 deletions(-)
rename AnchorageFiller/{AnchorageFiller.Client/AnchorageFiller.Client.csproj => AnchorageFiller.Web/AnchorageFiller.Web.csproj} (100%)
rename AnchorageFiller/{AnchorageFiller.Client => AnchorageFiller.Web}/Layout/MainLayout.razor (100%)
rename AnchorageFiller/{AnchorageFiller.Client => AnchorageFiller.Web}/Layout/MainLayout.razor.css (100%)
rename AnchorageFiller/{AnchorageFiller.Client => AnchorageFiller.Web}/Pages/Home.razor (100%)
rename AnchorageFiller/{AnchorageFiller.Client => AnchorageFiller.Web}/Pages/NotFound.razor (100%)
rename AnchorageFiller/{AnchorageFiller.Client => AnchorageFiller.Web}/Program.cs (100%)
rename AnchorageFiller/{AnchorageFiller.Client => AnchorageFiller.Web}/Routes.razor (100%)
rename AnchorageFiller/{AnchorageFiller.Client => AnchorageFiller.Web}/_Imports.razor (83%)
diff --git a/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj b/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj
index fdac9a5..78f91c3 100644
--- a/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj
+++ b/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/AnchorageFiller/AnchorageFiller.Server/Components/_Imports.razor b/AnchorageFiller/AnchorageFiller.Server/Components/_Imports.razor
index 10a0ff5..122dd1d 100644
--- a/AnchorageFiller/AnchorageFiller.Server/Components/_Imports.razor
+++ b/AnchorageFiller/AnchorageFiller.Server/Components/_Imports.razor
@@ -7,5 +7,5 @@
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
@using AnchorageFiller.Server
-@using AnchorageFiller.Client
+@using AnchorageFiller.Web
@using AnchorageFiller.Server.Components
diff --git a/AnchorageFiller/AnchorageFiller.Server/Program.cs b/AnchorageFiller/AnchorageFiller.Server/Program.cs
index e1b89fd..9de2bf2 100644
--- a/AnchorageFiller/AnchorageFiller.Server/Program.cs
+++ b/AnchorageFiller/AnchorageFiller.Server/Program.cs
@@ -41,7 +41,7 @@
app.MapStaticAssets();
app.MapRazorComponents()
.AddInteractiveWebAssemblyRenderMode()
- .AddAdditionalAssemblies(typeof(AnchorageFiller.Client._Imports).Assembly);
+ .AddAdditionalAssemblies(typeof(AnchorageFiller.Web._Imports).Assembly);
// API Endpoints
app.MapGet("/api/fleets/random", ([FromServices] IFleetsClient client) => client.GetRandomFleetAsync());
diff --git a/AnchorageFiller/AnchorageFiller.Client/AnchorageFiller.Client.csproj b/AnchorageFiller/AnchorageFiller.Web/AnchorageFiller.Web.csproj
similarity index 100%
rename from AnchorageFiller/AnchorageFiller.Client/AnchorageFiller.Client.csproj
rename to AnchorageFiller/AnchorageFiller.Web/AnchorageFiller.Web.csproj
diff --git a/AnchorageFiller/AnchorageFiller.Client/Layout/MainLayout.razor b/AnchorageFiller/AnchorageFiller.Web/Layout/MainLayout.razor
similarity index 100%
rename from AnchorageFiller/AnchorageFiller.Client/Layout/MainLayout.razor
rename to AnchorageFiller/AnchorageFiller.Web/Layout/MainLayout.razor
diff --git a/AnchorageFiller/AnchorageFiller.Client/Layout/MainLayout.razor.css b/AnchorageFiller/AnchorageFiller.Web/Layout/MainLayout.razor.css
similarity index 100%
rename from AnchorageFiller/AnchorageFiller.Client/Layout/MainLayout.razor.css
rename to AnchorageFiller/AnchorageFiller.Web/Layout/MainLayout.razor.css
diff --git a/AnchorageFiller/AnchorageFiller.Client/Pages/Home.razor b/AnchorageFiller/AnchorageFiller.Web/Pages/Home.razor
similarity index 100%
rename from AnchorageFiller/AnchorageFiller.Client/Pages/Home.razor
rename to AnchorageFiller/AnchorageFiller.Web/Pages/Home.razor
diff --git a/AnchorageFiller/AnchorageFiller.Client/Pages/NotFound.razor b/AnchorageFiller/AnchorageFiller.Web/Pages/NotFound.razor
similarity index 100%
rename from AnchorageFiller/AnchorageFiller.Client/Pages/NotFound.razor
rename to AnchorageFiller/AnchorageFiller.Web/Pages/NotFound.razor
diff --git a/AnchorageFiller/AnchorageFiller.Client/Program.cs b/AnchorageFiller/AnchorageFiller.Web/Program.cs
similarity index 100%
rename from AnchorageFiller/AnchorageFiller.Client/Program.cs
rename to AnchorageFiller/AnchorageFiller.Web/Program.cs
diff --git a/AnchorageFiller/AnchorageFiller.Client/Routes.razor b/AnchorageFiller/AnchorageFiller.Web/Routes.razor
similarity index 100%
rename from AnchorageFiller/AnchorageFiller.Client/Routes.razor
rename to AnchorageFiller/AnchorageFiller.Web/Routes.razor
diff --git a/AnchorageFiller/AnchorageFiller.Client/_Imports.razor b/AnchorageFiller/AnchorageFiller.Web/_Imports.razor
similarity index 83%
rename from AnchorageFiller/AnchorageFiller.Client/_Imports.razor
rename to AnchorageFiller/AnchorageFiller.Web/_Imports.razor
index 6f4e56c..204fe81 100644
--- a/AnchorageFiller/AnchorageFiller.Client/_Imports.razor
+++ b/AnchorageFiller/AnchorageFiller.Web/_Imports.razor
@@ -6,5 +6,5 @@
@using static Microsoft.AspNetCore.Components.Web.RenderMode
@using Microsoft.AspNetCore.Components.Web.Virtualization
@using Microsoft.JSInterop
-@using AnchorageFiller.Client
-@using AnchorageFiller.Client.Layout
+@using AnchorageFiller.Web
+@using AnchorageFiller.Web.Layout
diff --git a/AnchorageFiller/AnchorageFiller.slnx b/AnchorageFiller/AnchorageFiller.slnx
index 645e151..4cd8814 100644
--- a/AnchorageFiller/AnchorageFiller.slnx
+++ b/AnchorageFiller/AnchorageFiller.slnx
@@ -4,7 +4,7 @@
-
+
From 2c11af372741af42c8c41692b4da346c84748bf3 Mon Sep 17 00:00:00 2001
From: Fredrik <50200428+fredrik-instech@users.noreply.github.com>
Date: Thu, 11 Dec 2025 17:01:04 +0100
Subject: [PATCH 07/11] Use Central Package Management
---
.../AnchorageFiller.Server.csproj | 5 ++++-
AnchorageFiller/AnchorageFiller.Server/Program.cs | 9 ++++-----
.../AnchorageFiller.Web/AnchorageFiller.Web.csproj | 4 ++--
AnchorageFiller/Directory.Packages.props | 11 +++++++++++
4 files changed, 21 insertions(+), 8 deletions(-)
create mode 100644 AnchorageFiller/Directory.Packages.props
diff --git a/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj b/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj
index 78f91c3..3fbb5be 100644
--- a/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj
+++ b/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj
@@ -7,9 +7,12 @@
true
+
+
+
+
-
diff --git a/AnchorageFiller/AnchorageFiller.Server/Program.cs b/AnchorageFiller/AnchorageFiller.Server/Program.cs
index 9de2bf2..8969fda 100644
--- a/AnchorageFiller/AnchorageFiller.Server/Program.cs
+++ b/AnchorageFiller/AnchorageFiller.Server/Program.cs
@@ -10,11 +10,10 @@
.AddInteractiveWebAssemblyComponents();
-builder.Services
- .AddHttpClient(client =>
- {
- client.BaseAddress = new("https://esa.instech.no", UriKind.Absolute);
- });
+builder.Services.AddHttpClient(client =>
+{
+ client.BaseAddress = new("https://esa.instech.no", UriKind.Absolute);
+});
builder.Services.ConfigureHttpJsonOptions(options =>
{
options.SerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;
diff --git a/AnchorageFiller/AnchorageFiller.Web/AnchorageFiller.Web.csproj b/AnchorageFiller/AnchorageFiller.Web/AnchorageFiller.Web.csproj
index 9022d2c..1fa7409 100644
--- a/AnchorageFiller/AnchorageFiller.Web/AnchorageFiller.Web.csproj
+++ b/AnchorageFiller/AnchorageFiller.Web/AnchorageFiller.Web.csproj
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/AnchorageFiller/Directory.Packages.props b/AnchorageFiller/Directory.Packages.props
new file mode 100644
index 0000000..48d9206
--- /dev/null
+++ b/AnchorageFiller/Directory.Packages.props
@@ -0,0 +1,11 @@
+
+
+
+ true
+
+
+
+
+
+
+
From 202e07b7a2d9d2863f1019d78c35daf431e0985a Mon Sep 17 00:00:00 2001
From: Fredrik <50200428+fredrik-instech@users.noreply.github.com>
Date: Thu, 11 Dec 2025 17:08:24 +0100
Subject: [PATCH 08/11] Store url in appsettigns
---
AnchorageFiller/AnchorageFiller.Server/Program.cs | 2 +-
AnchorageFiller/AnchorageFiller.Server/appsettings.json | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/AnchorageFiller/AnchorageFiller.Server/Program.cs b/AnchorageFiller/AnchorageFiller.Server/Program.cs
index 8969fda..8e0f9fb 100644
--- a/AnchorageFiller/AnchorageFiller.Server/Program.cs
+++ b/AnchorageFiller/AnchorageFiller.Server/Program.cs
@@ -12,7 +12,7 @@
builder.Services.AddHttpClient(client =>
{
- client.BaseAddress = new("https://esa.instech.no", UriKind.Absolute);
+ client.BaseAddress = new(builder.Configuration.GetValue("ApiUrl")!, UriKind.Absolute);
});
builder.Services.ConfigureHttpJsonOptions(options =>
{
diff --git a/AnchorageFiller/AnchorageFiller.Server/appsettings.json b/AnchorageFiller/AnchorageFiller.Server/appsettings.json
index 10f68b8..731cae7 100644
--- a/AnchorageFiller/AnchorageFiller.Server/appsettings.json
+++ b/AnchorageFiller/AnchorageFiller.Server/appsettings.json
@@ -5,5 +5,6 @@
"Microsoft.AspNetCore": "Warning"
}
},
- "AllowedHosts": "*"
+ "AllowedHosts": "*",
+ "ApiUrl": "https://esa.instech.no"
}
From d89bd3ce9d2f792371477e84f675d1adf837907b Mon Sep 17 00:00:00 2001
From: Fredrik <50200428+fredrik-instech@users.noreply.github.com>
Date: Thu, 11 Dec 2025 17:25:29 +0100
Subject: [PATCH 09/11] Update readme
---
README.md | 48 +++++++++++++-----------------------------------
1 file changed, 13 insertions(+), 35 deletions(-)
diff --git a/README.md b/README.md
index d99422e..253d31f 100644
--- a/README.md
+++ b/README.md
@@ -6,44 +6,22 @@ One common problem in shipping is to fill an anchorage efficiently with as many
## Prerequisites
- Your favourite IDE to code C# / Blazor 😀
- - .net 9 SDK installed
+ - .net 10 SDK installed
- github account, we want you to publish your code to a public repository which you share with us.
## The Task
-Create a Blazor WASM or Server app which connects to the api at URL: [https://esa.instech.no/](https://esa.instech.no/). Please note that the documentation page for this API contains a link to a separate readme which is not relevant for this Blazor FE task.
-
-A request like this:
-```sh
-$ curl -X GET https://esa.instech.no/api/fleets/random
-```
-.. can produce a JSON response with data similar to this:
-```json
-{
- "anchorageSize": {
- "width": 12,
- "height": 15
- },
- "fleets": [
- {
- "singleShipDimensions": { "width": 6, "height": 5 },
- "shipDesignation": "LNG Unit",
- "shipCount": 2
- },
- {
- "singleShipDimensions": { "width": 3, "height": 12 },
- "shipDesignation": "Science & Engineering Ship",
- "shipCount": 5
- }
- ]
-}
-```
+In the `AnchorageFiller` directory of this repository, we have provided a basic Blazor App you can extend to solve this task.
+The AnchorageFiller solution consists of the following projects:
+* `AnchorageFiller.Clients` - Strongly typed client that can be used to fetch a response from our API.
+* `AnchorageFiller.Server` - AspNetCore server used to host the WebAssembly app and to proxy requests to our API.
+* `AnchorageFiller.Web` - Blazor WebAssembly app.
### Suggested UI:
-The json states that there are 2 vessels with size (6x5) and 5 vessels with size (3X12). These can be dragged (and dropped) into the anchorage area.
+The API response states that there are 2 vessels with size (6x5) and 5 vessels with size (3X12). These can be dragged (and dropped) into the anchorage area.
@@ -54,20 +32,20 @@ The json states that there are 2 vessels with size (6x5) and 5 vessels with size
You are done. 🥳 Clicking the "Try again!" button issues a new request to the API. Based on the response, render a new anchorage and the vessels / items to fill it with.
### Additional information:
-- It could be that the vessels must be possible to rotate 90 degrees to utilize all space in the anchorage. You decide how to do this from a UX perspective (double clicking the vessel maybe?). If this is not possible, leave it.
+- It could be that the vessels must be possible to rotate 90 degrees to utilize all space in the anchorage. You decide how to do this from a UX perspective. If this is not possible, leave it.
- Overlap between vessels is not possible 💥
-- It is ok if the full anchorage cannot be filled, but then you need to provide means to try again, perhaps always show that button?
+- Our API does not guarantee anchorages that can be filled. There may be too many vessels in the response. Then you need to provide means to try again, perhaps always show that button?
- The state of the anchorage does not have to be persisted, page reload will be a new try.
-- Any security concerns are out of scope (auth/CORS ++).
+- Any security concerns are out of scope (auth ++).
- You can use third party libraries / components.
## What will we evaluate?
- Apart from a functional SPA, we want you create a codebase which is "clean" (adhere to the SOLID principles).
+- We value clean code, accessibility, project structure and usability over having lots of functionality. Consider this if you have limited time.
- Are there any parts which can be unit tested?
- - The UI components are probably not easy to test, but do you have any services, e.g. BinPackService which can be tested with mock dependencies?
- How do you do state management?
-- Apply CSS/Bootstraping to make the SPA look a bit nicer than the wireframes.
-- Documentation - either in code or in a separate readme is highly appreciated.
+- Apply CSS/Bootstraping to make the SPA look a bit nicer than the wireframes.
+- Documentation - either in code or in a separate readme is highly appreciated.
- We do not like AI/Agent generated readme files. They tend to be bloated, we would much rather read documentation where the content is created by you 🫵 (do not stress with spelling mistakes too much, they just make the content look genuine).
Good luck! 🙂 If you have any questions, do not hesitate to contact us.
From 17fdc354665c9df2a88908d39d48c2cbc31dbba4 Mon Sep 17 00:00:00 2001
From: Fredrik <50200428+fredrik-instech@users.noreply.github.com>
Date: Mon, 22 Dec 2025 15:37:51 +0100
Subject: [PATCH 10/11] Disable prerendering
---
AnchorageFiller/AnchorageFiller.Server/Components/App.razor | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/AnchorageFiller/AnchorageFiller.Server/Components/App.razor b/AnchorageFiller/AnchorageFiller.Server/Components/App.razor
index 90ab425..4897812 100644
--- a/AnchorageFiller/AnchorageFiller.Server/Components/App.razor
+++ b/AnchorageFiller/AnchorageFiller.Server/Components/App.razor
@@ -9,11 +9,11 @@
-
+
-
+
From e2cd910850e8b9977ad04b9c82fd1c83e95a2f9a Mon Sep 17 00:00:00 2001
From: Fredrik <50200428+fredrik-instech@users.noreply.github.com>
Date: Tue, 6 Jan 2026 10:51:58 +0100
Subject: [PATCH 11/11] Cleanup
---
.../AnchorageFiller.Clients/Responses/FleetItem.cs | 3 +++
.../AnchorageFiller.Clients/Responses/GetFleetResponse.cs | 4 ----
AnchorageFiller/AnchorageFiller.Clients/Responses/Size.cs | 3 +++
3 files changed, 6 insertions(+), 4 deletions(-)
create mode 100644 AnchorageFiller/AnchorageFiller.Clients/Responses/FleetItem.cs
create mode 100644 AnchorageFiller/AnchorageFiller.Clients/Responses/Size.cs
diff --git a/AnchorageFiller/AnchorageFiller.Clients/Responses/FleetItem.cs b/AnchorageFiller/AnchorageFiller.Clients/Responses/FleetItem.cs
new file mode 100644
index 0000000..74cd4dd
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Clients/Responses/FleetItem.cs
@@ -0,0 +1,3 @@
+namespace AnchorageFiller.Clients.Responses;
+
+public record FleetItem(Size SingleShipSize, string ShipDesignation, int ShipCount);
diff --git a/AnchorageFiller/AnchorageFiller.Clients/Responses/GetFleetResponse.cs b/AnchorageFiller/AnchorageFiller.Clients/Responses/GetFleetResponse.cs
index 1466a09..c095467 100644
--- a/AnchorageFiller/AnchorageFiller.Clients/Responses/GetFleetResponse.cs
+++ b/AnchorageFiller/AnchorageFiller.Clients/Responses/GetFleetResponse.cs
@@ -1,7 +1,3 @@
namespace AnchorageFiller.Clients.Responses;
public record GetFleetResponse(Size AnchorageSize, IReadOnlyList Fleets);
-
-public record FleetItem(Size SingleShipDimensions, string ShipDesignation, int ShipCount);
-
-public record Size(int Width, int Height);
\ No newline at end of file
diff --git a/AnchorageFiller/AnchorageFiller.Clients/Responses/Size.cs b/AnchorageFiller/AnchorageFiller.Clients/Responses/Size.cs
new file mode 100644
index 0000000..75a8033
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Clients/Responses/Size.cs
@@ -0,0 +1,3 @@
+namespace AnchorageFiller.Clients.Responses;
+
+public record Size(int Width, int Height);
\ No newline at end of file