fix: resolve UI issues (icons, chapter title, AI context)
This commit is contained in:
@@ -61,7 +61,13 @@ public class EpubService : IEpubService
|
|||||||
}
|
}
|
||||||
|
|
||||||
var chapterRef = readingOrder[chapterIndex];
|
var chapterRef = readingOrder[chapterIndex];
|
||||||
var chapterTitle = chapterRef.FilePath ?? $"Chapter {chapterIndex + 1}";
|
|
||||||
|
// Try to find a better title from navigation (TOC)
|
||||||
|
var navigation = bookRef.GetNavigation();
|
||||||
|
var chapterTitle = FindTitleInNavigation(navigation, chapterRef.FilePath)
|
||||||
|
?? Path.GetFileNameWithoutExtension(chapterRef.FilePath)
|
||||||
|
?? $"Chapter {chapterIndex + 1}";
|
||||||
|
|
||||||
var chapterContent = await chapterRef.ReadContentAsTextAsync();
|
var chapterContent = await chapterRef.ReadContentAsTextAsync();
|
||||||
|
|
||||||
var blocks = new List<ContentBlock>();
|
var blocks = new List<ContentBlock>();
|
||||||
@@ -157,4 +163,25 @@ public class EpubService : IEpubService
|
|||||||
new List<string> { "Podsumuj", "Generuj Quiz", "Pomiń" }
|
new List<string> { "Podsumuj", "Generuj Quiz", "Pomiń" }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private string? FindTitleInNavigation(IEnumerable<EpubNavigationItemRef> navigation, string? filePath)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(filePath)) return null;
|
||||||
|
|
||||||
|
var fileName = Path.GetFileName(filePath);
|
||||||
|
|
||||||
|
foreach (var item in navigation)
|
||||||
|
{
|
||||||
|
// Match by full path or just filename as fallback
|
||||||
|
if (item.Link?.ContentFilePath == filePath || item.Link?.ContentFilePath == fileName)
|
||||||
|
return item.Title;
|
||||||
|
|
||||||
|
if (item.NestedItems != null && item.NestedItems.Any())
|
||||||
|
{
|
||||||
|
var childTitle = FindTitleInNavigation(item.NestedItems, filePath);
|
||||||
|
if (childTitle != null) return childTitle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,12 @@
|
|||||||
case "eye-off":
|
case "eye-off":
|
||||||
<path d="M9.88 9.88a3 3 0 1 0 4.24 4.24" /><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" /><path d="M6.61 6.61A13.52 13.52 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" /><line x1="2" x2="22" y1="2" y2="22" />
|
<path d="M9.88 9.88a3 3 0 1 0 4.24 4.24" /><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68" /><path d="M6.61 6.61A13.52 13.52 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61" /><line x1="2" x2="22" y1="2" y2="22" />
|
||||||
break;
|
break;
|
||||||
|
case "arrow-left":
|
||||||
|
<path d="M19 12H5M12 19l-7-7 7-7" />
|
||||||
|
break;
|
||||||
|
case "arrow-right":
|
||||||
|
<path d="M5 12h14M12 5l7 7-7 7" />
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
<!-- Fallback circle -->
|
<!-- Fallback circle -->
|
||||||
<circle cx="12" cy="12" r="10" />
|
<circle cx="12" cy="12" r="10" />
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.4 KiB |
@@ -42,6 +42,7 @@
|
|||||||
/// <summary>Fallback static dialogue shown when no live AI content is available.</summary>
|
/// <summary>Fallback static dialogue shown when no live AI content is available.</summary>
|
||||||
[Parameter] public string Dialogue { get; set; } = string.Empty;
|
[Parameter] public string Dialogue { get; set; } = string.Empty;
|
||||||
[Parameter] public List<string> Actions { get; set; } = new();
|
[Parameter] public List<string> Actions { get; set; } = new();
|
||||||
|
[Parameter] public string FullPageContent { get; set; } = string.Empty;
|
||||||
[Parameter] public EventCallback<string> OnActionTriggered { get; set; }
|
[Parameter] public EventCallback<string> OnActionTriggered { get; set; }
|
||||||
|
|
||||||
private string _displayedText = string.Empty;
|
private string _displayedText = string.Empty;
|
||||||
@@ -76,8 +77,11 @@
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_packet = await Coordinator.RequestSummaryAndQuizAsync(
|
var contentToAnalyze = !string.IsNullOrWhiteSpace(FullPageContent)
|
||||||
$"[ID: {ContextBlockId}]\n{Dialogue}");
|
? FullPageContent
|
||||||
|
: $"[ID: {ContextBlockId}]\n{Dialogue}";
|
||||||
|
|
||||||
|
_packet = await Coordinator.RequestSummaryAndQuizAsync(contentToAnalyze);
|
||||||
|
|
||||||
var summary = _packet?.Summary;
|
var summary = _packet?.Summary;
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,14 @@
|
|||||||
{
|
{
|
||||||
<NexusTypography Variant="NexusTypography.TypographyVariant.Ebook">@((MarkupString)textSegment.Content)</NexusTypography>
|
<NexusTypography Variant="NexusTypography.TypographyVariant.Ebook">@((MarkupString)textSegment.Content)</NexusTypography>
|
||||||
}
|
}
|
||||||
|
else if (block is AiActionTriggerBlock trigger)
|
||||||
|
{
|
||||||
|
<AiAssistantBubble
|
||||||
|
ContextBlockId="@trigger.Id"
|
||||||
|
Dialogue="@trigger.Dialogue"
|
||||||
|
Actions="@trigger.ActionOptions"
|
||||||
|
FullPageContent="@GetFullPageContent()" />
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -36,10 +36,9 @@
|
|||||||
NavigationService.OnNavigationChanged += HandleNavigationChanged;
|
NavigationService.OnNavigationChanged += HandleNavigationChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Task HandleNavigationChanged()
|
private async Task HandleNavigationChanged()
|
||||||
{
|
{
|
||||||
StateHasChanged();
|
await InvokeAsync(StateHasChanged);
|
||||||
return Task.CompletedTask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int CalculateProgress()
|
private int CalculateProgress()
|
||||||
|
|||||||
@@ -58,6 +58,7 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chapter-title {
|
.chapter-title {
|
||||||
|
|||||||
Reference in New Issue
Block a user