Skip to content

Use pmad-symbol-selector for Orbat and allow any icon set#56

Merged
jetelain merged 3 commits intomainfrom
orbat-new-selector
Feb 28, 2025
Merged

Use pmad-symbol-selector for Orbat and allow any icon set#56
jetelain merged 3 commits intomainfrom
orbat-new-selector

Conversation

@jetelain
Copy link
Owner

No description provided.

@jetelain jetelain marked this pull request as ready for review February 28, 2025 07:12
@jetelain jetelain requested a review from Copilot February 28, 2025 07:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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);

@jetelain jetelain merged commit 7bcf2ae into main Feb 28, 2025
1 check passed
@jetelain jetelain deleted the orbat-new-selector branch February 28, 2025 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants