2022-12-15 20:03:40 +01:00
|
|
|
@inherits LocalizableComponentBase
|
|
|
|
|
|
2026-10-03 12:08:11 +02:00
|
|
|
<section class="flex flex-col gap-4">
|
2022-02-14 01:51:52 +01:00
|
|
|
|
|
|
|
|
@if (isPosting)
|
|
|
|
|
{
|
2026-10-03 12:08:11 +02:00
|
|
|
<div class="block p-3 md:p-4 rounded-xl neo-raised neo-xs">
|
2022-02-14 01:51:52 +01:00
|
|
|
<MessageUpsertForm OnMessageSubmit="OnMessageSubmit" />
|
|
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-03 12:08:11 +02:00
|
|
|
<div class="flex justify-between gap-3">
|
2022-02-14 01:51:52 +01:00
|
|
|
|
|
|
|
|
<EditForm Model="Filters">
|
2026-10-03 12:08:11 +02:00
|
|
|
<div class="flex flex-row gap-3">
|
2022-02-14 01:51:52 +01:00
|
|
|
@if (OnTimelineChanged.HasDelegate)
|
|
|
|
|
{
|
2026-10-03 12:08:11 +02:00
|
|
|
<DSelect TValue="TimelineType" class="w-auto" Value="Filters.TimelineType"
|
|
|
|
|
ValueChanged="async v => await OnTimelineChange(v)" ValueExpression="() => Filters.TimelineType">
|
|
|
|
|
<Prefix>
|
2022-02-14 01:51:52 +01:00
|
|
|
<i class="@Filters.TimelineType.GetTimelineTypeIcon()"></i>
|
2026-10-03 12:08:11 +02:00
|
|
|
</Prefix>
|
|
|
|
|
<ChildContent>
|
|
|
|
|
@foreach (var timelineType in Enum.GetValues<TimelineType>())
|
|
|
|
|
{
|
|
|
|
|
<option value="@timelineType">@Localizer[timelineType.ToString()]</option>
|
|
|
|
|
}
|
|
|
|
|
</ChildContent>
|
|
|
|
|
</DSelect>
|
2022-02-14 01:51:52 +01:00
|
|
|
}
|
|
|
|
|
@if (OnTimeSortingChanged.HasDelegate)
|
|
|
|
|
{
|
2026-10-03 12:08:11 +02:00
|
|
|
<DSelect TValue="TimeSortingType" class="w-auto" Value="Filters.TimeSortingType"
|
|
|
|
|
ValueChanged="async v => await OnTimeSortChange(v)" ValueExpression="() => Filters.TimeSortingType">
|
|
|
|
|
<Prefix>
|
2022-02-14 01:51:52 +01:00
|
|
|
<i class="ion-md-funnel"></i>
|
2026-10-03 12:08:11 +02:00
|
|
|
</Prefix>
|
|
|
|
|
<ChildContent>
|
|
|
|
|
@foreach (var timeSortingType in Enum.GetValues<TimeSortingType>())
|
|
|
|
|
{
|
|
|
|
|
<option value="@timeSortingType">@Localizer[timeSortingType.ToString()]</option>
|
|
|
|
|
}
|
|
|
|
|
</ChildContent>
|
|
|
|
|
</DSelect>
|
2022-02-14 01:51:52 +01:00
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</EditForm>
|
|
|
|
|
|
|
|
|
|
@if (OnMessageSubmit.HasDelegate)
|
|
|
|
|
{
|
|
|
|
|
<div>
|
2026-10-03 12:08:11 +02:00
|
|
|
<DButton Active="isPosting" OnClick="OpenCloseMessageForm">
|
|
|
|
|
<i class="ion-md-create"></i>
|
2022-12-15 20:03:40 +01:00
|
|
|
<span>@Localizer["Post"]</span>
|
2026-10-03 12:08:11 +02:00
|
|
|
</DButton>
|
2022-02-14 01:51:52 +01:00
|
|
|
</div>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<div></div>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</section>
|
2022-02-14 01:51:37 +01:00
|
|
|
|
|
|
|
|
@code {
|
2022-02-14 01:51:52 +01:00
|
|
|
[Parameter] public EventCallback<MessageForm> OnMessageSubmit { get; set; }
|
|
|
|
|
[Parameter] public EventCallback<TimelineType> OnTimelineChanged { get; set; }
|
|
|
|
|
[Parameter] public EventCallback<TimeSortingType> OnTimeSortingChanged { get; set; }
|
|
|
|
|
[Inject] ILocalStorageService LocalStorage { get; set; }
|
2026-10-03 15:26:21 +02:00
|
|
|
bool isPosting;
|
2022-02-14 01:51:52 +01:00
|
|
|
ActionBarFilter Filters { get; set; } = new();
|
|
|
|
|
|
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
|
{
|
|
|
|
|
var filters = await LocalStorage.GetItemAsync<ActionBarFilter>(nameof(ActionBarFilter));
|
2026-10-03 15:26:21 +02:00
|
|
|
IsLoading = false;
|
|
|
|
|
if (filters is not null)
|
|
|
|
|
{
|
2022-02-14 01:51:52 +01:00
|
|
|
Filters = filters;
|
2026-10-03 15:26:21 +02:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await LocalStorage.SetItemAsync(nameof(ActionBarFilter), Filters);
|
2022-02-14 01:51:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OpenCloseMessageForm()
|
|
|
|
|
{
|
|
|
|
|
isPosting = !isPosting;
|
|
|
|
|
}
|
2026-10-03 15:26:21 +02:00
|
|
|
|
2022-02-14 01:51:52 +01:00
|
|
|
async Task OnTimelineChange(TimelineType timelineType)
|
|
|
|
|
{
|
|
|
|
|
Filters.TimelineType = timelineType;
|
|
|
|
|
await LocalStorage.SetItemAsync(nameof(ActionBarFilter), Filters);
|
|
|
|
|
await OnTimelineChanged.InvokeAsync(Filters.TimelineType);
|
|
|
|
|
}
|
2026-10-03 15:26:21 +02:00
|
|
|
|
2022-02-14 01:51:52 +01:00
|
|
|
async Task OnTimeSortChange(TimeSortingType timeSorting)
|
|
|
|
|
{
|
|
|
|
|
Filters.TimeSortingType = timeSorting;
|
|
|
|
|
await LocalStorage.SetItemAsync(nameof(ActionBarFilter), Filters);
|
|
|
|
|
await OnTimeSortingChanged.InvokeAsync(Filters.TimeSortingType);
|
|
|
|
|
}
|
2022-02-14 01:51:37 +01:00
|
|
|
}
|