Use pmad-symbol-selector for Orbat and allow any icon set#56
Merged
Conversation
There was a problem hiding this comment.
PR Overview
This pull request streamlines symbol generation for units by integrating the pmad-symbol-selector component and allowing any icon set while cleaning up obsolete client‐side code.
- Introduces a new migration to add the NatoSymbolSet column with a default value.
- Replaces manual JavaScript symbol generation with pmad-symbol-selector in views and updates the related controller logic.
- Removes redundant JavaScript files and updates the model and context to support the new symbol property.
Reviewed Changes
| File | Description |
|---|---|
| Arma3TacMapWebApp/Migrations/20250225194447_OrbatNatoSymbolSet.cs | Adds new migration to include a NatoSymbolSet column with a default value. |
| Arma3TacMapWebApp/wwwroot/js/orbatUnitPage.js | Implements a new JavaScript module that initializes and updates the symbol preview using PmadMilsymbolSelector. |
| Arma3TacMapWebApp/Entities/OrbatUnit.cs | Adds the NatoSymbolSet property and FriendSidc accessor to consolidate symbol generation logic. |
| Arma3TacMapWebApp/Entities/Arma3TacMapContext.cs and Snapshot | Updates the DbContext to set the default for NatoSymbolSet. |
| Arma3TacMapWebApp/Controllers/OrbatUnitsController.cs | Refactors controller actions to bind FriendSidc and precompute SVG images using the new symbol generator. |
| Arma3TacMapWebApp/Views/Orbats/Details.cshtml, OrbatUnits/_Form.cshtml, Edit.cshtml, Create.cshtml | Updates views to utilize the new pmad-symbol-selector component and remove legacy symbol generation scripts. |
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
Arma3TacMapWebApp/wwwroot/js/orbatUnitPage.js:25
- [nitpick] Consider defining named constants for the expected character positions (e.g. OFFSET_STATUS, OFFSET_ECHELON) to improve readability and maintainability.
if (sidc.substring(3, 4) != "3" || sidc.substring(6, 7) != "0") {
Arma3TacMapWebApp/Controllers/OrbatUnitsController.cs:106
- It might be beneficial to add a check or error handling for cases where symbol.Svg is null or empty to prevent potential issues during SVG conversion.
var svg = System.Text.Encoding.UTF8.GetBytes(symbol.Svg);
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.