* fix validation in new form layout * pin mediatr to last oss version * update dependencies * cleanup code in core * cleanup code in ffmpeg * cleanup code in infra * cleanup code in scanner * cleanup code in application * cleanup main code * cleanup test code * solution-wide code cleanup
54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using ErsatzTV.Application.Scheduling;
|
|
using MudBlazor;
|
|
|
|
namespace ErsatzTV.ViewModels;
|
|
|
|
public class BlockTreeItemViewModel
|
|
{
|
|
public BlockTreeItemViewModel(BlockGroupViewModel blockGroup)
|
|
{
|
|
Text = blockGroup.Name;
|
|
EndText = string.Empty;
|
|
TreeItems = [];
|
|
CanExpand = blockGroup.BlockCount > 0;
|
|
BlockGroupId = blockGroup.Id;
|
|
Icon = Icons.Material.Filled.Folder;
|
|
}
|
|
|
|
public BlockTreeItemViewModel(BlockViewModel block)
|
|
{
|
|
Text = block.Name;
|
|
if (block.Minutes / 60 >= 1)
|
|
{
|
|
string plural = block.Minutes / 60 >= 2 ? "s" : string.Empty;
|
|
EndText = $"{block.Minutes / 60} hour{plural}";
|
|
if (block.Minutes % 60 != 0)
|
|
{
|
|
EndText += $", {block.Minutes % 60} minutes";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
EndText = $"{block.Minutes} minutes";
|
|
}
|
|
|
|
TreeItems = [];
|
|
CanExpand = false;
|
|
BlockId = block.Id;
|
|
}
|
|
|
|
public string Text { get; }
|
|
|
|
public string EndText { get; }
|
|
|
|
public string Icon { get; }
|
|
|
|
public bool CanExpand { get; }
|
|
|
|
public int? BlockId { get; }
|
|
|
|
public int? BlockGroupId { get; }
|
|
|
|
public List<TreeItemData<BlockTreeItemViewModel>> TreeItems { get; }
|
|
}
|