Skip to content

Commit ad034a5

Browse files
committed
Working on navbar
1 parent 51d4179 commit ad034a5

8 files changed

Lines changed: 32 additions & 99 deletions

File tree

Source/Backend/TrinityContinuum.Server/Controllers/CharacterController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@ public async Task<IActionResult> GetCharacter(int id)
4646
[ProducesResponseType(StatusCodes.Status403Forbidden)]
4747
[ProducesResponseType(StatusCodes.Status404NotFound)]
4848
[AllowAnonymous]
49-
public async Task<IActionResult> GetCharacterImage(int id, ImageType imageType)
49+
public async Task<IActionResult> GetCharacterImage(int id)
5050
{
5151
try
5252
{
53-
var result = await _characterService.GetCharacterImage(id, imageType);
53+
var result = await _characterService.GetCharacterImage(id);
5454
if (result == null)
5555
{
5656
return NotFound();

Source/Backend/TrinityContinuum.Services/CharacterService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public interface ICharacterService
2323
/// <param name="imageType"></param>
2424
/// <param name="cancellationToken"></param>
2525
/// <returns></returns>
26-
Task<byte[]?> GetCharacterImage(int id, ImageType imageType, CancellationToken cancellationToken = default);
26+
Task<byte[]?> GetCharacterImage(int id, CancellationToken cancellationToken = default);
2727

2828
/// <summary>
2929
///
@@ -54,10 +54,10 @@ public class CharacterService(IRepositoryFactory factory) : ICharacterService
5454
return await repository.GetAsync(id, cancellationToken);
5555
}
5656

57-
public async Task<byte[]?> GetCharacterImage(int id, ImageType imageType, CancellationToken cancellationToken = default)
57+
public async Task<byte[]?> GetCharacterImage(int id, CancellationToken cancellationToken = default)
5858
{
5959
var repository = await CreateRepositoryAsync(cancellationToken);
60-
return await repository.GetCharacterImage(id, imageType, cancellationToken);
60+
return await repository.GetCharacterImage(id, cancellationToken);
6161
}
6262

6363
public async Task<IEnumerable<CharacterSummary?>?> GetCharacterList(CancellationToken cancellationToken = default)

Source/Backend/TrinityContinuum.Services/Repositories/CharacterRepository.cs

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,10 @@ public class CharacterRepository(IDataProviderService dataProvider) : GenericFil
77
public override async Task<Character?> GetAsync(int id, CancellationToken cancellationToken = default)
88
{
99
var character = await base.GetAsync(id, cancellationToken);
10-
//if(character != null)
11-
//{
12-
// var token = !string.IsNullOrWhiteSpace(character.Token)
13-
// ? await _dataProvider.ReadBinaryData(_catalogName, character.Token, cancellationToken)
14-
// : null;
15-
16-
// character.Token = (token != null)
17-
// ? "data:image/webp;base64," + Convert.ToBase64String(token)
18-
// : null;
19-
//}
20-
2110
return character;
2211
}
2312

24-
internal async Task<byte[]?> GetImageAsync(int id, ImageType imageType, CancellationToken cancellationToken = default)
13+
internal async Task<byte[]?> GetImageAsync(int id, CancellationToken cancellationToken = default)
2514
{
2615
var character = await base.GetAsync(id, cancellationToken);
2716
if(character != null)
@@ -38,21 +27,12 @@ public class CharacterRepository(IDataProviderService dataProvider) : GenericFil
3827

3928
public static class CharacterRepositoryExtensions
4029
{
41-
public static async Task<byte[]?> GetCharacterImage(this IRepository<Character> repository, int id, ImageType imageType, CancellationToken cancellationToken = default)
30+
public static async Task<byte[]?> GetCharacterImage(this IRepository<Character> repository, int id, CancellationToken cancellationToken = default)
4231
{
43-
if(repository is not CharacterRepository characterRepository)
32+
if (repository is not CharacterRepository characterRepository)
4433
{
4534
throw new InvalidOperationException("Repository is not a CharacterRepository.");
4635
}
47-
48-
return await characterRepository.GetImageAsync(id, imageType, cancellationToken);
36+
return await characterRepository.GetImageAsync(id, cancellationToken);
4937
}
5038
}
51-
52-
53-
public enum ImageType
54-
{
55-
None = 0,
56-
Token = 1,
57-
Portrait = 2
58-
}

Source/Frontend/TrinityContinuum.WebApp/Clients/ApiClient.cs

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Net.Http.Headers;
21
using Microsoft.Extensions.Options;
32
using Newtonsoft.Json;
43
using TrinityContinuum.Models.Dtos;
@@ -40,15 +39,6 @@ public interface IApiClient
4039
/// <returns></returns>
4140
Task<Character?> GetCharacter(int id, CancellationToken cancellationToken);
4241

43-
/// <summary>
44-
///
45-
/// </summary>
46-
/// <param name="id"></param>
47-
/// <param name="imageType"></param>
48-
/// <param name="cancellationToken"></param>
49-
/// <returns></returns>
50-
Task<byte[]?> GetCharacterImageAsync(int id, ImageType imageType, CancellationToken cancellationToken);
51-
5242
/// <summary>
5343
///
5444
/// </summary>
@@ -64,13 +54,6 @@ public interface IApiClient
6454
Task<IEnumerable<PsiPower>?> GetPowers(CancellationToken cancellationToken);
6555
}
6656

67-
public enum ImageType
68-
{
69-
None = 0,
70-
Token = 1,
71-
Portrait = 2
72-
}
73-
7457
/// <summary>
7558
///
7659
/// </summary>
@@ -128,22 +111,6 @@ public async Task<string> GetAsync(string uri, CancellationToken cancellationTok
128111
}
129112
}
130113

131-
public async Task<byte[]?> GetCharacterImageAsync(int id, ImageType imageType, CancellationToken cancellationToken)
132-
{
133-
try
134-
{
135-
var response = await GetAsync($"api/character/image/{id}", cancellationToken);
136-
var result = JsonConvert.DeserializeObject<byte[]>(response);
137-
138-
return result;
139-
}
140-
catch (Exception ex)
141-
{
142-
_logger.LogError(ex, "Error fetching character with ID {Id}", id);
143-
throw;
144-
}
145-
}
146-
147114
public async Task<IEnumerable<CharacterSummary>?> GetCharacters(CancellationToken cancellationToken)
148115
{
149116
try

Source/Frontend/TrinityContinuum.WebApp/Components/Layout/MainLayout.razor

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55

66
<div class="page">
77

8-
9-
<main class="row content px-4">
8+
<main class="row content px-0">
109
<div>
1110
<NavMenu />
1211
</div>

Source/Frontend/TrinityContinuum.WebApp/Components/Layout/NavMenu.razor

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
66

7-
<nav class="nav flex-row">
7+
<nav class="nav justify-content-center">
88

99
<div class="nav-item px-3">
1010
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
@@ -14,13 +14,13 @@
1414

1515
<div class="nav-item px-3">
1616
<NavLink class="nav-link" href="sheet">
17-
<span class="bi bi-person-bounding-box" aria-hidden="true"></span> Character Sheet
17+
<span class="bi bi-person-badge" aria-hidden="true"></span> Character Sheet
1818
</NavLink>
1919
</div>
2020

2121
<div class="nav-item px-3">
2222
<NavLink class="nav-link" href="powercards">
23-
<span class="bi bi-person-bounding-box" aria-hidden="true"></span> Power Cards
23+
<span class="bi bi-collection-fill" aria-hidden="true"></span> Power Cards
2424
</NavLink>
2525
</div>
2626

Source/Frontend/TrinityContinuum.WebApp/Components/Layout/NavMenu.razor.css

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center/1.75rem rgba(255, 255, 255, 0.1);
1313
}
1414

15-
.navbar-toggler:checked {
16-
background-color: rgba(255, 255, 255, 0.5);
17-
}
15+
.navbar-toggler:checked {
16+
background-color: rgba(255, 255, 255, 0.5);
17+
}
1818

1919
.top-row {
20-
min-height: 3.5rem;
21-
background-color: rgba(0,0,0,0.4);
20+
min-height: 3rem;
21+
margin-bottom: 15px;
22+
background-color: var(--header-bg);
2223
}
2324

2425
.navbar-brand {
@@ -36,44 +37,35 @@
3637
font-size: 1.2rem;
3738
display: inline-block;
3839
position: relative;
39-
margin-right: 0.75rem;
40+
margin-right: 0.5rem;
4041
background-size: cover;
4142
}
4243

4344
.nav-item {
4445
font-size: 0.9rem;
45-
padding-bottom: 0.5rem;
4646
}
4747

48-
.nav-item:first-of-type {
49-
padding-top: 1rem;
50-
}
51-
52-
.nav-item:last-of-type {
53-
padding-bottom: 1rem;
54-
}
55-
5648
.nav-item ::deep .nav-link {
5749
color: #d7d7d7;
5850
background: none;
5951
border: none;
60-
border-radius: 4px;
61-
height: 3rem;
52+
border-radius: 7px;
53+
height: 2rem;
6254
display: flex;
6355
align-items: center;
64-
line-height: 3rem;
56+
line-height: 1rem;
6557
width: 100%;
6658
}
6759

68-
.nav-item ::deep a.active {
69-
background-color: rgba(255,255,255,0.37);
70-
color: white;
71-
}
60+
.nav-item ::deep a.active {
61+
background-color: rgba(255,255,255,0.37);
62+
color: white;
63+
}
7264

73-
.nav-item ::deep .nav-link:hover {
74-
background-color: rgba(255,255,255,0.1);
75-
color: white;
76-
}
65+
.nav-item ::deep .nav-link:hover {
66+
background-color: rgba(255,255,255,0.1);
67+
color: white;
68+
}
7769

7870
.nav-scrollable {
7971
display: none;
@@ -89,11 +81,6 @@
8981
}
9082

9183
.nav-scrollable {
92-
/* Never collapse the sidebar for wide screens */
9384
display: block;
94-
95-
/* Allow sidebar to scroll for tall menus */
96-
height: calc(100vh - 3.5rem);
97-
overflow-y: auto;
9885
}
9986
}

Source/Frontend/TrinityContinuum.WebApp/wwwroot/app.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ a, .btn-link {
1717
}
1818

1919
.content {
20-
padding-top: 1.1rem;
20+
padding-top: 0px;
2121
}
2222

2323
h1:focus {

0 commit comments

Comments
 (0)