Skip to content

Commit

Permalink
fix: update font sizes for markdown headers. Consolidate highlight co…
Browse files Browse the repository at this point in the history
…lors.
  • Loading branch information
davidtimovski committed May 29, 2024
1 parent aade4df commit a16997c
Show file tree
Hide file tree
Showing 24 changed files with 61 additions and 62 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Panoramic.Data;

public enum HeaderHighlight
public enum HighlightColor
{
None,
Blue,
Expand Down
2 changes: 1 addition & 1 deletion src/Panoramic.Domain/IWidgetData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ public interface IWidgetData
{
Guid Id { get; }
Area Area { get; }
HeaderHighlight HeaderHighlight { get; }
HighlightColor HeaderHighlight { get; }
}
4 changes: 2 additions & 2 deletions src/Panoramic.Domain/Widgets/ChecklistData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public sealed partial class ChecklistData : IWidgetData

public required Guid Id { get; init; }
public required Area Area { get; init; }
public HeaderHighlight HeaderHighlight { get; init; }
public HighlightColor HeaderHighlight { get; init; }
public string Title { get; init; } = "To do";
public bool Searchable { get; init; } = true;
public required List<ChecklistTaskData> Tasks { get; init; }
Expand Down Expand Up @@ -71,7 +71,7 @@ public static ChecklistData FromMarkdown(string markdown)
lineIndex++;

var headerHighlightRowValues = lines[lineIndex].Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
var headerHighlight = Enum.Parse<HeaderHighlight>(headerHighlightRowValues[1]);
var headerHighlight = Enum.Parse<HighlightColor>(headerHighlightRowValues[1]);
lineIndex++;

var searchableRowValues = lines[lineIndex].Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
Expand Down
4 changes: 2 additions & 2 deletions src/Panoramic.Domain/Widgets/LinkCollectionData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public sealed partial class LinkCollectionData : IWidgetData

public required Guid Id { get; init; }
public required Area Area { get; init; }
public HeaderHighlight HeaderHighlight { get; init; }
public HighlightColor HeaderHighlight { get; init; }
public string Title { get; init; } = "My links";
public bool Searchable { get; init; } = true;
public required List<LinkCollectionItemData> Links { get; init; }
Expand Down Expand Up @@ -64,7 +64,7 @@ public static LinkCollectionData FromMarkdown(string markdown)
lineIndex++;

var headerHighlightRowValues = lines[lineIndex].Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
var headerHighlight = Enum.Parse<HeaderHighlight>(headerHighlightRowValues[1]);
var headerHighlight = Enum.Parse<HighlightColor>(headerHighlightRowValues[1]);
lineIndex++;

var searchableRowValues = lines[lineIndex].Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
Expand Down
4 changes: 2 additions & 2 deletions src/Panoramic.Domain/Widgets/NoteData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public sealed class NoteData : IWidgetData

public required Guid Id { get; init; }
public required Area Area { get; init; }
public HeaderHighlight HeaderHighlight { get; init; }
public HighlightColor HeaderHighlight { get; init; }
public string FontFamily { get; init; } = "Default";
public double FontSize { get; init; } = 15;
public string? RelativeFilePath { get; init; }
Expand All @@ -31,7 +31,7 @@ public static NoteData FromMarkdown(string markdown)
lineIndex++;

var headerHighlightRowValues = lines[lineIndex].Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
var headerHighlight = Enum.Parse<HeaderHighlight>(headerHighlightRowValues[1]);
var headerHighlight = Enum.Parse<HighlightColor>(headerHighlightRowValues[1]);
lineIndex++;

var fontFamily = lines[lineIndex].Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)[1];
Expand Down
4 changes: 2 additions & 2 deletions src/Panoramic.Domain/Widgets/RecentLinksData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public sealed partial class RecentLinksData : IWidgetData

public required Guid Id { get; init; }
public required Area Area { get; init; }
public HeaderHighlight HeaderHighlight { get; init; }
public HighlightColor HeaderHighlight { get; init; }
public string Title { get; init; } = "Recent";
public int Capacity { get; init; } = 15;
public bool OnlyFromToday { get; init; }
Expand Down Expand Up @@ -66,7 +66,7 @@ public static RecentLinksData FromMarkdown(string markdown)
lineIndex++;

var headerHighlightRowValues = lines[lineIndex].Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
var headerHighlight = Enum.Parse<HeaderHighlight>(headerHighlightRowValues[1]);
var headerHighlight = Enum.Parse<HighlightColor>(headerHighlightRowValues[1]);
lineIndex++;

var capacityRowValues = lines[lineIndex].Split('|', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
Expand Down
28 changes: 14 additions & 14 deletions src/Panoramic/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
<SolidColorBrush x:Key="PanoramicPaleTextForeground" Color="#888" />

<!-- Header highlights -->
<SolidColorBrush x:Key="PanoramicBlueHeaderHighlight" Color="#acf" />
<SolidColorBrush x:Key="PanoramicRedHeaderHighlight" Color="#ef7777" />
<SolidColorBrush x:Key="PanoramicGreenHeaderHighlight" Color="#bda" />
<SolidColorBrush x:Key="PanoramicYellowHeaderHighlight" Color="#ed5" />
<SolidColorBrush x:Key="PanoramicOrangeHeaderHighlight" Color="#ea5" />
<SolidColorBrush x:Key="PanoramicPurpleHeaderHighlight" Color="#cbe" />
<SolidColorBrush x:Key="PanoramicTealHeaderHighlight" Color="#aae0e0" />
<SolidColorBrush x:Key="PanoramicBlueHighlight" Color="#acf" />
<SolidColorBrush x:Key="PanoramicRedHighlight" Color="#ff7777" />
<SolidColorBrush x:Key="PanoramicGreenHighlight" Color="#bda" />
<SolidColorBrush x:Key="PanoramicYellowHighlight" Color="#ed5" />
<SolidColorBrush x:Key="PanoramicOrangeHighlight" Color="#ea5" />
<SolidColorBrush x:Key="PanoramicPurpleHighlight" Color="#cbe" />
<SolidColorBrush x:Key="PanoramicTealHighlight" Color="#aae0e0" />

<SolidColorBrush x:Key="PanoramicFileSystemIconForegroundBrush" Color="#333" />
</ResourceDictionary>
Expand All @@ -53,13 +53,13 @@
<SolidColorBrush x:Key="PanoramicPaleTextForeground" Color="#aaa" />

<!-- Header highlights -->
<SolidColorBrush x:Key="PanoramicBlueHeaderHighlight" Color="#112a4d" />
<SolidColorBrush x:Key="PanoramicRedHeaderHighlight" Color="#411" />
<SolidColorBrush x:Key="PanoramicGreenHeaderHighlight" Color="#131" />
<SolidColorBrush x:Key="PanoramicYellowHeaderHighlight" Color="#444411" />
<SolidColorBrush x:Key="PanoramicOrangeHeaderHighlight" Color="#553300" />
<SolidColorBrush x:Key="PanoramicPurpleHeaderHighlight" Color="#31113e" />
<SolidColorBrush x:Key="PanoramicTealHeaderHighlight" Color="#004040" />
<SolidColorBrush x:Key="PanoramicBlueHighlight" Color="#112a4d" />
<SolidColorBrush x:Key="PanoramicRedHighlight" Color="#411" />
<SolidColorBrush x:Key="PanoramicGreenHighlight" Color="#131" />
<SolidColorBrush x:Key="PanoramicYellowHighlight" Color="#444411" />
<SolidColorBrush x:Key="PanoramicOrangeHighlight" Color="#553300" />
<SolidColorBrush x:Key="PanoramicPurpleHighlight" Color="#31113e" />
<SolidColorBrush x:Key="PanoramicTealHighlight" Color="#004040" />

<SolidColorBrush x:Key="PanoramicFileSystemIconForegroundBrush" Color="#ddd" />
</ResourceDictionary>
Expand Down
4 changes: 2 additions & 2 deletions src/Panoramic/Models/Domain/Checklist/ChecklistWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public sealed class ChecklistWidget : IWidget
/// <summary>
/// Constructs a new link collection widget.
/// </summary>
public ChecklistWidget(IStorageService storageService, Area area, HeaderHighlight headerHighlight, string title, bool searchable)
public ChecklistWidget(IStorageService storageService, Area area, HighlightColor headerHighlight, string title, bool searchable)
{
_storageService = storageService;

Expand Down Expand Up @@ -52,7 +52,7 @@ private ChecklistWidget(IStorageService storageService, ChecklistData data)
public Guid Id { get; }
public WidgetType Type { get; } = WidgetType.Checklist;
public Area Area { get; set; }
public HeaderHighlight HeaderHighlight { get; set; }
public HighlightColor HeaderHighlight { get; set; }
public string Title { get; set; }
public bool Searchable { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public sealed class LinkCollectionWidget : IWidget
/// <summary>
/// Constructs a new link collection widget.
/// </summary>
public LinkCollectionWidget(IStorageService storageService, Area area, HeaderHighlight headerHighlight, string title, bool searchable)
public LinkCollectionWidget(IStorageService storageService, Area area, HighlightColor headerHighlight, string title, bool searchable)
{
_storageService = storageService;

Expand Down Expand Up @@ -52,7 +52,7 @@ private LinkCollectionWidget(IStorageService storageService, LinkCollectionData
public Guid Id { get; }
public WidgetType Type { get; } = WidgetType.LinkCollection;
public Area Area { get; set; }
public HeaderHighlight HeaderHighlight { get; set; }
public HighlightColor HeaderHighlight { get; set; }
public string Title { get; set; }
public bool Searchable { get; set; }

Expand Down
4 changes: 2 additions & 2 deletions src/Panoramic/Models/Domain/Note/NoteWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public sealed class NoteWidget : IWidget
/// <summary>
/// Constructs a new note widget.
/// </summary>
public NoteWidget(IStorageService storageService, Area area, HeaderHighlight headerHighlight, string fontFamily, double fontSize)
public NoteWidget(IStorageService storageService, Area area, HighlightColor headerHighlight, string fontFamily, double fontSize)
{
_storageService = storageService;

Expand Down Expand Up @@ -56,7 +56,7 @@ private NoteWidget(IStorageService storageService, NoteData data)
public Guid Id { get; }
public WidgetType Type { get; } = WidgetType.Note;
public Area Area { get; set; }
public HeaderHighlight HeaderHighlight { get; set; }
public HighlightColor HeaderHighlight { get; set; }
public string FontFamily { get; set; }
public double FontSize { get; set; }
public FileSystemItemPath? NotePath { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions src/Panoramic/Models/Domain/RecentLinks/RecentLinksWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public sealed class RecentLinksWidget : IWidget
/// <summary>
/// Constructs a new recent links widget.
/// </summary>
public RecentLinksWidget(IStorageService storageService, Area area, HeaderHighlight headerHighlight, string title, int capacity, bool onlyFromToday, bool searchable)
public RecentLinksWidget(IStorageService storageService, Area area, HighlightColor headerHighlight, string title, int capacity, bool onlyFromToday, bool searchable)
{
_storageService = storageService;

Expand Down Expand Up @@ -56,7 +56,7 @@ private RecentLinksWidget(IStorageService storageService, RecentLinksData data)
public Guid Id { get; }
public WidgetType Type { get; } = WidgetType.RecentLinks;
public Area Area { get; set; }
public HeaderHighlight HeaderHighlight { get; set; }
public HighlightColor HeaderHighlight { get; set; }
public string Title { get; set; }
public int Capacity { get; set; }
public bool OnlyFromToday { get; set; }
Expand Down
2 changes: 1 addition & 1 deletion src/Panoramic/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Identity
Name="606DavidTimovski.Panoramic"
Publisher="CN=43B6C682-5195-4A6E-9EE9-F644821A02C8"
Version="0.8.0.0" />
Version="0.8.1.0" />

<mp:PhoneIdentity PhoneProductId="f76620e6-6c53-4771-80d2-572ec6868e4b" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<SolidColorBrush x:Key="PanoramicTaskOverdueBackgroundBrush" Color="#99ee0000" />
<SolidColorBrush x:Key="PanoramicTaskAlmostDueBackgroundBrush" Color="#aae9a00b" />
<SolidColorBrush x:Key="PanoramicTaskDueDateForeground" Color="#555" />
</ResourceDictionary>

<ResourceDictionary x:Key="Dark">
<SolidColorBrush x:Key="PanoramicTaskOverdueBackgroundBrush" Color="#66ee0000" />
<SolidColorBrush x:Key="PanoramicTaskAlmostDueBackgroundBrush" Color="#77e9a00b" />
<SolidColorBrush x:Key="PanoramicTaskDueDateForeground" Color="#fff" />
</ResourceDictionary>
Expand Down
6 changes: 3 additions & 3 deletions src/Panoramic/Panoramic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="CommunityToolkit.WinUI.UI" Version="7.1.2" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.60" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.61" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240404000" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.3233" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.5.240428000" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

Expand Down
10 changes: 5 additions & 5 deletions src/Panoramic/Services/Markdown/MarkdownService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private Paragraph ToHeader1(string text, string noteName, double fontSize)
{
var paragraph = new Paragraph
{
FontSize = fontSize + 10,
FontSize = fontSize + 5,
FontWeight = FontWeights.Bold,
Margin = new Thickness(0, 0, 0, HeaderMarginBottom)
};
Expand All @@ -111,7 +111,7 @@ private Paragraph ToHeader2(string text, string noteName, double fontSize)
{
var paragraph = new Paragraph
{
FontSize = fontSize + 8,
FontSize = fontSize + 4,
FontWeight = FontWeights.Bold,
Margin = new Thickness(0, 0, 0, HeaderMarginBottom)
};
Expand All @@ -126,7 +126,7 @@ private Paragraph ToHeader3(string text, string noteName, double fontSize)
{
var paragraph = new Paragraph
{
FontSize = fontSize + 6,
FontSize = fontSize + 3,
FontWeight = FontWeights.Bold,
Margin = new Thickness(0, 0, 0, HeaderMarginBottom)
};
Expand All @@ -141,7 +141,7 @@ private Paragraph ToHeader4(string text, string noteName, double fontSize)
{
var paragraph = new Paragraph
{
FontSize = fontSize + 4,
FontSize = fontSize + 2,
FontWeight = FontWeights.Bold,
Margin = new Thickness(0, 0, 0, HeaderMarginBottom)
};
Expand All @@ -156,7 +156,7 @@ private Paragraph ToHeader5(string text, string noteName, double fontSize)
{
var paragraph = new Paragraph
{
FontSize = fontSize + 2,
FontSize = fontSize + 1,
FontWeight = FontWeights.Bold,
Margin = new Thickness(0, 0, 0, HeaderMarginBottom)
};
Expand Down
20 changes: 10 additions & 10 deletions src/Panoramic/Utils/ResourceUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ static ResourceUtil()
HighlightedBackground = (appCurrentThemeDict["PanoramicHighlightedBackgroundBrush"] as SolidColorBrush)!;
PaleTextForeground = (appCurrentThemeDict["PanoramicPaleTextForeground"] as SolidColorBrush)!;

WidgetHeaderBrushes = new Dictionary<HeaderHighlight, SolidColorBrush>
HighlightBrushes = new Dictionary<HighlightColor, SolidColorBrush>
{
{ HeaderHighlight.None, (appCurrentThemeDict["PanoramicWidgetBackgroundBrush"] as SolidColorBrush)! },
{ HeaderHighlight.Blue, (appCurrentThemeDict["PanoramicBlueHeaderHighlight"] as SolidColorBrush)! },
{ HeaderHighlight.Red, (appCurrentThemeDict["PanoramicRedHeaderHighlight"] as SolidColorBrush)! },
{ HeaderHighlight.Green, (appCurrentThemeDict["PanoramicGreenHeaderHighlight"] as SolidColorBrush)! },
{ HeaderHighlight.Yellow, (appCurrentThemeDict["PanoramicYellowHeaderHighlight"] as SolidColorBrush)! },
{ HeaderHighlight.Orange, (appCurrentThemeDict["PanoramicOrangeHeaderHighlight"] as SolidColorBrush)! },
{ HeaderHighlight.Purple, (appCurrentThemeDict["PanoramicPurpleHeaderHighlight"] as SolidColorBrush)! },
{ HeaderHighlight.Teal, (appCurrentThemeDict["PanoramicTealHeaderHighlight"] as SolidColorBrush)! }
{ HighlightColor.None, (appCurrentThemeDict["PanoramicWidgetBackgroundBrush"] as SolidColorBrush)! },
{ HighlightColor.Blue, (appCurrentThemeDict["PanoramicBlueHighlight"] as SolidColorBrush)! },
{ HighlightColor.Red, (appCurrentThemeDict["PanoramicRedHighlight"] as SolidColorBrush)! },
{ HighlightColor.Green, (appCurrentThemeDict["PanoramicGreenHighlight"] as SolidColorBrush)! },
{ HighlightColor.Yellow, (appCurrentThemeDict["PanoramicYellowHighlight"] as SolidColorBrush)! },
{ HighlightColor.Orange, (appCurrentThemeDict["PanoramicOrangeHighlight"] as SolidColorBrush)! },
{ HighlightColor.Purple, (appCurrentThemeDict["PanoramicPurpleHighlight"] as SolidColorBrush)! },
{ HighlightColor.Teal, (appCurrentThemeDict["PanoramicTealHighlight"] as SolidColorBrush)! }
};
}

Expand All @@ -42,7 +42,7 @@ static ResourceUtil()
public static SolidColorBrush HighlightedBackground { get; }
public static SolidColorBrush PaleTextForeground { get; }

public static readonly IReadOnlyDictionary<HeaderHighlight, SolidColorBrush> WidgetHeaderBrushes;
public static readonly IReadOnlyDictionary<HighlightColor, SolidColorBrush> HighlightBrushes;

public static SolidColorBrush GetBrushFromPage(string resourceName, Page page)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void AttachValidationHandler(EventHandler<ValidationEventArgs> handler)

public async Task SubmitAsync()
{
var headerHighlight = Enum.Parse<HeaderHighlight>(HeaderHighlight);
var headerHighlight = Enum.Parse<HighlightColor>(HeaderHighlight);

if (Id == Guid.Empty)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media;
using Panoramic.Data;
using Panoramic.Models.Domain.Checklist;
using Panoramic.Services;
using Panoramic.Services.Search;
Expand Down Expand Up @@ -37,7 +38,7 @@ public ChecklistViewModel(IEventHub eventHub, ISearchService searchService, Disp
_titleDefaultForeground = ResourceUtil.WidgetForeground;
_titleCompletedForeground = ResourceUtil.HighlightedForeground;
_taskDueDateBackground = ResourceUtil.HighlightedBackground;
_taskDueDateOverdueBackground = ResourceUtil.GetBrushFromPage("PanoramicTaskOverdueBackgroundBrush", page);
_taskDueDateOverdueBackground = ResourceUtil.HighlightBrushes[HighlightColor.Red];
_taskDueDateAlmostDueBackground = ResourceUtil.GetBrushFromPage("PanoramicTaskAlmostDueBackgroundBrush", page);

_eventHub = eventHub;
Expand All @@ -55,7 +56,7 @@ public ChecklistViewModel(IEventHub eventHub, ISearchService searchService, Disp
_widget.TaskAdded += TaskAdded;
_widget.TaskCompleted += TaskCompleted;

HeaderBackgroundBrush = ResourceUtil.WidgetHeaderBrushes[widget.HeaderHighlight];
HeaderBackgroundBrush = ResourceUtil.HighlightBrushes[widget.HeaderHighlight];
Title = widget.Title;

SetViewModel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void AttachValidationHandler(EventHandler<ValidationEventArgs> handler)

public async Task SubmitAsync()
{
var headerHighlight = Enum.Parse<HeaderHighlight>(HeaderHighlight);
var headerHighlight = Enum.Parse<HighlightColor>(HeaderHighlight);

if (Id == Guid.Empty)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public LinkCollectionViewModel(IEventHub eventHub, ISearchService searchService,

_widget = widget;

HeaderBackgroundBrush = ResourceUtil.WidgetHeaderBrushes[widget.HeaderHighlight];
HeaderBackgroundBrush = ResourceUtil.HighlightBrushes[widget.HeaderHighlight];
Title = widget.Title;

SetViewModel();
Expand Down
Loading

0 comments on commit a16997c

Please sign in to comment.