Skip to content

Commit

Permalink
Add About (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
wbaldoumas authored Oct 10, 2024
1 parent 59b7395 commit 4d3584a
Show file tree
Hide file tree
Showing 11 changed files with 138 additions and 12 deletions.
19 changes: 16 additions & 3 deletions src/BaroquenMelody.App.Components/Layout/MainLayout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<MudThemeProvider Theme="@ThemeProvider.Theme" IsDarkMode="ThemeProvider.IsDarkMode"/>
<MudPopoverProvider/>
<MudSnackbarProvider/>
<MudDialogProvider
<MudDialogProvider
BackdropClick="false"
FullWidth="true"
MaxWidth="MaxWidth.Small"/>
Expand All @@ -24,10 +24,11 @@
<MudMenu Icon="@Icons.Material.Sharp.MoreVert"
Class="mr-2"
AriaLabel="more options">
<MudMenuItem Icon="@Icons.Material.Sharp.Lightbulb" IconColor="Color.Warning" Href="https://github.com/wbaldoumas/baroquen-melody/issues/new?template=FEATURE_REQUEST.md">Feature request</MudMenuItem>
<MudMenuItem Icon="@Icons.Material.Sharp.Lightbulb" IconColor="Color.Warning" Href="https://github.com/wbaldoumas/baroquen-melody/issues/new?template=FEATURE_REQUEST.md" >Feature request</MudMenuItem>
<MudMenuItem Icon="@Icons.Material.Sharp.BugReport" IconColor="Color.Tertiary" Href="https://github.com/wbaldoumas/baroquen-melody/issues/new?template=BUG_REPORT.md">Report a bug</MudMenuItem>
<MudMenuItem Icon="@Icons.Material.Sharp.Shield" IconColor="Color.Info" Href="https://github.com/wbaldoumas/baroquen-melody/security/policy">Report a vulnerability</MudMenuItem>
<MudMenuItem Icon="@Icons.Material.Sharp.Coffee" IconColor="Color.Secondary" Href="https://buymeacoffee.com/baroquenmelody">Buy me a coffee</MudMenuItem>
<MudMenuItem Icon="@Icons.Material.Sharp.Chat" IconColor="Color.Secondary" Href="https://github.com/wbaldoumas/baroquen-melody/discussions">Discuss</MudMenuItem>
<MudMenuItem Icon="@Icons.Material.Sharp.QuestionMark" IconColor="Color.Primary" OnClick="OpenAbout">About</MudMenuItem>
</MudMenu>
</MudTooltip>
</MudAppBar>
Expand All @@ -45,4 +46,16 @@
@code
{
private bool _isDrawerOpen;

private void OpenAbout()
{
DialogService.Show<About>(
"About Baroquen Melody",
new DialogOptions
{
MaxWidth = MaxWidth.Small,
CloseButton = true
}
);
}
}
1 change: 0 additions & 1 deletion src/BaroquenMelody.App.Components/Layout/NavMenu.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
<MudDivider />
<MudNavLink Href="" Match="NavLinkMatch.All" IconColor="Color.Secondary" Icon="@Icons.Material.Sharp.Home">Home</MudNavLink>
<MudNavLink Href="configurations" Match="NavLinkMatch.Prefix" IconColor="Color.Secondary" Icon="@Icons.Material.Sharp.Folder">Saved Configurations</MudNavLink>
<MudNavLink Href="about" Match="NavLinkMatch.Prefix" IconColor="Color.Secondary" Icon="@Icons.Material.Sharp.QuestionMark">About</MudNavLink>
</MudNavMenu>
5 changes: 0 additions & 5 deletions src/BaroquenMelody.App.Components/Pages/About.razor

This file was deleted.

32 changes: 32 additions & 0 deletions src/BaroquenMelody.App.Components/Shared/About.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<MudDialog Gutters="true">
<TitleContent>
<MudStack Row="true" AlignItems="AlignItems.Center">
<MudAvatar Color="Color.Tertiary" Variant="Variant.Filled">
<MudIcon Color="@(ThemeProvider.IsDarkMode ? Color.Dark : Color.Surface)" Icon="@Icons.Material.Sharp.MusicNote" Size="Size.Large" />
</MudAvatar>
<MudText Typo="Typo.h4" Color="Color.Tertiary">Baroquen Melody</MudText>
</MudStack>
</TitleContent>
<DialogContent>
<MudContainer Gutters="false">
<MudStack>
<MudStack Spacing="0">
<MudText Typo="Typo.caption">Version: @ApplicationInfo.Version</MudText>
<MudText Typo="Typo.caption">Revision: <MudLink Typo="Typo.inherit" Href="@($"{ApplicationInfo.RepositoryUrl}/tree/{ApplicationInfo.Sha}")">@ApplicationInfo.Commit</MudLink></MudText>
<MudText Typo="Typo.caption">Revision Date: @ApplicationInfo.CommitDate</MudText>
</MudStack>
<MudDivider DividerType="DividerType.Middle"/>
<MudStack>
<MudText Typo="Typo.body1">Baroquen Melody ("broken melody") is an app that automagically generates neo-baroque style music based on your own configurations and rules. Explore, experiment, and learn a bit about making music!</MudText>
<MudText Typo="Typo.body2">Want to help? <MudLink Typo="Typo.inherit" Href="@ApplicationInfo.SupportUrl">Show your support</MudLink> or <MudLink Typo="Typo.inherit" Href="@ApplicationInfo.ContributeUrl">get involved!</MudLink></MudText>
</MudStack>
<MudDivider/>
<MudStack Row="true" Justify="Justify.SpaceEvenly" Class="mb-1">
<MudLink Href="@ApplicationInfo.RepositoryUrl" Typo="Typo.caption">source code</MudLink>
<MudText Typo="Typo.caption"@DateTime.Now.Year William Baldoumas</MudText>
<MudLink Href="@ApplicationInfo.LicenseUrl" Typo="Typo.caption">licensing info</MudLink>
</MudStack>
</MudStack>
</MudContainer>
</DialogContent>
</MudDialog>
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<MudSwitch T="bool"
Label="Lock"
Value="IsLocked"
Color="Color.Info"
Color="Color.Primary"
LabelPosition="LabelPosition.Start"
ThumbIconColor="Color.Dark"
ThumbIcon="@IsLockedIcon"
Expand Down
2 changes: 2 additions & 0 deletions src/BaroquenMelody.App.Components/_Imports.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@using BaroquenMelody.App
@using BaroquenMelody.App.Components
@using BaroquenMelody.App.Components.Shared
@using BaroquenMelody.Infrastructure.Application
@using BaroquenMelody.Infrastructure.Devices
@using BaroquenMelody.Infrastructure.Extensions
@using BaroquenMelody.Infrastructure.State
Expand Down Expand Up @@ -59,3 +60,4 @@
@inject IPhysicalDeviceInfo PhysicalDeviceInfo
@inject IJSRuntime JsRuntime
@inject IMidiExampleGenerator MidiExampleGenerator
@inject IApplicationInfo ApplicationInfo
6 changes: 5 additions & 1 deletion src/BaroquenMelody.App/BaroquenMelody.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<ApplicationTitle>Baroquen Melody</ApplicationTitle>

<!-- App Identifier -->
<ApplicationId>com.wbaldoumas.baroquenmelody.app</ApplicationId>
<ApplicationId>com.baroquenmelody.app</ApplicationId>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
Expand Down Expand Up @@ -71,6 +71,10 @@

<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui" Version="9.1.0" />
<PackageReference Include="GitInfo" Version="3.3.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Meziantou.Analyzer" Version="2.0.169">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using BaroquenMelody.Infrastructure.Application;
using System.Globalization;

namespace BaroquenMelody.App.Infrastructure.Application;

internal sealed class ApplicationInfo(IAppInfo appInfo) : IApplicationInfo
{
public string Version => appInfo.Version.ToString(3);

public string Build => appInfo.BuildString;

public string Commit => ThisAssembly.Git.Commit;

public string CommitDate => DateTime.Parse(ThisAssembly.Git.CommitDate, CultureInfo.InvariantCulture).ToString("dd-MMM-yyyy HH:mm:ss", CultureInfo.InvariantCulture);

public string Sha => ThisAssembly.Git.Sha;

public string RepositoryUrl => "https://github.com/wbaldoumas/baroquen-melody";

public string SupportUrl => "https://buymeacoffee.com/baroquenmelody";

public string ContributeUrl => "https://github.com/wbaldoumas/baroquen-melody/blob/main/CONTRIBUTING.md";

public string LicenseUrl => "https://github.com/wbaldoumas/baroquen-melody/blob/main/LICENSE";
}
4 changes: 4 additions & 0 deletions src/BaroquenMelody.App/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using BaroquenMelody.App.Components;
using BaroquenMelody.App.Components.Extensions;
using BaroquenMelody.App.Infrastructure.Application;
using BaroquenMelody.App.Infrastructure.Devices;
using BaroquenMelody.App.Infrastructure.FileSystem;
using BaroquenMelody.App.Infrastructure.Theme;
using BaroquenMelody.Infrastructure.Application;
using BaroquenMelody.Infrastructure.Devices;
using BaroquenMelody.Library.Midi;
using CommunityToolkit.Maui;
Expand All @@ -29,6 +31,8 @@ public static MauiApp CreateMauiApp()
builder.Services.AddSingleton<IThemeProvider, MauiThemeProvider>();
builder.Services.AddSingleton<IDeviceDirectoryProvider, MauiDeviceDirectoryProvider>();
builder.Services.AddBaroquenMelodyComponents();
builder.Services.AddSingleton(AppInfo.Current);
builder.Services.AddSingleton<IApplicationInfo, ApplicationInfo>();

#if DEBUG
builder.Services.AddBlazorWebViewDeveloperTools();
Expand Down
52 changes: 52 additions & 0 deletions src/BaroquenMelody.Infrastructure/Application/IApplicationInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace BaroquenMelody.Infrastructure.Application;

/// <summary>
/// An abstraction for providing application information.
/// </summary>
public interface IApplicationInfo
{
/// <summary>
/// The application version.
/// </summary>
public string Version { get; }

/// <summary>
/// The application build number.
/// </summary>
public string Build { get; }

/// <summary>
/// The short commit hash.
/// </summary>
public string Commit { get; }

/// <summary>
/// The commit date.
/// </summary>
public string CommitDate { get; }

/// <summary>
/// The full commit hash.
/// </summary>
public string Sha { get; }

/// <summary>
/// The repository URL.
/// </summary>
public string RepositoryUrl { get; }

/// <summary>
/// The support URL.
/// </summary>
public string SupportUrl { get; }

/// <summary>
/// The contribution URL.
/// </summary>
public string ContributeUrl { get; }

/// <summary>
/// The license URL.
/// </summary>
public string LicenseUrl { get; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public void GetPrecedingVelocities_returns_all_velocities_including_ornamentatio
{
new(new BaroquenChord([new BaroquenNote(Instrument.One, Notes.C4, MusicalTimeSpan.Half) { Velocity = new SevenBitNumber(99) }])),
new(new BaroquenChord([new BaroquenNote(Instrument.One, Notes.C4, MusicalTimeSpan.Half) { Velocity = new SevenBitNumber(9) }])),
new(new BaroquenChord([noteWithOrnamentation])),
new(new BaroquenChord([noteWithOrnamentation]))
};

var expectedVelocities = new List<SevenBitNumber>
Expand Down

0 comments on commit 4d3584a

Please sign in to comment.