mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-17 02:31:28 -07:00
Add monthly supporter credits
This commit is contained in:
parent
3d4ba04e8a
commit
8d68576720
13
Bloxstrap/Models/Supporter.cs
Normal file
13
Bloxstrap/Models/Supporter.cs
Normal file
@ -0,0 +1,13 @@
|
||||
namespace Bloxstrap.Models
|
||||
{
|
||||
public class Supporter
|
||||
{
|
||||
[JsonPropertyName("imageAsset")]
|
||||
public string ImageAsset { get; set; } = null!;
|
||||
|
||||
[JsonPropertyName("name")]
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
public string Image => $"https://raw.githubusercontent.com/bloxstraplabs/config/main/assets/{ImageAsset}";
|
||||
}
|
||||
}
|
11
Bloxstrap/Models/SupporterData.cs
Normal file
11
Bloxstrap/Models/SupporterData.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Bloxstrap.Models
|
||||
{
|
||||
public class SupporterData
|
||||
{
|
||||
[JsonPropertyName("columns")]
|
||||
public int Columns { get; set; }
|
||||
|
||||
[JsonPropertyName("supporters")]
|
||||
public List<Supporter> Supporters { get; set; } = null!;
|
||||
}
|
||||
}
|
36
Bloxstrap/Resources/Strings.Designer.cs
generated
36
Bloxstrap/Resources/Strings.Designer.cs
generated
@ -69,6 +69,24 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to These are the people currently supporting Bloxstrap through [Ko-fi]({0}). A massive thank you to everyone here!.
|
||||
/// </summary>
|
||||
public static string About_Supporters_Description {
|
||||
get {
|
||||
return ResourceManager.GetString("About.Supporters.Description", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Supporters.
|
||||
/// </summary>
|
||||
public static string About_Supporters_Title {
|
||||
get {
|
||||
return ResourceManager.GetString("About.Supporters.Title", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to About Bloxstrap.
|
||||
/// </summary>
|
||||
@ -449,6 +467,15 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Loading, please wait....
|
||||
/// </summary>
|
||||
public static string Common_Loading {
|
||||
get {
|
||||
return ResourceManager.GetString("Common.Loading", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Miscellaneous.
|
||||
/// </summary>
|
||||
@ -485,6 +512,15 @@ namespace Bloxstrap.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Could not load data because of a network error..
|
||||
/// </summary>
|
||||
public static string Common_NetworkError {
|
||||
get {
|
||||
return ResourceManager.GetString("Common.NetworkError", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to New.
|
||||
/// </summary>
|
||||
|
@ -1150,4 +1150,16 @@ Are you sure you want to continue?</value>
|
||||
<data name="Dialog.PlayerError.HelpInformation" xml:space="preserve">
|
||||
<value>Please read the following help information, which will open in your web browser when you close this dialog.</value>
|
||||
</data>
|
||||
<data name="Common.NetworkError" xml:space="preserve">
|
||||
<value>Could not load data because of a network error.</value>
|
||||
</data>
|
||||
<data name="Common.Loading" xml:space="preserve">
|
||||
<value>Loading, please wait...</value>
|
||||
</data>
|
||||
<data name="About.Supporters.Title" xml:space="preserve">
|
||||
<value>Supporters</value>
|
||||
</data>
|
||||
<data name="About.Supporters.Description" xml:space="preserve">
|
||||
<value>These are the people currently supporting Bloxstrap through [Ko-fi]({0}). A massive thank you to everyone here!</value>
|
||||
</data>
|
||||
</root>
|
@ -3,7 +3,9 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:enums="clr-namespace:Bloxstrap.Enums"
|
||||
xmlns:models="clr-namespace:Bloxstrap.UI.ViewModels"
|
||||
xmlns:dmodels="clr-namespace:Bloxstrap.UI.ViewModels.About"
|
||||
xmlns:controls="clr-namespace:Bloxstrap.UI.Elements.Controls"
|
||||
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
|
||||
xmlns:resources="clr-namespace:Bloxstrap.Resources"
|
||||
@ -11,7 +13,13 @@
|
||||
d:DesignHeight="1500" d:DesignWidth="800"
|
||||
Title="AboutPage"
|
||||
Scrollable="True">
|
||||
<!--d:DataContext="{d:DesignInstance dmodels:AboutViewModel, IsDesignTimeCreatable=True}"-->
|
||||
|
||||
<StackPanel Margin="0,0,14,14">
|
||||
<StackPanel.Resources>
|
||||
<FrameworkElement x:Key="ProxyElement" DataContext="{Binding}"/>
|
||||
</StackPanel.Resources>
|
||||
|
||||
<Grid Margin="0,0,0,24" HorizontalAlignment="Center">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@ -73,6 +81,85 @@
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Text="{x:Static resources:Strings.About_Supporters_Title}" FontWeight="Medium" FontSize="20" Margin="0,16,0,0" />
|
||||
<controls:MarkdownTextBlock MarkdownText="{Binding Source={x:Static resources:Strings.About_Supporters_Description}, Converter={StaticResource StringFormatConverter}, ConverterParameter='https://ko-fi.com/boxerpizza'}" TextWrapping="Wrap" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
<Grid Margin="0,8,0,0">
|
||||
<Grid.Style>
|
||||
<Style TargetType="Grid">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding SupportersLoadedState, Mode=OneWay}" Value="{x:Static enums:GenericTriState.Unknown}">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</Style>
|
||||
</Grid.Style>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:ProgressRing Grid.Column="0" IsIndeterminate="True" />
|
||||
<TextBlock Grid.Column="1" Margin="16,0,0,0" Text="{x:Static resources:Strings.Common_Loading}" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
<Grid Margin="0,8,0,0">
|
||||
<Grid.Style>
|
||||
<Style TargetType="Grid">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding SupportersLoadedState, Mode=OneWay}" Value="{x:Static enums:GenericTriState.Failed}">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</Style>
|
||||
</Grid.Style>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image Source="pack://application:,,,/Resources/MessageBox/Error.png" Width="60" Height="60" RenderOptions.BitmapScalingMode="HighQuality" />
|
||||
<StackPanel Grid.Column="1" Margin="16,0,0,0" VerticalAlignment="Center">
|
||||
<TextBlock Text="{x:Static resources:Strings.Common_NetworkError}" />
|
||||
<TextBlock Text="{Binding SupportersLoadError, Mode=OneWay}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<ListView ItemsSource="{Binding Supporters, Mode=OneWay}" Margin="0,8,0,0" ScrollViewer.CanContentScroll="False">
|
||||
<ListView.Style>
|
||||
<Style TargetType="ListView" BasedOn="{StaticResource {x:Type ListView}}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding SupportersLoadedState, Mode=OneWay}" Value="{x:Static enums:GenericTriState.Successful}">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</Style>
|
||||
</ListView.Style>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ui:Card Padding="8">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Ellipse Grid.Column="0" Height="32" Width="32" VerticalAlignment="Center">
|
||||
<Ellipse.Fill>
|
||||
<ImageBrush ImageSource="{Binding Image, IsAsync=True}" />
|
||||
</Ellipse.Fill>
|
||||
</Ellipse>
|
||||
|
||||
<TextBlock Grid.Column="1" Margin="8,0,2,0" VerticalAlignment="Center" Text="{Binding Name}" />
|
||||
</Grid>
|
||||
</ui:Card>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
<ListView.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<UniformGrid Columns="{Binding SupporterColumns}" Margin="-4" />
|
||||
</ItemsPanelTemplate>
|
||||
</ListView.ItemsPanel>
|
||||
</ListView>
|
||||
|
||||
<TextBlock Text="{x:Static resources:Strings.Menu_About_Contributors}" FontWeight="Medium" FontSize="20" Margin="0,16,0,0" />
|
||||
<TextBlock Text="{x:Static resources:Strings.Menu_About_Contributors_Description}" TextWrapping="Wrap" Foreground="{DynamicResource TextFillColorTertiaryBrush}" />
|
||||
<Grid Margin="0,8,0,0">
|
||||
|
@ -1,4 +1,4 @@
|
||||
using Bloxstrap.UI.ViewModels.Settings;
|
||||
using Bloxstrap.UI.ViewModels.About;
|
||||
|
||||
namespace Bloxstrap.UI.Elements.About.Pages
|
||||
{
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
<StackPanel Grid.Row="1" HorizontalAlignment="Center">
|
||||
<ui:Hyperlink Icon="QuestionCircle48" Content="About Bloxstrap" Margin="0,0,0,8" Command="{Binding LaunchAboutCommand, Mode=OneTime}" />
|
||||
<ui:Hyperlink Icon="WindowNew16" Content="Support us on Ko-fi!" NavigateUri="https://ko-fi.com/boxerpizza" />
|
||||
<ui:Hyperlink Icon="Heart48" Content="Support us on Ko-fi!" NavigateUri="https://ko-fi.com/boxerpizza" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
63
Bloxstrap/UI/ViewModels/About/AboutViewModel.cs
Normal file
63
Bloxstrap/UI/ViewModels/About/AboutViewModel.cs
Normal file
@ -0,0 +1,63 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace Bloxstrap.UI.ViewModels.About
|
||||
{
|
||||
public class AboutViewModel : NotifyPropertyChangedViewModel
|
||||
{
|
||||
private SupporterData? _supporterData;
|
||||
|
||||
public string Version => string.Format(Strings.Menu_About_Version, App.Version);
|
||||
|
||||
public BuildMetadataAttribute BuildMetadata => App.BuildMetadata;
|
||||
|
||||
public string BuildTimestamp => BuildMetadata.Timestamp.ToFriendlyString();
|
||||
public string BuildCommitHashUrl => $"https://github.com/{App.ProjectRepository}/commit/{BuildMetadata.CommitHash}";
|
||||
|
||||
public Visibility BuildInformationVisibility => App.IsProductionBuild ? Visibility.Collapsed : Visibility.Visible;
|
||||
public Visibility BuildCommitVisibility => App.IsActionBuild ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
public List<Supporter> Supporters => _supporterData?.Supporters ?? Enumerable.Empty<Supporter>().ToList();
|
||||
|
||||
public int SupporterColumns => _supporterData?.Columns ?? 0;
|
||||
|
||||
public GenericTriState SupportersLoadedState { get; set; } = GenericTriState.Unknown;
|
||||
|
||||
public string SupportersLoadError { get; set; } = "";
|
||||
|
||||
public AboutViewModel()
|
||||
{
|
||||
// this will cause momentary freezes only when ran under the debugger
|
||||
LoadSupporterData();
|
||||
}
|
||||
|
||||
public async void LoadSupporterData()
|
||||
{
|
||||
const string LOG_IDENT = "AboutViewModel::LoadSupporterData";
|
||||
|
||||
try
|
||||
{
|
||||
_supporterData = await Http.GetJson<SupporterData>("https://raw.githubusercontent.com/bloxstraplabs/config/main/supporters.json");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
App.Logger.WriteLine(LOG_IDENT, "Could not load supporter data");
|
||||
App.Logger.WriteException(LOG_IDENT, ex);
|
||||
|
||||
SupportersLoadedState = GenericTriState.Failed;
|
||||
SupportersLoadError = ex.Message;
|
||||
|
||||
OnPropertyChanged(nameof(SupportersLoadError));
|
||||
}
|
||||
|
||||
if (_supporterData is not null)
|
||||
{
|
||||
SupportersLoadedState = GenericTriState.Successful;
|
||||
|
||||
OnPropertyChanged(nameof(Supporters));
|
||||
OnPropertyChanged(nameof(SupporterColumns));
|
||||
}
|
||||
|
||||
OnPropertyChanged(nameof(SupportersLoadedState));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace Bloxstrap.UI.ViewModels.Settings
|
||||
{
|
||||
public class AboutViewModel
|
||||
{
|
||||
public string Version => string.Format(Strings.Menu_About_Version, App.Version);
|
||||
|
||||
public BuildMetadataAttribute BuildMetadata => App.BuildMetadata;
|
||||
|
||||
public string BuildTimestamp => BuildMetadata.Timestamp.ToFriendlyString();
|
||||
public string BuildCommitHashUrl => $"https://github.com/{App.ProjectRepository}/commit/{BuildMetadata.CommitHash}";
|
||||
|
||||
public Visibility BuildInformationVisibility => App.IsProductionBuild ? Visibility.Collapsed : Visibility.Visible;
|
||||
public Visibility BuildCommitVisibility => App.IsActionBuild ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user