feat: implement epub service, navigation service, and global error boundary with updated reader UI layouts
This commit is contained in:
@@ -1,21 +1,49 @@
|
||||
@using NexusReader.UI.Shared.Services
|
||||
@inject IReaderNavigationService NavigationService
|
||||
@implements IDisposable
|
||||
|
||||
<footer class="reader-footer">
|
||||
<div class="footer-content">
|
||||
<div class="page-info">
|
||||
<span class="label">Postęp:</span>
|
||||
<span class="value">@Progress%</span>
|
||||
<div class="navigation-controls">
|
||||
<button class="nav-btn" @onclick="NavigationService.GoToPreviousChapter" disabled="@(NavigationService.CurrentChapterIndex == 0)">
|
||||
<NexusIcon Name="arrow-left" Size="14" />
|
||||
</button>
|
||||
|
||||
<div class="chapter-info">
|
||||
<span class="chapter-title">@NavigationService.ChapterTitle</span>
|
||||
<span class="chapter-count">(@(NavigationService.CurrentChapterIndex + 1) / @NavigationService.TotalChapters)</span>
|
||||
</div>
|
||||
|
||||
<button class="nav-btn" @onclick="NavigationService.GoToNextChapter" disabled="@(NavigationService.CurrentChapterIndex >= NavigationService.TotalChapters - 1)">
|
||||
<NexusIcon Name="arrow-right" Size="14" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="progress-container">
|
||||
<div class="progress-bar" style="width: @Progress%"></div>
|
||||
<div class="progress-bar" style="width: @CalculateProgress()%"></div>
|
||||
</div>
|
||||
|
||||
<div class="meta-info">
|
||||
<span class="time">1:30</span>
|
||||
<span class="battery">45% 🔋</span>
|
||||
<span class="time">@DateTime.Now.ToString("HH:mm")</span>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@code {
|
||||
[Parameter] public int Progress { get; set; } = 45;
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
NavigationService.OnNavigationChanged += StateHasChanged;
|
||||
}
|
||||
|
||||
private int CalculateProgress()
|
||||
{
|
||||
if (NavigationService.TotalChapters <= 1) return 0;
|
||||
return (int)((NavigationService.CurrentChapterIndex / (float)(NavigationService.TotalChapters - 1)) * 100);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
NavigationService.OnNavigationChanged -= StateHasChanged;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user