feat(Navigation) Added a search button for desktop users

This commit is contained in:
2022-04-16 14:49:51 -04:00
parent 5d5a0bde59
commit b9e3633d1c
26 changed files with 578 additions and 61 deletions
+35
View File
@@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.RegularExpressions;
using Model.Website;
namespace Model.Notes;
@@ -22,9 +24,42 @@ public class NoteContentModel
public string Description { get; set; }
public string Content { get; set; }
[NotMapped]
public virtual string LoadedContent { get; set; }
public string IsHidden { get; set; } = "False";
public string IsPreAlpha { get; set; } = "True";
public List<SearchPointModel> GetHeaders()
{
var regex = new Regex(@"^#* (.*)$", RegexOptions.Multiline);
var listOfMatches = regex.Matches(LoadedContent);
Console.WriteLine($"Name: {Name}");
Console.WriteLine($"Matches: {listOfMatches.Count}");
List<SearchPointModel> foundHeaders = new List<SearchPointModel>();
foreach (var capture in listOfMatches)
{
var cleanUp = capture.ToString();
cleanUp = cleanUp.ToLower();
cleanUp = cleanUp.Replace("#", "");
cleanUp = cleanUp.Replace("#", "");
cleanUp = cleanUp.Replace("\"", "");
cleanUp = cleanUp.Trim();
cleanUp = cleanUp.Replace(" ", "-");
foundHeaders.Add(new SearchPointModel(){ Title = capture.ToString().Trim(), Href = cleanUp});
Console.WriteLine($"Capture: {cleanUp}");
}
return foundHeaders;
}
[NotMapped]
public virtual ICollection<NoteContentModel> NoteContentModels { get; set; } = new List<NoteContentModel>();
+9
View File
@@ -0,0 +1,9 @@
namespace Model.Website;
public class SearchPointModel
{
public string Title { get; set; } = "";
public string Tags { get; set; } = "";
public string PointType { get; set; } = "";
public string Href { get; set; } = "";
}
-1
View File
@@ -8,7 +8,6 @@ public class WebSectionModel
public int Id { get; set; }
public string Name { get; set; } = "Add name";
public string Description { get; set; } = "Add description";
public string Href { get; set; } = null;
public int Order { get; set; } = 0;
public string IsPrivate { get; set; } = "True";