Skip to content

Commit d3daedf

Browse files
committed
partial
1 parent 860acad commit d3daedf

17 files changed

Lines changed: 102 additions & 223 deletions

Mythril.Blazor/Components/CadencePanel.razor

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,20 @@
44
@inject ResourceManager resourceManager
55

66
<div class="cadence-panel d-flex flex-column h-100">
7-
<div class="cadence-controls p-2 border-bottom">
8-
<input type="text" class="form-control form-control-sm"
7+
<div class="cadence-controls p-2 border-bottom d-flex align-items-center gap-3">
8+
<input type="text" class="form-control form-control-sm flex-grow-1"
99
placeholder="Search abilities (e.g. J-Str)..."
1010
data-testid="cadence-ability-search"
1111
@bind="_abilitySearchTerm" @bind:event="oninput" />
12+
13+
<div class="form-check form-switch text-nowrap">
14+
<input class="form-check-input" type="checkbox" id="hideDoneAbilities" @bind="_hideLearnedAbilities" />
15+
<label class="form-check-label small ms-1" for="hideDoneAbilities">Hide Done Abilities</label>
16+
</div>
17+
<div class="form-check form-switch text-nowrap">
18+
<input class="form-check-input" type="checkbox" id="hideDoneCadences" @bind="_hideLearnedCadences" />
19+
<label class="form-check-label small ms-1" for="hideDoneCadences">Hide Done Cadences</label>
20+
</div>
1221
</div>
1322

1423
<div class="flex-grow-1 overflow-auto mt-2">
@@ -29,7 +38,7 @@
2938
CompletedCount="@stats.Completed"
3039
TotalCount="@stats.Total"
3140
OnToggle="@(() => resourceManager.MarkCadenceAsSeen(cadence))">
32-
<CadenceTree CadenceData="cadence" />
41+
<CadenceTree CadenceData="cadence" HideLearned="@_hideLearnedAbilities" />
3342
</CadenceDragExpander>
3443
}
3544
}
@@ -53,11 +62,33 @@
5362
public EventCallback<Cadence> OnUnequip { get; set; }
5463

5564
private string _abilitySearchTerm = "";
65+
private bool _hideLearnedAbilities;
66+
private bool _hideLearnedCadences;
67+
68+
private IEnumerable<Cadence>? FilteredCadences
69+
{
70+
get
71+
{
72+
if (UnlockedCadences == null) return null;
73+
var list = UnlockedCadences;
74+
75+
if (!string.IsNullOrWhiteSpace(_abilitySearchTerm))
76+
{
77+
list = list.Where(c => c.Name.Contains(_abilitySearchTerm, StringComparison.OrdinalIgnoreCase) ||
78+
c.Abilities.Any(a => a.Ability.Name.Contains(_abilitySearchTerm, StringComparison.OrdinalIgnoreCase)));
79+
}
80+
81+
if (_hideLearnedCadences)
82+
{
83+
list = list.Where(c => {
84+
var stats = GetCompletionStats(c);
85+
return stats.Total == 0 || stats.Completed < stats.Total;
86+
});
87+
}
5688

57-
private IEnumerable<Cadence>? FilteredCadences => UnlockedCadences;
58-
// We don't filter out the cadences themselves, just highlight them in CadenceDragExpander if the ability matches.
59-
// Actually, usually search filters the list. But the requirement says "Highlight Cadences containing specific searched abilities".
60-
// I'll keep the full list but highlight.
89+
return list;
90+
}
91+
}
6192

6293
private async Task HandleUnequip(object cadenceObj)
6394
{

Mythril.Blazor/Components/CadenceTree.razor

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
@foreach (var abilityUnlock in CadenceData.Abilities)
66
{
77
var isUnlocked = resourceManager.UnlockedAbilities.Contains($"{CadenceData.Name}:{abilityUnlock.Ability.Name}");
8+
if (HideLearned && isUnlocked) continue;
9+
810
var canAfford = resourceManager.CanAfford(abilityUnlock);
911
var stateClass = isUnlocked ? "unlocked" : canAfford ? "affordable" : "locked";
1012

@@ -75,6 +77,9 @@
7577
[Parameter]
7678
public Cadence CadenceData { get; set; }
7779

80+
[Parameter]
81+
public bool HideLearned { get; set; }
82+
7883
private string GetTooltip(CadenceUnlock unlock)
7984
{
8085
var reqs = string.Join("\n", unlock.Requirements.Select(r => $"- {r.Quantity} {r.Item.Name}"));

Mythril.Blazor/Components/CharacterDisplay.razor

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,6 @@
9999
</div>
100100
</div>
101101

102-
@if (resourceManager.ShowMiniLogs && resourceManager.CharacterMiniLogs.TryGetValue(Character.Name, out var log) && log.Any())
103-
{
104-
<div class="mini-log mt-1" style="border-left-color: @Character.Color;">
105-
@foreach (var entry in log.Reverse())
106-
{
107-
<div class="log-entry text-truncate">@entry</div>
108-
}
109-
</div>
110-
}
111102
<div class="task-slots-container mt-2 d-flex flex-column gap-2">
112103
@for (int i = 0; i < taskLimit; i++)
113104
{

Mythril.Blazor/Components/HandPanel.razor

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
@inject ResourceManager ResourceManager
44

55
<div class="hand-panel">
6-
<div class="hand-controls p-2 d-flex justify-content-end">
6+
<div class="hand-controls p-2 d-flex justify-content-end gap-3 border-bottom">
77
<div class="form-check form-switch">
8-
<input class="form-check-input" type="checkbox" id="sortDuration" data-testid="sort-duration-switch" @bind="_sortByDuration" />
9-
<label class="form-check-label small ms-1" for="sortDuration">Sort by Duration</label>
8+
<input class="form-check-input" type="checkbox" id="hideCompletedQuests" @bind="_hideCompletedQuests" />
9+
<label class="form-check-label small ms-1" for="hideCompletedQuests">Hide Done Quests</label>
10+
</div>
11+
<div class="form-check form-switch">
12+
<input class="form-check-input" type="checkbox" id="hideCompletedLocations" @bind="_hideCompletedLocations" />
13+
<label class="form-check-label small ms-1" for="hideCompletedLocations">Hide Done Locations</label>
1014
</div>
1115
</div>
1216
<div class="hand-content">
1317
@if (Locations is not null)
1418
{
15-
@foreach (var location in Locations.Where(l => l.Quests.Any()))
19+
@foreach (var location in FilteredLocations)
1620
{
1721
var stats = GetCompletionStats(location);
1822
bool isActive = IsLocationActive(location);
@@ -26,9 +30,11 @@
2630
OnToggle="@(() => ResourceManager.MarkLocationAsSeen(location))">
2731
@{
2832
var quests = location.Quests.ToList();
29-
var sortedQuests = _sortByDuration
30-
? quests.OrderBy(q => ResourceManager.GetQuestDetails(q).DurationSeconds).ToList()
31-
: quests.OrderBy(q => ResourceManager.GetQuestDetails(q).Type == QuestType.Recurring).ToList();
33+
if (_hideCompletedQuests)
34+
{
35+
quests = quests.Where(q => !ResourceManager.IsCompleted(q.Name)).ToList();
36+
}
37+
var sortedQuests = quests.OrderBy(q => ResourceManager.GetQuestDetails(q).Type == QuestType.Recurring).ToList();
3238
}
3339
@foreach (var quest in sortedQuests)
3440
{
@@ -46,7 +52,27 @@
4652
[Parameter]
4753
public List<LocationData>? Locations { get; set; }
4854

49-
private bool _sortByDuration;
55+
private bool _hideCompletedQuests;
56+
private bool _hideCompletedLocations;
57+
58+
private IEnumerable<LocationData> FilteredLocations
59+
{
60+
get
61+
{
62+
if (Locations == null) return [];
63+
var valid = Locations.Where(l => l.Quests.Any());
64+
65+
if (_hideCompletedLocations)
66+
{
67+
valid = valid.Where(l => {
68+
var stats = GetCompletionStats(l);
69+
return stats.Total == 0 || stats.Completed < stats.Total;
70+
});
71+
}
72+
73+
return valid;
74+
}
75+
}
5076

5177
public QuestData QuestToData(Quest quest) => new QuestData(quest, ResourceManager.GetQuestDetails(quest));
5278

Mythril.Blazor/Components/JournalPanel.razor

Lines changed: 0 additions & 72 deletions
This file was deleted.

Mythril.Blazor/Components/PartyPanel.razor

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@
22
@inject Mythril.Data.ResourceManager resourceManager
33

44
<div class="party-panel d-flex flex-column h-100 overflow-hidden">
5-
<div class="d-flex justify-content-between align-items-center flex-shrink-0">
6-
<h3>Party</h3>
7-
<button class="btn btn-xs @(resourceManager.ShowMiniLogs ? "btn-secondary" : "btn-outline-secondary")"
8-
@onclick="resourceManager.ToggleMiniLogs"
9-
data-testid="toggle-minilogs"
10-
title="Toggle Mini-Logs">
11-
<span class="material-icons" style="font-size: 14px;">@(resourceManager.ShowMiniLogs ? "visibility" : "visibility_off")</span>
12-
</button>
5+
<div class="panel-header d-flex justify-content-between align-items-center mb-3">
6+
<h4 class="mb-0">Party</h4>
137
</div>
8+
149
<div class="d-flex flex-column flex-grow-1 overflow-auto gap-3 py-2 px-1">
1510

1611
@if (Party is not null && QuestProgresses is not null)

Mythril.Blazor/Components/Workshop.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,5 @@
122122

123123
private bool _showAffordableOnly = false;
124124
private string _activeFilter = "All";
125-
private string[] _outputFilters = ["All", "Spells", "Materials"];
125+
private string[] _outputFilters = ["All", "Magic", "Materials"];
126126
}

Mythril.Blazor/Pages/Home.razor

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
<li><kbd>1</kbd> - Locations</li>
2626
<li><kbd>2</kbd> - Cadences</li>
2727
<li><kbd>3</kbd> - Workshop</li>
28-
<li><kbd>4</kbd> - Journal</li>
2928
<li><kbd>?</kbd> - Toggle Help</li>
3029
</ul>
3130
</section>
@@ -126,11 +125,6 @@
126125
}
127126
</button>
128127
</li>
129-
<li class="nav-item" role="presentation">
130-
<button class="nav-link @(resourceManager.ActiveTab == "journal" ? "active" : "")" id="journal-tab" data-testid="journal-tab" data-bs-toggle="tab" data-bs-target="#journal" type="button" role="tab" @onclick='() => resourceManager.ActiveTab = "journal"'>
131-
Journal
132-
</button>
133-
</li>
134128
</ul>
135129
<div class="tab-content border border-top-0">
136130
<div class="tab-pane @(resourceManager.ActiveTab == "hand" ? "active" : "")" id="hand" role="tabpanel">
@@ -144,9 +138,6 @@
144138
<div class="tab-pane @(resourceManager.ActiveTab == "workshop" ? "active" : "")" id="workshop" role="tabpanel">
145139
<Workshop UnlockedAbilities="resourceManager.UnlockedAbilities" @key="@resourceManager.UnlockedAbilities.Count" />
146140
</div>
147-
<div class="tab-pane @(resourceManager.ActiveTab == "journal" ? "active" : "")" id="journal" role="tabpanel">
148-
<JournalPanel />
149-
</div>
150141
</div>
151142
}
152143
else

Mythril.Blazor/Pages/Home.razor.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ private async Task HandleGlobalKeyDown(KeyboardEventArgs e)
3030
if (e.Key == "1") await SwitchTab("hand-tab");
3131
if (e.Key == "2") await SwitchTab("cadence-tab");
3232
if (e.Key == "3") await SwitchTab("workshop-tab");
33-
if (e.Key == "4") await SwitchTab("journal-tab");
3433
if (e.Key == "?" || e.Key == "/") _showHelp = !_showHelp;
3534
}
3635

Mythril.Blazor/Services/PersistenceService.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,6 @@ public async Task SaveAsync()
3939
Description = q.Description,
4040
DurationSeconds = q.DurationSeconds
4141
}).ToList(),
42-
Journal = state.Journal.Select(j => new JournalEntryDTO {
43-
TaskName = j.TaskName,
44-
CharacterName = j.CharacterName,
45-
Details = j.Details,
46-
CompletedAt = j.CompletedAt,
47-
IsFirstTime = j.IsFirstTime,
48-
WasCancelled = j.WasCancelled
49-
}).ToList(),
5042
Junctions = state.Junctions.Select(j => new JunctionDTO {
5143
CharacterName = j.Character.Name,
5244
StatName = j.Stat.Name,
@@ -59,15 +51,12 @@ public async Task SaveAsync()
5951
AutoQuestEnabled = state.AutoQuestEnabled.ToDictionary(k => k.Key, v => v.Value),
6052
UnlockedLocations = state.UnlockedLocationNames.ToList(),
6153
StarredRecipes = state.StarredRecipes.ToList(),
62-
CharacterMiniLogs = state.CharacterMiniLogs.ToDictionary(k => k.Key, v => v.Value.ToList()),
63-
EverPerformedActivities = state.EverPerformedActivities.ToList(),
6454
SeenContent = state.SeenContent.ToList(),
6555
HasUnseenCadence = state.HasUnseenCadence,
6656
HasUnseenWorkshop = state.HasUnseenWorkshop,
6757
CurrentTime = state.CurrentTime,
6858
IsTestMode = state.IsTestMode,
6959
ActiveTab = state.ActiveTab,
70-
ShowMiniLogs = state.ShowMiniLogs,
7160
LastSaveTime = DateTime.Now,
7261
CharacterStatBoosts = state.CharacterPermanentStatBoosts.ToDictionary(k => k.Key, v => v.Value.ToDictionary(ik => ik.Key, iv => iv.Value))
7362
};

0 commit comments

Comments
 (0)