diff --git a/AnchorageFiller/.gitignore b/AnchorageFiller/.gitignore
new file mode 100644
index 0000000..ba7a514
--- /dev/null
+++ b/AnchorageFiller/.gitignore
@@ -0,0 +1,428 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+*.env
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+
+[Dd]ebug/x64/
+[Dd]ebugPublic/x64/
+[Rr]elease/x64/
+[Rr]eleases/x64/
+bin/x64/
+obj/x64/
+
+[Dd]ebug/x86/
+[Dd]ebugPublic/x86/
+[Rr]elease/x86/
+[Rr]eleases/x86/
+bin/x86/
+obj/x86/
+
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+[Aa][Rr][Mm]64[Ee][Cc]/
+bld/
+[Oo]bj/
+[Oo]ut/
+[Ll]og/
+[Ll]ogs/
+
+# Build results on 'Bin' directories
+**/[Bb]in/*
+# Uncomment if you have tasks that rely on *.refresh files to move binaries
+# (https://github.com/github/gitignore/pull/3736)
+#!**/[Bb]in/*.refresh
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+*.trx
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Approval Tests result files
+*.received.*
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.idb
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+# but not Directory.Build.rsp, as it configures directory-level build defaults
+!Directory.Build.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.tlog
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio 6 workspace and project file (working project files containing files to include in project)
+*.dsw
+*.dsp
+
+# Visual Studio 6 technical files
+*.ncb
+*.aps
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+**/.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+**/.fake/
+
+# CodeRush personal settings
+**/.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+**/__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+#tools/**
+#!tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+MSBuild_Logs/
+
+# AWS SAM Build and Temporary Artifacts folder
+.aws-sam
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+**/.mfractor/
+
+# Local History for Visual Studio
+**/.localhistory/
+
+# Visual Studio History (VSHistory) files
+.vshistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+**/.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd
+
+# VS Code files for those working on multiple tools
+.vscode/*
+!.vscode/settings.json
+!.vscode/tasks.json
+!.vscode/launch.json
+!.vscode/extensions.json
+!.vscode/*.code-snippets
+
+# Local History for Visual Studio Code
+.history/
+
+# Built Visual Studio Code Extensions
+*.vsix
+
+# Windows Installer files from build outputs
+*.cab
+*.msi
+*.msix
+*.msm
+*.msp
\ No newline at end of file
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..9f40a5b
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Clients/FleetsClient.cs
@@ -0,0 +1,10 @@
+using System.Net.Http.Json;
+using AnchorageFiller.Clients.Responses;
+
+namespace AnchorageFiller.Clients;
+
+public class FleetsClient(HttpClient client) : IFleetsClient
+{
+ 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
new file mode 100644
index 0000000..2c026eb
--- /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/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
new file mode 100644
index 0000000..c095467
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Clients/Responses/GetFleetResponse.cs
@@ -0,0 +1,3 @@
+namespace AnchorageFiller.Clients.Responses;
+
+public record GetFleetResponse(Size AnchorageSize, IReadOnlyList Fleets);
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
diff --git a/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj b/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj
new file mode 100644
index 0000000..3fbb5be
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Server/AnchorageFiller.Server.csproj
@@ -0,0 +1,18 @@
+
+
+
+ net10.0
+ enable
+ enable
+ true
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AnchorageFiller/AnchorageFiller.Server/Components/App.razor b/AnchorageFiller/AnchorageFiller.Server/Components/App.razor
new file mode 100644
index 0000000..4897812
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Server/Components/App.razor
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AnchorageFiller/AnchorageFiller.Server/Components/Pages/Error.razor b/AnchorageFiller/AnchorageFiller.Server/Components/Pages/Error.razor
new file mode 100644
index 0000000..576cc2d
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Server/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.Web/Pages/NotFound.razor b/AnchorageFiller/AnchorageFiller.Web/Pages/NotFound.razor
new file mode 100644
index 0000000..917ada1
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Web/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.Web/Program.cs b/AnchorageFiller/AnchorageFiller.Web/Program.cs
new file mode 100644
index 0000000..38b041c
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Web/Program.cs
@@ -0,0 +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.Web/Routes.razor b/AnchorageFiller/AnchorageFiller.Web/Routes.razor
new file mode 100644
index 0000000..105855d
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Web/Routes.razor
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/AnchorageFiller/AnchorageFiller.Web/_Imports.razor b/AnchorageFiller/AnchorageFiller.Web/_Imports.razor
new file mode 100644
index 0000000..204fe81
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.Web/_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.Web
+@using AnchorageFiller.Web.Layout
diff --git a/AnchorageFiller/AnchorageFiller.slnx b/AnchorageFiller/AnchorageFiller.slnx
new file mode 100644
index 0000000..4cd8814
--- /dev/null
+++ b/AnchorageFiller/AnchorageFiller.slnx
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
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
+
+
+
+
+
+
+
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.