Skip to content

Commit

Permalink
Work in progress on UI
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusz-kierepka-hl committed Oct 8, 2024
1 parent a26ef63 commit 43364ab
Show file tree
Hide file tree
Showing 11 changed files with 886 additions and 689 deletions.
1 change: 0 additions & 1 deletion ChatAAC/Converters/StringToBitmapConverter.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using Avalonia;
using Avalonia.Data.Converters;
using Avalonia.Media.Imaging;
using System;
Expand Down
12 changes: 3 additions & 9 deletions ChatAAC/Models/AiResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@

namespace ChatAAC.Models;

public class AiResponse
public class AiResponse(string responseText)
{
public string ResponseText { get; set; }
public DateTime Timestamp { get; set; }

public AiResponse(string responseText)
{
ResponseText = responseText;
Timestamp = DateTime.Now;
}
public string ResponseText { get; set; } = responseText;
public DateTime Timestamp { get; set; } = DateTime.Now;
}
31 changes: 2 additions & 29 deletions ChatAAC/Models/Obf/Button.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class Button
{
[JsonPropertyName("id")]
[JsonConverter(typeof(IntFromStringConverter))]
public int Id { get; set; }
public int? Id { get; set; }

[JsonPropertyName("label")] public string Label { get; set; } = string.Empty;

Expand All @@ -20,36 +20,9 @@ public class Button

[JsonPropertyName("vocalization")] public string Vocalization { get; set; } = string.Empty;

[JsonPropertyName("load_board")] public LoadBoard? LoadBoard { get; set; }
[JsonPropertyName("load_board")] public LoadBoard? LoadBoard { get; set; }

[JsonPropertyName("action")] public string Action { get; set; } = string.Empty;

[JsonIgnore] public Image? Image { get; set; }

private const int ImageWidth = 260;
private const int ImageHeight = 290;

[JsonIgnore]
public int Width
{
get
{
var width = Image?.Width + 10;
if (width <= 10) width = ImageWidth;
if (width > ImageWidth) width = ImageWidth;
return width ?? ImageWidth;
}
}

[JsonIgnore]
public int Height
{
get
{
var height = Image?.Height + 30;
if (height <= 30) height = ImageHeight;
if (height > ImageHeight) height = ImageHeight;
return height ?? ImageHeight;
}
}
}
2 changes: 1 addition & 1 deletion ChatAAC/Models/Obf/ObfFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class ObfFile

[JsonPropertyName("description_html")] public string DescriptionHtml { get; set; } = string.Empty;

[JsonPropertyName("grid")] public Grid Grid { get; set; } = new();
[JsonPropertyName("grid")] public Grid? Grid { get; set; }
[JsonPropertyName("buttons")] public List<Button> Buttons { get; set; } = new();
[JsonPropertyName("images")] public List<Image> Images { get; set; } = new();

Expand Down
Loading

0 comments on commit 43364ab

Please sign in to comment.