Skip to content
Open
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
9 changes: 9 additions & 0 deletions StabilityMatrix.Avalonia/Languages/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions StabilityMatrix.Avalonia/Languages/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,9 @@
<data name="Label_ModelDescription" xml:space="preserve">
<value>Model Description</value>
</data>
<data name="Label_ModelVersionDescription" xml:space="preserve">
<value>About this version</value>
</data>
<data name="Label_NewVersionAvailable" xml:space="preserve">
<value>A new version of Stability Matrix is available!</value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public partial class ModelVersionViewModel : ObservableObject
{
private readonly IModelIndexService modelIndexService;

public string VersionDescription { get; set; }

public bool HasVersionDescription { get; set; }

[ObservableProperty]
private CivitModelVersion modelVersion;

Expand All @@ -27,25 +31,27 @@ public ModelVersionViewModel(IModelIndexService modelIndexService, CivitModelVer
ModelVersion = modelVersion;

IsInstalled =
ModelVersion.Files?.Any(
file =>
file is { Type: CivitFileType.Model, Hashes.BLAKE3: not null }
&& modelIndexService.ModelIndexBlake3Hashes.Contains(file.Hashes.BLAKE3)
ModelVersion.Files?.Any(file =>
file is { Type: CivitFileType.Model, Hashes.BLAKE3: not null }
&& modelIndexService.ModelIndexBlake3Hashes.Contains(file.Hashes.BLAKE3)
) ?? false;

CivitFileViewModels = new ObservableCollection<CivitFileViewModel>(
ModelVersion.Files?.Select(file => new CivitFileViewModel(modelIndexService, file))
?? new List<CivitFileViewModel>()
);

HasVersionDescription = !string.IsNullOrWhiteSpace(modelVersion.Description);
VersionDescription =
$"""<html><body class="markdown-body">{modelVersion.Description}</body></html>""";
}

public void RefreshInstallStatus()
{
IsInstalled =
ModelVersion.Files?.Any(
file =>
file is { Type: CivitFileType.Model, Hashes.BLAKE3: not null }
&& modelIndexService.ModelIndexBlake3Hashes.Contains(file.Hashes.BLAKE3)
ModelVersion.Files?.Any(file =>
file is { Type: CivitFileType.Model, Hashes.BLAKE3: not null }
&& modelIndexService.ModelIndexBlake3Hashes.Contains(file.Hashes.BLAKE3)
) ?? false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
MinHeight="450"
Margin="8"
ColumnDefinitions="*,Auto,*"
RowDefinitions="Auto, Auto, *, Auto">
RowDefinitions="Auto, Auto, *, Auto, Auto">

<Grid.Resources>
<input:StandardUICommand x:Key="ImportCommand" Command="{Binding Import}" />
Expand Down Expand Up @@ -287,10 +287,23 @@
</ScrollViewer>
</Expander>

<StackPanel
<Expander
Grid.Row="3"
Grid.Column="0"
Grid.ColumnSpan="3"
Margin="8,8"
ExpandDirection="Down"
Header="{x:Static lang:Resources.Label_ModelVersionDescription}"
IsVisible="{Binding SelectedVersionViewModel.HasVersionDescription}">
<ScrollViewer MaxHeight="300">
<controls:MarkdownViewer Html="{Binding SelectedVersionViewModel.VersionDescription}" />
</ScrollViewer>
</Expander>

<StackPanel
Grid.Row="4"
Grid.Column="0"
Grid.ColumnSpan="3"
Margin="0,8,0,0"
HorizontalAlignment="Center"
Orientation="Horizontal">
Expand Down