Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions JournalApp.Tests/CalendarTests.razor
Original file line number Diff line number Diff line change
Expand Up @@ -100,34 +100,6 @@
weekHeaders[6].TextContent.Should().Be("Tu");
}

[Fact]
public void ChangePalette()
{
var layout = Render(
@<MainLayout>
<Body>
<CalendarPage OpenToDateString="20230101" />
</Body>
</MainLayout>);

var preferenceService = Services.GetService<PreferenceService>();
var initialColor = preferenceService.PrimaryColor;

layout.Find(".pick-palette").Click();

// Click a color.
var overlay = layout.Find(".color-picker .mud-dialog-content .mud-picker-color-overlay-black .mud-picker-color-overlay");
overlay.PointerDown(new PointerEventArgs { OffsetX = 235, OffsetY = 18 });
overlay.PointerUp(new PointerEventArgs { OffsetX = 235, OffsetY = 18 });

// Close dialog.
layout.Find(".mud-overlay-dialog").Click();
layout.WaitForAssertion(() => layout.FindAll(".mud-overlay-dialog").Count.Should().Be(0));

// Color should have changed.
preferenceService.PrimaryColor.Should().NotBe(initialColor);
}

[Fact]
[Description("Are the number of years, and months in the grid correct?")]
public void YearsAndMonths()
Expand Down
22 changes: 3 additions & 19 deletions JournalApp/Data/PreferenceService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,24 +64,6 @@ public bool HideNotes
set => _preferenceStore.Set("hide_notes", value);
}

public MudColor PrimaryColor
{
get
{
var palette = _preferenceStore.Get("mood_palette2", string.Empty);

if (string.IsNullOrEmpty(palette))
palette = "#FF9FDF";

return palette;
}
set
{
_preferenceStore.Set("mood_palette2", value.Value[..^2]);
GenerateMoodColors();
}
}

public SafetyPlan SafetyPlan
{
get => _preferenceStore.GetJson<SafetyPlan>("safety_plan");
Expand Down Expand Up @@ -152,7 +134,9 @@ private void UpdateStatusBar()
private void GenerateMoodColors()
{
var emojis = DataPoint.Moods.Where(x => x != "🤔").ToList();
var primary = PrimaryColor.ToMauiColor();
#pragma warning disable CS0618 // Type or member is obsolete
var primary = Color.FromHex("#FF9FDF");
#pragma warning restore CS0618 // Type or member is obsolete
var complementary = primary.GetComplementary();

_moodColors = [];
Expand Down
13 changes: 0 additions & 13 deletions JournalApp/Pages/Calendar/CalendarPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
<MudText Typo="Typo.h6">Calendar</MudText>

<MudSpacer />

<MudIconButton Class="pick-palette" Icon="@Icons.Material.Rounded.Palette" aria-label="Pick color palette" OnClick="OpenColorPicker" />
</div>

<CalendarSwitcher @ref="_switcher" @bind-SelectedYear="SelectedYear" @bind-SelectedYear:after="AfterSelectedYearChanged" YearClicked="OnYearClicked" />
Expand Down Expand Up @@ -118,17 +116,6 @@
}
}

async Task OpenColorPicker()
{
logger.LogInformation("Opening color picker");

if (await ColorPickerDialog.ShowDialog(DialogService, PreferenceService.PrimaryColor) is MudColor selectedColor)
{
PreferenceService.PrimaryColor = selectedColor;
StateHasChanged();
}
}

void Close()
{
logger.LogInformation("Going to index");
Expand Down
68 changes: 0 additions & 68 deletions JournalApp/Pages/Calendar/ColorPickerDialog.razor

This file was deleted.

Loading