|
3 | 3 | using System.Collections.Generic; |
4 | 4 | using System.Linq; |
5 | 5 | using System.Text; |
6 | | -using System.Threading.Tasks; |
7 | 6 |
|
8 | 7 | namespace BlazorDiffusion.ServiceModel; |
9 | 8 |
|
10 | | -public static class AppData |
| 9 | +public class AppData |
11 | 10 | { |
12 | 11 | public const string Title = "Blazor Diffusion"; |
13 | 12 |
|
14 | 13 | public const int MaxArtiactSize = 10 * 1024 * 1024; |
15 | 14 | public const int MaxAvatarSize = 1024 * 1024; |
16 | 15 |
|
17 | | - static List<NavItem> DefaultLinks { get; set; } = new() { }; |
18 | | - static List<NavItem> AdminLinks { get; set; } = new() { |
| 16 | + public static AppData Instance { get; private set; } = new(); |
| 17 | + |
| 18 | + List<NavItem> DefaultLinks { get; set; } = new() { }; |
| 19 | + List<NavItem> AdminLinks { get; set; } = new() { |
19 | 20 | new NavItem { Label = "Admin", Href = "/admin" }, |
20 | 21 | }; |
21 | | - public static List<NavItem> GetNavItems(bool isAdmin) => isAdmin ? AdminLinks : DefaultLinks; |
| 22 | + public static List<NavItem> GetNavItems(bool isAdmin) => isAdmin ? Instance.AdminLinks : Instance.DefaultLinks; |
22 | 23 |
|
23 | 24 | public static List<Group> CategoryGroups = new Group[] { |
24 | 25 | new() { Name = "Scene", Items = new[] { "Quality", "Style", "Aesthetic", "Features", "Medium", "Setting", "Theme" } }, |
25 | 26 | new() { Name = "Effects", Items = new[] { "Effects", "CGI", "Filters", "Lenses", "Photography", "Lighting", "Color" } }, |
26 | 27 | new() { Name = "Art Style", Items = new[] { "Art Movement", "Art Style", "18 Century", "19 Century", "20 Century", "21 Century" } }, |
27 | 28 | new() { Name = "Mood", Items = new[] { "Positive Mood", "Negative Mood" } }, |
28 | 29 | }.ToList(); |
| 30 | + |
| 31 | + string[]? categories; |
| 32 | + public string[] Categories => categories ??= CategoryGroups.SelectMany(x => x.Items).OrderBy(x => x).ToArray(); |
29 | 33 | } |
30 | 34 |
|
31 | 35 | public class AppSource |
|
0 commit comments