Skip to content

Commit

Permalink
feat: update to bit 9.2.1 #63 (#64)
Browse files Browse the repository at this point in the history
  • Loading branch information
ysmoradi authored Jan 5, 2025
1 parent ae58e3e commit 26aa642
Show file tree
Hide file tree
Showing 161 changed files with 1,029 additions and 1,185 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
}
},
"forwardPorts": [
4269,
4144,
5000,
5291
5103
],
"features": {
"ghcr.io/devcontainers/features/node": {},
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://bitplatform.dev/templates/dev-ops

env:
SERVER_ADDRESS: 'https://use-your-server-url-here.com/'
SERVER_ADDRESS: 'https://use-your-api-server-url-here.com/'
APP_SERVICE_NAME: 'app-service-bp-test'
IOS_CODE_SIGN_PROVISION: 'Bit.TemplatePlayground'

Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
files: 'src\Shared\appsettings.json, src\Client\Bit.TemplatePlayground.Client.Core\appsettings.json, src\Client\Bit.TemplatePlayground.Client.Windows\appsettings.json'
env:
ServerAddress: ${{ env.SERVER_ADDRESS }}
WindowsUpdate.FilesUrl: 'https://use-your-server-url-here.com/windows' # Deploy the published Windows application files to your desired hosting location and use the host url here.
WindowsUpdate.FilesUrl: 'https://use-your-api-server-url-here.com/windows' # Deploy the published Windows application files to your desired hosting location and use the host url here.

- name: Generate CSS/JS files
run: dotnet build src\Client\Bit.TemplatePlayground.Client.Core\Bit.TemplatePlayground.Client.Core.csproj -t:BeforeBuildTasks --no-restore -c Release
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,6 @@ private void HandleException(Exception exp,
}
parameters["ComponentType"] = GetType().FullName;

ExceptionHandler.Handle(exp, nonInterrupting: false, parameters, lineNumber, memberName, filePath);
ExceptionHandler.Handle(exp, displayKind: ExceptionDisplayKind.Interrupting, parameters, lineNumber, memberName, filePath);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Bit.TemplatePlayground.Client.Core.Components;
public partial class AppDataAnnotationsValidator : AppComponentBase
{
[UnsafeAccessor(UnsafeAccessorKind.Method, Name = "set_OtherPropertyDisplayName")]
extern static void SetOtherPropertyDisplayName(CompareAttribute valAttribute, string name);
static extern void SetOtherPropertyDisplayName(CompareAttribute valAttribute, string name);

private bool disposed;
private ValidationMessageStore validationMessageStore = default!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace Bit.TemplatePlayground.Client.Core.Components;
public partial class ClientAppCoordinator : AppComponentBase
{
[AutoInject] private Navigator navigator = default!;
[AutoInject] private UserAgent userAgent = default!;
[AutoInject] private IJSRuntime jsRuntime = default!;
[AutoInject] private IStorageService storageService = default!;
[AutoInject] private ILogger<AuthManager> authLogger = default!;
Expand All @@ -33,13 +34,13 @@ protected override async Task OnInitAsync()
{
NavigationManager.NavigateTo(uri!.ToString()!);
});
TelemetryContext.UserAgent = await navigator.GetUserAgent();
TelemetryContext.TimeZone = await jsRuntime.GetTimeZone();
TelemetryContext.Culture = CultureInfo.CurrentCulture.Name;
TelemetryContext.PageUrl = NavigationManager.Uri;
if (AppPlatform.IsBlazorHybrid is false)
{
TelemetryContext.Platform = await jsRuntime.GetBrowserPlatform();
var userAgentData = await userAgent.Extract();
TelemetryContext.Platform = string.Join(' ', [userAgentData.Manufacturer, userAgentData.OsName, userAgentData.Name, "browser"]);
}


Expand Down Expand Up @@ -115,13 +116,6 @@ private async Task ConfigureUISetup()
await storageService.GetItem("Culture") ?? // 2- User settings
CultureInfo.CurrentUICulture.Name); // 3- OS settings
}

var platformCssClass = AppPlatform.IsWindows ? "bit-windows" :
AppPlatform.IsMacOS ? "bit-macos" :
AppPlatform.IsIOS ? "bit-ios" :
AppPlatform.IsAndroid ? "bit-android" : "bit-unknown";

await jsRuntime.ApplyBodyElementClasses(cssClasses: [platformCssClass], cssVariables: []);
}

private List<IDisposable> signalROnDisposables = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ protected override async Task OnInitAsync()
{
unsubscribePageTitleChanged = PubSubService.Subscribe(ClientPubSubMessages.PAGE_TITLE_CHANGED, async payload =>
{
(pageTitle, pageSubtitle) = (ValueTuple<string?, string?>)payload!;
(pageTitle, pageSubtitle) = ((string, string))payload!;

StateHasChanged();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import '../../Styles/abstracts/_media-queries.scss';
@import '../../Styles/abstracts/_bit-css-variables.scss';

section {
width: 100%;
Expand All @@ -8,10 +9,10 @@ section {
::deep {
.modal {
width: unset;
top: var(--app-inset-top);
left: var(--app-inset-left);
right: var(--app-inset-right);
bottom: var(--app-inset-bottom);
top: $bit-env-inset-top;
left: $bit-env-inset-left;
right: $bit-env-inset-right;
bottom: $bit-env-inset-bottom;
}

.container {
Expand All @@ -26,15 +27,15 @@ section {
left: 50%;
position: fixed;
transform: translateX(-50%);
bottom: calc(var(--app-inset-bottom) + 1rem);
bottom: calc(#{$bit-env-inset-bottom} + 1rem);
}

.log-modal {
overflow: auto;
max-width: 40rem;
max-height: 40rem;
white-space: nowrap;
height: min(20rem, var(--app-height) - 4rem);
width: min(40rem, calc(var(--app-width) - 2rem));
height: min(20rem, #{$bit-env-height-available} - 4rem);
width: min(40rem, calc(#{$bit-env-width-available} - 2rem));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ header {
height: unset;
max-width: 225px;
box-shadow: none;
bottom: var(--app-inset-bottom);
top: var(--app-inset-top) !important;
bottom: $bit-env-inset-bottom;
top: $bit-env-inset-top !important;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
@inherits LayoutComponentBase


<CascadingValue Value=currentDir>
<CascadingValue Name=@Parameters.IsOnline Value=isOnline>
<CascadingValue Name=@Parameters.CurrentTheme Value=currentTheme>
<CascadingValue Name=@Parameters.IsAuthenticated Value=isAuthenticated>
<CascadingValue Name=@Parameters.CurrentRouteData Value=currentRouteData>
<CascadingValue Name=@Parameters.IsCrossLayoutPage Value=isCrossLayoutPage>
<BitAppShell>
<main class="@GetMainCssClass()">
<div class="root">
@if (isAuthenticated is false)
{
<IdentityHeader />
}
else if (isAuthenticated is true)
{
<BitNavPanel @bind-IsOpen="isNavPanelOpen" Items="navPanelItems" />
}

<div class="stack">
@if (isAuthenticated is true)
{
<AuthorizedHeader />
}

<div class="body">
@Body
</div>

@if (isAuthenticated is false && isCrossLayoutPage is false)
{
<div class="panel">
<BitImage Width="70%" Src="_content/Bit.TemplatePlayground.Client.Core/images/identitylayout-image.webp" />
</div>
}
</div>
</div>

@if (isAuthenticated is true)
{
<NavBar />
}
</main>
</BitAppShell>
</CascadingValue>
</CascadingValue>
</CascadingValue>
</CascadingValue>
</CascadingValue>
</CascadingValue>

<SnackBar />
<DiagnosticModal />
<BitModalContainer ModalParameters="modalParameters" />

<JsBridge />
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Bit.TemplatePlayground.Client.Core.Components.Layout;

public partial class RootLayout : IDisposable
public partial class MainLayout : IAsyncDisposable
{
private BitDir? currentDir;
private string? currentUrl;
private bool isNavPanelOpen;
private readonly BitModalParameters modalParameters = new() { Classes = new() { Root = "modal" } };

/// <summary>
Expand All @@ -21,12 +21,14 @@ public partial class RootLayout : IDisposable
private AppThemeType? currentTheme;
private RouteData? currentRouteData;
private List<Action> unsubscribers = [];
private List<BitNavItem> navPanelItems = [];


[AutoInject] private Keyboard keyboard = default!;
[AutoInject] private AuthManager authManager = default!;
[AutoInject] private ThemeService themeService = default!;
[AutoInject] private PubSubService pubSubService = default!;
[AutoInject] private BitExtraServices bitExtraServices = default!;
[AutoInject] private IExceptionHandler exceptionHandler = default!;
[AutoInject] private ITelemetryContext telemetryContext = default!;
[AutoInject] private NavigationManager navigationManager = default!;
Expand All @@ -40,19 +42,24 @@ protected override async Task OnInitializedAsync()
{
try
{
InitializeNavPanelItems();

navigationManager.LocationChanged += NavigationManagerLocationChanged;
authManager.AuthenticationStateChanged += AuthenticationStateChanged;

unsubscribers.Add(pubSubService.Subscribe(ClientPubSubMessages.CULTURE_CHANGED, async _ =>
{
SetCurrentDir();
StateHasChanged();
}));

unsubscribers.Add(pubSubService.Subscribe(ClientPubSubMessages.THEME_CHANGED, async payload =>
{
if (payload is null) return;
currentTheme = (AppThemeType)payload;
StateHasChanged();
}));

unsubscribers.Add(pubSubService.Subscribe(ClientPubSubMessages.ROUTE_DATA_UPDATED, async payload =>
{
currentRouteData = (RouteData?)payload;
Expand All @@ -66,12 +73,19 @@ protected override async Task OnInitializedAsync()
await InvokeAsync(StateHasChanged);
}));

unsubscribers.Add(pubSubService.Subscribe(ClientPubSubMessages.OPEN_NAV_PANEL, async _ =>
{
isNavPanelOpen = true;
StateHasChanged();
}));

isAuthenticated = await prerenderStateService.GetValue(async () => (await AuthenticationStateTask).User.IsAuthenticated());

SetCurrentDir();
SetCurrentUrl();
currentTheme = await themeService.GetCurrentTheme();

await bitExtraServices.AddRootCssClasses();

await base.OnInitializedAsync();
}
catch (Exception exp)
Expand Down Expand Up @@ -118,7 +132,6 @@ private async void AuthenticationStateChanged(Task<AuthenticationState> task)

private void NavigationManagerLocationChanged(object? sender, Microsoft.AspNetCore.Components.Routing.LocationChangedEventArgs e)
{
SetCurrentUrl();
StateHasChanged();
}

Expand All @@ -128,18 +141,6 @@ private void SetCurrentDir()
currentDir = CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft ? BitDir.Rtl : null;
}

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

currentUrl = Urls.All.SingleOrDefault(pageUrl =>
{
return pageUrl == Urls.HomePage
? pageUrl == path
: path.StartsWith(pageUrl);
});
}

/// <summary>
/// <inheritdoc cref="Parameters.IsCrossLayoutPage"/>
/// </summary>
Expand Down Expand Up @@ -185,15 +186,17 @@ private string GetMainCssClass()
return authClass + crossClass;
}


public void Dispose()
public async ValueTask DisposeAsync()
{
navigationManager.LocationChanged -= NavigationManagerLocationChanged;

authManager.AuthenticationStateChanged -= AuthenticationStateChanged;

unsubscribers.ForEach(d => d.Invoke());

_ = keyboard?.DisposeAsync();
if (keyboard is not null)
{
await keyboard.DisposeAsync();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ main {

@include lt-md {
height: unset;
min-height: var(--app-height);
min-height: $bit-env-height-available;
}

&.unauthenticated {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
@import '../../Styles/abstracts/_media-queries.scss';
@import '../../Styles/abstracts/_bit-css-variables.scss';

section {
padding: 1rem;
min-width: 20rem;
max-height: var(--app-height);
max-height: $bit-env-height-available;

@include lt-md {
min-width: unset;
Expand All @@ -20,6 +21,6 @@ section {

::deep {
.stack {
max-height: calc(var(--app-height) - 3rem);
max-height: calc(#{$bit-env-height-available} - 3rem);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
<BitNavBar TItem="BitNavBarOption" Style="width:100%">
<BitNavBarOption Text="@Localizer[nameof(AppStrings.Home)]" IconName="@BitIconName.Home" Url="@Urls.HomePage" />
<BitNavBarOption Text="@Localizer[nameof(AppStrings.Dashboard)]" IconName="@BitIconName.BarChartVerticalFill" Url="@Urls.DashboardPage" />
<BitNavBarOption Text="@Localizer[nameof(AppStrings.Products)]" IconName="@BitIconName.Product" Url="@Urls.ProductsPage" />
<BitNavBarOption Text="@Localizer[nameof(AppStrings.Categories)]" IconName="@BitIconName.BuildQueue" Url="@Urls.CategoriesPage" />
<BitNavBarOption Text="@Localizer[nameof(AppStrings.Products)]" IconName="@BitIconName.Product" Url="@Urls.ProductsPage" />
<BitNavBarOption Text="@Localizer[nameof(AppStrings.Terms)]" IconName="@BitIconName.EntityExtraction" Url="@Urls.TermsPage" />
</BitNavBar>
</section>
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,4 @@

public partial class NavBar
{
[CascadingParameter(Name = Parameters.CurrentUrl)] private string? currentUrl { get; set; }

private bool IsActive(string url)
{
return currentUrl == url;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ section {
height: 3.5rem;
position: fixed;
align-items: center;
max-width: var(--app-width);
bottom: $bit-env-inset-bottom;
justify-content: space-around;
bottom: var(--app-inset-bottom);
max-width: $bit-env-width-available;
background-color: $bit-color-background-primary;
border-top: 1px solid $bit-color-border-tertiary;

Expand Down
Loading

0 comments on commit 26aa642

Please sign in to comment.