@inherits LocalizableComponentBase @if (isPosting) { } @if (OnTimelineChanged.HasDelegate) { @foreach (var timelineType in Enum.GetValues()) { @Localizer[timelineType.ToString()] } } @if (OnTimeSortingChanged.HasDelegate) { @foreach (var timeSortingType in Enum.GetValues()) { @Localizer[timeSortingType.ToString()] } } @if (OnMessageSubmit.HasDelegate) { @Localizer["Post"] } else { } @code { [CascadingParameter] CascadingState CascadingState { get; set; } [Parameter] public EventCallback OnMessageSubmit { get; set; } [Parameter] public EventCallback OnTimelineChanged { get; set; } [Parameter] public EventCallback OnTimeSortingChanged { get; set; } [Inject] ILocalStorageService LocalStorage { get; set; } bool isPosting { get; set; } = false; ActionBarFilter Filters { get; set; } = new(); protected override async Task OnInitializedAsync() { var filters = await LocalStorage.GetItemAsync(nameof(ActionBarFilter)); if (filters == default) await LocalStorage.SetItemAsync(nameof(ActionBarFilter), Filters); else Filters = filters; } void OpenCloseMessageForm() { isPosting = !isPosting; } async Task OnTimelineChange(TimelineType timelineType) { Filters.TimelineType = timelineType; await LocalStorage.SetItemAsync(nameof(ActionBarFilter), Filters); await OnTimelineChanged.InvokeAsync(Filters.TimelineType); } async Task OnTimeSortChange(TimeSortingType timeSorting) { Filters.TimeSortingType = timeSorting; await LocalStorage.SetItemAsync(nameof(ActionBarFilter), Filters); await OnTimeSortingChanged.InvokeAsync(Filters.TimeSortingType); } }