Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi committed Oct 15, 2024
2 parents c2d9728 + eb2f2d9 commit 6404185
Show file tree
Hide file tree
Showing 30 changed files with 771 additions and 531 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public partial class AppInitializer : AppComponentBase
[AutoInject] private IStorageService storageService = default!;
[AutoInject] private CultureInfoManager cultureInfoManager = default!;
[AutoInject] private ILogger<AuthenticationManager> authLogger = default!;
[AutoInject] private NavigationManager navigationManager = default!;

protected async override Task OnInitAsync()
{
Expand All @@ -33,8 +34,9 @@ protected async override Task OnInitAsync()
{
if (CultureInfoManager.MultilingualEnabled)
{
cultureInfoManager.SetCurrentCulture(await storageService.GetItem("Culture") ?? // 1- User settings
CultureInfo.CurrentUICulture.Name); // 2- OS settings
cultureInfoManager.SetCurrentCulture(new Uri(navigationManager.Uri).GetCulture() ?? // 1- Culture query string OR Route data request culture
await storageService.GetItem("Culture") ?? // 2- User settings
CultureInfo.CurrentUICulture.Name); // 3- OS settings
}

await SetupBodyClasses();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,20 @@
@inherits AppComponentBase;

<section>
@*#if (sample == "Todo")*@
<a href="@Urls.HomePage">
<BitIcon IconName="@BitIconName.Home" Color="@(IsActive(Urls.HomePage) ? BitColor.Primary : BitColor.SecondaryForeground)" />
<BitText Typography="BitTypography.Caption2" Color="@(IsActive(Urls.HomePage) ? BitColor.Primary : BitColor.SecondaryForeground)">
@Localizer[nameof(AppStrings.Home)]
</BitText>
</a>

@*#if (sample == "Todo")*@
<a href="@Urls.TodoPage">
<BitIcon IconName="@BitIconName.ToDoLogoOutline" Color="@(IsActive(Urls.TodoPage) ? BitColor.Primary : BitColor.SecondaryForeground)" />
<BitText Typography="BitTypography.Caption2" Color="@(IsActive(Urls.TodoPage) ? BitColor.Primary : BitColor.SecondaryForeground)">
@Localizer[nameof(AppStrings.TodoTitle)]
</BitText>
</a>

<a href="@Urls.TermsPage">
<BitIcon IconName="@BitIconName.EntityExtraction" Color="@(IsActive(Urls.TermsPage) ? BitColor.Primary : BitColor.SecondaryForeground)" />
<BitText Typography="BitTypography.Caption2" Color="@(IsActive(Urls.TermsPage) ? BitColor.Primary : BitColor.SecondaryForeground)">
@Localizer[nameof(AppStrings.TermsTitle)]
</BitText>
</a>
@*#endif*@

@*#if (sample == "Admin")*@
Expand All @@ -47,4 +40,11 @@
</BitText>
</a>
@*#endif*@

<a href="@Urls.TermsPage">
<BitIcon IconName="@BitIconName.EntityExtraction" Color="@(IsActive(Urls.TermsPage) ? BitColor.Primary : BitColor.SecondaryForeground)" />
<BitText Typography="BitTypography.Caption2" Color="@(IsActive(Urls.TermsPage) ? BitColor.Primary : BitColor.SecondaryForeground)">
@Localizer[nameof(AppStrings.TermsTitle)]
</BitText>
</a>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private void SetCurrentDir()

private void SetCurrentUrl()
{
var path = navigationManager.GetPath();
var path = navigationManager.GetUriPath();

currentUrl = Urls.All.SingleOrDefault(pageUrl =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
@Localizer[nameof(AppStrings.BitBlazorUIMessage)]
</BitText>
<BitButton Variant="BitVariant.Outline" Href="https://youtube.com">
Watch video
@Localizer[nameof(AppStrings.WatchVideo)]
</BitButton>
<BitLink Href="https://bitplatform.dev" NoUnderline>
<BitStack Horizontal VerticalAlign="BitAlignment.Baseline" Gap="0.5rem">
Expand All @@ -65,7 +65,7 @@
@Localizer[nameof(AppStrings.BitBoilerplateMessage)]
</BitText>
<BitButton Variant="BitVariant.Outline" Href="https://youtube.com">
Watch video
@Localizer[nameof(AppStrings.WatchVideo)]
</BitButton>
<BitLink Href="https://bitplatform.dev" NoUnderline>
<BitStack Horizontal VerticalAlign="BitAlignment.Baseline" Gap="0.5rem">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,126 +4,129 @@

<PageTitle>@Localizer[nameof(AppStrings.TodoTitle)]</PageTitle>

<div class="page-container">
<div class="search-box-container">
<BitSearchBox @ref="searchBox"
Style="width: 300px"
OnChange="SearchTodoItems"
Immediate DebounceTime="300"
OnClear="@(() => SearchTodoItems(""))"
Placeholder="@Localizer[nameof(AppStrings.TodoSearchPlaceholder)]" />
</div>

<div class="todo-content">
<h1 class="main-title">@Localizer[nameof(AppStrings.TodoTitle)]</h1>
<div class="add-todo-container">
<BitTextField @bind-Value="newTodoTitle"
Class="add-todo-input"
<section>
<BitStack Class="todo-stack">
<br />
<BitStack Horizontal>
<BitTextField @ref="newTodoInput"
Style="flex-grow:1"
@bind-Value="newTodoTitle"
Immediate DebounceTime="300"
Placeholder="@Localizer[nameof(AppStrings.TodoAddPlaceholder)]" />
Placeholder="@Localizer[nameof(AppStrings.TodoAddPlaceholder)]"
OnKeyDown="WrapHandled(async (KeyboardEventArgs args) => await OnInputKeyDown(args))" />

<BitButton AutoLoading
OnClick="WrapHandled(AddTodoItem)"
Title="@Localizer[nameof(AppStrings.Add)]"
IsEnabled="(string.IsNullOrWhiteSpace(newTodoTitle) is false)">
@Localizer[nameof(AppStrings.Add)]
</BitButton>
</div>

<div class="todo-list-container">
<div class="filter-container">
<BitPivot SelectedKey="@selectedFilter" SelectedKeyChanged="FilterTodoItems">
</BitStack>
<br />
<BitStack Gap="0.25rem">
<BitStack Horizontal VerticalAlign="BitAlignment.End" Gap="0.25rem" Class="todo-header">
<BitPivot SelectedKey="@selectedFilter" SelectedKeyChanged="FilterTodoItems" HeaderOnly>
<BitPivotItem Key="@nameof(AppStrings.All)" Class="todo-pivot-tab" HeaderText="@Localizer[nameof(AppStrings.All)]" />
<BitPivotItem Key="@nameof(AppStrings.Active)" Class="todo-pivot-tab" HeaderText="@Localizer[nameof(AppStrings.Active)]" />
<BitPivotItem Key="@nameof(AppStrings.Completed)" Class="todo-pivot-tab" HeaderText="@Localizer[nameof(AppStrings.Completed)]" />
</BitPivot>
<div class="sort-drp-container">
<BitDropdown IsResponsive
Class="sort-todo-drp"
<BitSpacer />
<BitSearchBox @ref="searchBox"
Class="todo-search"
OnChange="SearchTodoItems"
Immediate DebounceTime="300"
OnClear="@(() => SearchTodoItems(""))"
Placeholder="@Localizer[nameof(AppStrings.TodoSearchPlaceholder)]"
Styles="@(new() { InputContainer="border:none;background-color:var(--bit-clr-bg-sec)" })" />
<BitStack Class="todo-sort" Gap="2px" Horizontal AutoSize>
<BitDropdown IsResponsive NoBorder FitWidth
DefaultValue="nameof(AppStrings.Alphabetical)"
TItem="BitDropdownOption<string>" TValue="string"
OnSelectItem="(BitDropdownOption<string> item) => SortTodoItems(item.Value)">
OnSelectItem="(BitDropdownOption<string> item) => SortTodoItems(item.Value)"
Styles="@(new() { Container="height:32px;background-color:var(--bit-clr-bg-sec)" })">
<Options>
<BitDropdownOption Text="@Localizer[nameof(AppStrings.Alphabetical)]" Value="nameof(AppStrings.Alphabetical)" />
<BitDropdownOption Text="@Localizer[nameof(AppStrings.Date)]" Value="nameof(AppStrings.Date)" />
</Options>
<CaretDownTemplate>
<BitIcon IconName="@BitIconName.Sort" Class="sort-todo-icn" />
<BitIcon IconName="@BitIconName.Breadcrumb" />
</CaretDownTemplate>
</BitDropdown>
</div>
</div>
<BitButton IconOnly Color="BitColor.SecondaryBackground" Style="height:32px;"
OnClick="() => { isDescendingSort = !isDescendingSort; FilterViewTodoItems(); }"
IconName="@(isDescendingSort ? BitIconName.SortDown : BitIconName.SortUp)" />
</BitStack>
</BitStack>

<div class="todo-list">
@if (isLoading)
{
<div class="todo-list-spinner">
<BitRingLoading />
</div>
}
else
{
if (viewTodoItems?.Any() is false or null)
{
<div class="todo-list--empty-state">
<img src="/_content/Boilerplate.Client.Core/images/backgrounds/empty-todo-list-bg.svg">
@if (isLoading)
{
<BitStack Alignment="BitAlignment.Center">
<BitRingLoading />
</BitStack>
}
else
{
<BitBasicList Items="viewTodoItems" EnableVirtualization
Class="todo-list">
<EmptyContent>
<BitStack Alignment="BitAlignment.Center" Style="padding:1rem;">
<BitImage Src="/_content/Boilerplate.Client.Core/images/backgrounds/empty-todo-list-bg.svg" />
<BitLabel>@Localizer[nameof(AppStrings.NoTodos)]</BitLabel>
</div>
}
else
{
<BitBasicList Style="width: 100%; height: inherit"
Items="viewTodoItems"
EnableVirtualization="true">
<RowTemplate Context="todo">
<div class="todo-item@(todo.IsInEditMode ? " edit-mode" : "")" role="listitem" @key=@todo.Id>
@if (todo.IsInEditMode)
{
<BitTextField Class="todo-input" @bind-Value="underEditTodoItemTitle" />
<div class="edit-btn-group">
<BitButton Title="@Localizer[nameof(AppStrings.Edit)]" OnClick="WrapHandled(() => SaveTodoItem(todo))">
@Localizer[nameof(AppStrings.Save)]
</BitButton>
<BitButton Variant="BitVariant.Outline"
Class="todo-button"
Title="@Localizer[nameof(AppStrings.Cancel)]"
OnClick="WrapHandled(() => ToggleEditMode(todo))">
@Localizer[nameof(AppStrings.Cancel)]
</BitButton>
</div>
}
else
{
<div class="todo-info@(todo.IsDone ? " done" : "")">
<BitCheckbox Label="@todo.Title"
DefaultValue="todo.IsDone"
OnChange="() => ToggleIsDone(todo)" />
</BitStack>
</EmptyContent>
<RowTemplate Context="todo">
<BitStack Alignment="BitAlignment.Center" Style="padding:1rem 1rem 0" AutoHeight>
<BitStack Horizontal @key=@todo.Id VerticalAlign="BitAlignment.Center">
@if (todo.IsInEditMode is false)
{
<BitStack Grows Gap="0">
<BitCheckbox Label="@todo.Title"
Styles="@(new() { Label = todo.IsDone ? "text-decoration:line-through" : "" })"
DefaultValue="todo.IsDone"
OnChange="() => ToggleIsDone(todo)" />
<BitText Typography="BitTypography.Body2">@todo.Date.ToLocalTime().ToString("yyyy MMMM dd, HH:mm:ss")</BitText>
</BitStack>

<div Class="todo-item-date">
@todo.Date.ToLocalTime().ToString("yyyy MMMM dd, HH:mm:ss")
</div>
</div>
<BitStack Horizontal AutoWidth Gap="0.5rem">
<BitButton Variant="BitVariant.Text"
IconName="@BitIconName.Edit"
Color="BitColor.SecondaryForeground"
Title="@Localizer[nameof(AppStrings.Edit)]"
OnClick="WrapHandled(() => ToggleEditMode(todo))" />

<div class="todo-btn-group">
<BitButton IconName="@BitIconName.Edit"
Variant="BitVariant.Text"
Title="@Localizer[nameof(AppStrings.Edit)]"
OnClick="WrapHandled(() => ToggleEditMode(todo))" />
<BitButton Color="BitColor.Error"
Variant="BitVariant.Text"
IconName="@BitIconName.Delete"
Title="@Localizer[nameof(AppStrings.Remove)]"
OnClick="WrapHandled(() => { isDeleteDialogOpen = true; deletingTodoItem = todo; })" />
</BitStack>
}
else
{
<BitTextField Style="flex-grow:1" @bind-Value="underEditTodoItemTitle" />

<BitButton Color="BitColor.Error"
Variant="BitVariant.Text"
IconName="@BitIconName.Delete"
Title="@Localizer[nameof(AppStrings.Remove)]"
OnClick="WrapHandled(() => DeleteTodoItem(todo))" />
</div>
}
</div>
</RowTemplate>
</BitBasicList>
}
}
</div>
</div>
</div>
</div>
<BitButton Color="BitColor.TertiaryBackground"
Title="@Localizer[nameof(AppStrings.Cancel)]"
OnClick="WrapHandled(() => ToggleEditMode(todo))">
@Localizer[nameof(AppStrings.Cancel)]
</BitButton>
<BitButton Title="@Localizer[nameof(AppStrings.Edit)]" OnClick="WrapHandled(() => SaveTodoItem(todo))">
@Localizer[nameof(AppStrings.Save)]
</BitButton>
}
</BitStack>
<BitSeparator Border="BitColorKind.Tertiary" />
</BitStack>
</RowTemplate>
</BitBasicList>
}
</BitStack>
</BitStack>
</section>

<ConfirmMessageBox @ref=confirmMessageBox />
<BitDialog OnOk="DeleteTodoItem"
@bind-IsOpen="isDeleteDialogOpen"
OkText="@Localizer[nameof(AppStrings.Yes)]"
CancelText="@Localizer[nameof(AppStrings.No)]"
Title="@Localizer[nameof(AppStrings.DeleteTodoItem)]"
Message="@Localizer.GetString(nameof(AppStrings.AreYouSureWannaDelete), deletingTodoItem?.Title ?? "")" />
Loading

0 comments on commit 6404185

Please sign in to comment.