Skip to content

Commit 4f535a5

Browse files
committed
Updated NavigationTopicViewModel to reflect updates to interface
This mirrors the changes implemented to `INavigationTopicViewModel<T>` (44b8649). Most notably, it results in `IsSelected()` from operating off of `webPath` instead of `uniqueKey`, which will be a breaking change for implementers.
1 parent 44b8649 commit 4f535a5

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

OnTopic.ViewModels/NavigationTopicViewModel.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,13 @@ namespace OnTopic.ViewModels {
2828
/// cref="NavigationTopicViewModel"/> class is marked as <c>sealed</c>.
2929
/// </para>
3030
/// </remarks>
31-
public sealed record NavigationTopicViewModel : TopicViewModel, INavigationTopicViewModel<NavigationTopicViewModel> {
31+
public sealed record NavigationTopicViewModel : INavigationTopicViewModel<NavigationTopicViewModel> {
32+
33+
/*==========================================================================================================================
34+
| TITLE
35+
\-------------------------------------------------------------------------------------------------------------------------*/
36+
/// <inheritdoc cref="TopicViewModel"/>
37+
public string? Title { get; init; }
3238

3339
/*==========================================================================================================================
3440
| SHORT TITLE
@@ -46,15 +52,21 @@ public sealed record NavigationTopicViewModel : TopicViewModel, INavigationTopic
4652
/// </summary>
4753
public Collection<NavigationTopicViewModel> Children { get; } = new();
4854

55+
/*==========================================================================================================================
56+
| WEB PATH
57+
\-------------------------------------------------------------------------------------------------------------------------*/
58+
/// <inheritdoc cref="WebPath"/>
59+
public string? WebPath { get; init; }
60+
4961
/*==========================================================================================================================
5062
| IS SELECTED?
5163
\-------------------------------------------------------------------------------------------------------------------------*/
5264
/// <summary>
5365
/// Determines whether or not the node represented by this <see cref="NavigationTopicViewModel"/> is currently selected,
5466
/// typically meaning the user is on the page this object is pointing to.
5567
/// </summary>
56-
public bool IsSelected(string uniqueKey) =>
57-
$"{uniqueKey}:".StartsWith($"{UniqueKey}:", StringComparison.OrdinalIgnoreCase);
68+
public bool IsSelected(string webPath) =>
69+
$"{webPath}:".StartsWith($"{WebPath}:", StringComparison.OrdinalIgnoreCase);
5870

5971
} //Class
6072
} //Namespace

0 commit comments

Comments
 (0)