Skip to content

Commit ac76a24

Browse files
committed
feat: (gallery/NavigationRootPage) add IsVisible property to control realms
1 parent 2bf124e commit ac76a24

File tree

4 files changed

+22
-7
lines changed

4 files changed

+22
-7
lines changed

source/iNKORE.UI.WPF.Modern.Gallery/DataModel/ControlInfoData.schema.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"type": "string",
2222
"description": "Title appears on the overview card and control page"
2323
},
24+
2425
"Subtitle":
2526
{
2627
"type": "string",
@@ -160,6 +161,11 @@
160161
"Items"
161162
]
162163
}
164+
},
165+
166+
"IsVisible":
167+
{
168+
"type": "boolean"
163169
}
164170
},
165171

source/iNKORE.UI.WPF.Modern.Gallery/DataModel/ControlInfoDataItem.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ public class ControlInfoDataRealm
117117
public string UniqueId { get; set; }
118118
public string Title { get; set; }
119119

120+
public bool IsVisible { get; set; } = true;
121+
120122
public ObservableCollection<ControlInfoDataGroup> Groups { get; set; }
121123

122124
public ControlInfoDataRealm()
@@ -259,6 +261,14 @@ private async Task GetControlInfoDataAsync()
259261
JsonDocument jsonDocument = JsonDocument.Parse(jsonText, new JsonDocumentOptions() { AllowTrailingCommas = true, CommentHandling = JsonCommentHandling.Skip });
260262
JsonElement jsonArray = jsonDocument.RootElement.GetProperty("Groups");
261263

264+
if (jsonDocument.RootElement.TryGetProperty("IsVisible", out JsonElement isVisibleElement))
265+
{
266+
realm.IsVisible = isVisibleElement.GetBoolean();
267+
}
268+
269+
// Set IsVisible property from JSON
270+
271+
262272
lock (_lock)
263273
{
264274
string pageRoot = $"iNKORE.UI.WPF.Modern.Gallery.Pages.Controls.{realmName}.";

source/iNKORE.UI.WPF.Modern.Gallery/DataModel/Data/Controls.Foundation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Everything from Windows UI
33
"$schema": "../ControlInfoData.schema.json",
44

5+
"IsVisible": false,
56
"Groups":
67
[
78
{

source/iNKORE.UI.WPF.Modern.Gallery/Navigation/NavigationRootPage.xaml.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,13 @@ private void AddNavigationMenuItems()
159159

160160
foreach(var realm in ControlInfoDataSource.Instance.Realms)
161161
{
162-
NavigationViewControl.MenuItems.Add(new NavigationViewItemHeader() { Content = realm.Title.ToUpper() });
162+
var isRealmVisible = realm.IsVisible;
163+
164+
if (isRealmVisible) NavigationViewControl.MenuItems.Add(new NavigationViewItemHeader() { Content = realm.Title.ToUpper() });
163165

164166
foreach (var group in realm.Groups.OrderBy(i => i.Title))
165167
{
166-
// Skip Design group since it's hardcoded in XAML
167-
if (group.UniqueId == "Design")
168-
{
169-
continue;
170-
}
168+
var isGroupVisible = realm.IsVisible && true; // Implement group-level visibility if needed
171169

172170
var itemGroup = new NavigationViewItem() { Content = group.Title, Tag = group.UniqueId, DataContext = group, Icon = GetIcon(group.ImageIconPath) };
173171

@@ -189,7 +187,7 @@ private void AddNavigationMenuItems()
189187
AutomationProperties.SetName(itemInGroup, item.Title);
190188
}
191189

192-
NavigationViewControl.MenuItems.Add(itemGroup);
190+
if (isGroupVisible) NavigationViewControl.MenuItems.Add(itemGroup);
193191

194192
if (group.UniqueId == "AllControls")
195193
{

0 commit comments

Comments
 (0)