Skip to content

Commit 1139bf4

Browse files
feat: Refactor map image handling and styling for improved responsiveness and consistency
1 parent 98b2f79 commit 1139bf4

6 files changed

Lines changed: 16 additions & 17 deletions

File tree

src/XtremeIdiots.Portal.Web/Helpers/MapImageTagHelper.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,9 @@ public override void Process(TagHelperContext context, TagHelperOutput output)
2828

2929
output.Attributes.SetAttribute("src", src);
3030
output.Attributes.SetAttribute("alt", Map ?? "map");
31-
var style = "border: 5px solid #021a40; display: block; margin: auto;";
32-
output.Attributes.SetAttribute("style", style);
33-
if (!string.IsNullOrWhiteSpace(CssClass))
34-
{
35-
output.Attributes.SetAttribute("class", CssClass);
36-
}
31+
32+
var cssClass = string.IsNullOrWhiteSpace(CssClass) ? "map-image" : $"map-image {CssClass}";
33+
output.Attributes.SetAttribute("class", cssClass);
3734
// Add client-side fallback in case the resolved image 404s at runtime.
3835
output.Attributes.SetAttribute("onerror", "this.onerror=null;this.src='/images/noimage.jpg';");
3936
output.TagMode = TagMode.SelfClosing;

src/XtremeIdiots.Portal.Web/Styles/features/_maps.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@
1414
}
1515

1616
.map-image {
17-
border: 5px solid $map-border-color;
17+
border: 2px solid $map-border-color;
1818
display: block;
1919
margin: 0 auto;
20-
max-width: 200px;
20+
width: 100%;
21+
object-fit: cover;
22+
aspect-ratio: 4 / 3;
2123
}
2224

2325
.vote-stats {

src/XtremeIdiots.Portal.Web/Styles/layout/_wrapper.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717

1818
.wrapper-content {
19-
padding: $content-padding;
19+
padding: 10px $content-padding $content-padding;
2020
}
2121

2222
.alerts-container {
@@ -30,6 +30,6 @@ main {
3030

3131
@include media-lg {
3232
.wrapper-content {
33-
padding: $content-padding * 1.5;
33+
padding: 15px ($content-padding * 1.5) ($content-padding * 1.5);
3434
}
3535
}

src/XtremeIdiots.Portal.Web/Views/MapRotations/AssignmentStatus.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@
349349
if (mapDto != null)
350350
{
351351
<div class="col-xl-2 col-lg-3 col-md-4 col-sm-4 col-6 mb-2 text-center">
352-
<img src="@(mapDto.MapImageUri ?? "/images/noimage.jpg")" class="map-image img-fluid rounded" alt="Map image for @mapDto.MapName" loading="lazy" style="max-height: 80px; object-fit: cover; width: 100%;" />
352+
<img src="@(mapDto.MapImageUri ?? "/images/noimage.jpg")" class="map-image img-fluid rounded" alt="Map image for @mapDto.MapName" loading="lazy" />
353353
<small class="text-muted d-block">#@(i + 1)</small>
354354
<small class="fw-bold">@mapDto.MapName</small>
355355
</div>

src/XtremeIdiots.Portal.Web/Views/MapRotations/Details.cshtml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,18 @@
6666
}
6767
else
6868
{
69-
<div class="row">
69+
<div class="row g-2">
7070
@{ var sortedMaps = Model.Rotation.MapRotationMaps?.OrderBy(m => m.SortOrder).ToList() ?? []; }
7171
@for (var i = 0; i < sortedMaps.Count; i++)
7272
{
7373
var rotationMap = sortedMaps[i];
7474
var mapDto = Model.Maps.FirstOrDefault(m => m.MapId == rotationMap.MapId);
7575
if (mapDto != null)
7676
{
77-
<div class="col-md-3 col-sm-4 col-6 mb-3 text-center">
78-
<img src="@(mapDto.MapImageUri ?? "/images/noimage.jpg")" class="map-image img-fluid" alt="Map image for @mapDto.MapName" loading="lazy" />
79-
<small class="text-muted">#@(i + 1)</small>
80-
<h6 class="mb-0">@mapDto.MapName</h6>
77+
<div class="col-xl-2 col-lg-3 col-md-4 col-sm-4 col-6 mb-2 text-center">
78+
<img src="@(mapDto.MapImageUri ?? "/images/noimage.jpg")" class="map-image img-fluid rounded" alt="Map image for @mapDto.MapName" loading="lazy" />
79+
<small class="text-muted d-block">#@(i + 1)</small>
80+
<small class="fw-bold">@mapDto.MapName</small>
8181
</div>
8282
}
8383
}

src/XtremeIdiots.Portal.Web/wwwroot/js/map-rotation-editor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
$card.append('<span class="map-rotation-drag-handle me-2" title="Drag to reorder"><i class="fa-solid fa-grip-vertical"></i></span>');
4848
$card.append('<span class="badge bg-secondary me-2" style="min-width:28px;">' + (index + 1) + '</span>');
49-
$card.append($('<img>').attr('src', map.imageUrl || '/images/noimage.jpg').attr('alt', map.text).css({ width: '48px', height: '32px', objectFit: 'cover', borderRadius: '4px' }).addClass('me-2'));
49+
$card.append($('<img>').attr('src', map.imageUrl || '/images/noimage.jpg').attr('alt', map.text).css({ width: '80px', height: '60px', objectFit: 'cover', borderRadius: '4px' }).addClass('me-2'));
5050
$card.append($('<span>').addClass('flex-grow-1').text(map.text));
5151

5252
const $removeBtn = $('<button type="button" class="btn btn-outline-danger btn-sm ms-2"><i class="fa-solid fa-times"></i></button>');

0 commit comments

Comments
 (0)