diff --git a/src/Components/MangaCard.razor b/src/Components/MangaCard.razor index ebbd35d..79f6be2 100644 --- a/src/Components/MangaCard.razor +++ b/src/Components/MangaCard.razor @@ -1,14 +1,13 @@ - -@using Grimoire.Models +@using Grimoire.Models @using Grimoire.Handlers @using Grimoire.Helpers -@inject CacheHandler CacheHandler +@inject DatabaseHandler DatabaseHandler @inject NavigationManager NavigationManager @inject IConfiguration Configuration
- @Manga.Name
@@ -48,8 +47,7 @@ } private static string Truncate(string str) { - return str?.Length > 150 ? - $"{str[..150]}..." : str; + return str.Length > 150 ? $"{str[..150]}..." : str; } } \ No newline at end of file diff --git a/src/Handlers/DatabaseHandler.cs b/src/Handlers/DatabaseHandler.cs index 7964d85..0843a39 100644 --- a/src/Handlers/DatabaseHandler.cs +++ b/src/Handlers/DatabaseHandler.cs @@ -212,7 +212,7 @@ public async Task GetChapterAsync(string sourceId, string mangaId, int return chapter; } - public async Task> ListSourcesAsync(string sourceId) { + public async Task> ListSourcesAsync() { if (!config.GetValue("Save:SourceIcon")) { return _sources.ToArray(); } diff --git a/src/Pages/ChapterPage.razor b/src/Pages/ChapterPage.razor index 151e4ef..ad47767 100644 --- a/src/Pages/ChapterPage.razor +++ b/src/Pages/ChapterPage.razor @@ -5,7 +5,7 @@ @using Grimoire.Handlers @using Grimoire.Helpers -@inject CacheHandler CacheHandler +@inject DatabaseHandler DatabaseHandler
@@ -43,10 +43,10 @@ => $"Loading {MangaId.GetNameFromId()} {Chap}"; protected override async Task OnInitializedAsync() { - _chapter = await CacheHandler.GetChapterAsync(SourceId, MangaId, Chap); - _chapter = !string.IsNullOrWhiteSpace(Chapter) ? - await CacheHandler.GetChapterAsync(SourceId, MangaId, Chapter) : - await CacheHandler.GetChapterAsync(SourceId, MangaId, Chap); + _chapter = await DatabaseHandler.GetChapterAsync(SourceId, MangaId, Chap); + _chapter = !string.IsNullOrWhiteSpace(Chapter) + ? await DatabaseHandler.GetChapterAsync(SourceId, MangaId, int.Parse(Chapter)) + : await DatabaseHandler.GetChapterAsync(SourceId, MangaId, Chap); } } \ No newline at end of file diff --git a/src/Pages/Index.razor b/src/Pages/Index.razor index a1ae38c..da88a57 100644 --- a/src/Pages/Index.razor +++ b/src/Pages/Index.razor @@ -3,7 +3,7 @@ @using Grimoire.Handlers @inject NavigationManager NavigationManager -@inject DbHandler DbHandler +@inject DatabaseHandler DbHandler
@@ -24,8 +24,8 @@ } else { @foreach (var manga in _mangas - .OrderByDescending(x => x.Chapters.FirstOrDefault().ReleasedOn) - .Take(10)) { + .OrderByDescending(x => x.Chapters.FirstOrDefault().ReleasedOn) + .Take(10)) { var chapter = manga.Chapters.FirstOrDefault(); diff --git a/src/Pages/MangaPage.razor b/src/Pages/MangaPage.razor index 132e4df..ef9bb03 100644 --- a/src/Pages/MangaPage.razor +++ b/src/Pages/MangaPage.razor @@ -4,8 +4,7 @@ @using Grimoire.Handlers @using Grimoire.Helpers -@inject DbHandler DbHandler -@inject CacheHandler CacheHandler +@inject DatabaseHandler DbHandler @inject IConfiguration Configuration @inject NavigationManager NavigationManager @@ -19,7 +18,7 @@ else {
- @_manga.Name
@@ -123,7 +122,7 @@ else { => $"Loading {MangaId.GetNameFromId()}"; protected override async Task OnInitializedAsync() { - _manga = await CacheHandler.GetMangaAsync(SourceId, MangaId); + _manga = await DbHandler.GetMangaAsync(SourceId, MangaId); } private void NavTo(int chapter) { diff --git a/src/Pages/SourcePage.razor b/src/Pages/SourcePage.razor index 8342a98..c9d44bb 100644 --- a/src/Pages/SourcePage.razor +++ b/src/Pages/SourcePage.razor @@ -5,7 +5,7 @@ @using Grimoire.Helpers @using Grimoire.Models -@inject CacheHandler CacheHandler +@inject DatabaseHandler DatabaseHandler @inject NavigationManager NavigationManager