Merged PR 1278: #3204 Platform Detection and Scrollbars

#3204 Platform Detection and Scrollbars
This commit is contained in:
Nino Righi
2022-06-23 07:28:14 +00:00
committed by Lorenz Hilpert
parent 67dae94524
commit d54cc7a2fd
17 changed files with 95 additions and 20 deletions

View File

@@ -8,6 +8,7 @@ import { NotificationsHub } from '@hub/notifications';
import packageInfo from 'package';
import { interval, Observable, Subscription } from 'rxjs';
import { tap } from 'rxjs/operators';
import { Platform } from '@angular/cdk/platform';
@Component({
selector: 'app-root',
@@ -36,7 +37,8 @@ export class AppComponent implements OnInit {
@Inject(DOCUMENT) private readonly _document: Document,
private readonly _renderer: Renderer2,
private readonly _swUpdate: SwUpdate,
private readonly _notifications: NotificationsHub
private readonly _notifications: NotificationsHub,
private readonly _platform: Platform
) {
this.updateClient();
}
@@ -44,6 +46,7 @@ export class AppComponent implements OnInit {
ngOnInit() {
this.setTitle();
this.logVersion();
this.determinePlatform();
this._appService.getSection$().subscribe(this.sectionChangeHandler.bind(this));
}
@@ -56,6 +59,18 @@ export class AppComponent implements OnInit {
console.log(`%c${this._config.get('title')}\r\nVersion: ${packageInfo.version}`, 'font-weight: bold; font-size: 20px;');
}
determinePlatform() {
if (this._platform.IOS && !this._platform.SAFARI) {
this._renderer.addClass(this._document.body, 'tablet');
this._renderer.addClass(this._document.body, 'tablet-native');
} else if (this._platform.IOS && this._platform.SAFARI) {
this._renderer.addClass(this._document.body, 'tablet');
this._renderer.addClass(this._document.body, 'tablet-browser');
} else if (this._platform.isBrowser) {
this._renderer.addClass(this._document.body, 'desktop');
}
}
sectionChangeHandler(section: string) {
if (section === 'customer') {
this._renderer.removeClass(this._document.body, 'branch');

View File

@@ -2,6 +2,7 @@ import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { APP_INITIALIZER, ErrorHandler, Injector, LOCALE_ID, NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { PlatformModule } from '@angular/cdk/platform';
import { Config, ConfigModule, JsonConfigLoader } from '@core/config';
import { AuthModule, AuthService } from '@core/auth';
@@ -81,6 +82,7 @@ export function _notificationsHubOptionsFactory(config: Config, auth: AuthServic
registrationStrategy: 'registerWhenStable:30000',
}),
ScanAdapterModule.forRoot(!environment.production),
PlatformModule,
],
providers: [
{

View File

@@ -1,6 +1,9 @@
body.branch {
--bg-color: #edeff0;
// @isa-app/scrollbar
--scrollbar-color: #596470;
// @shell/header
--shell-header-button-color: #89949e;
--shell-header-button-color-active: #586470;

View File

@@ -1,6 +1,9 @@
body.customer {
--bg-color: #e6eff9;
// @isa-app/scrollbar
--scrollbar-color: #1f466c;
// @shell/header
--shell-header-button-color: #9db2c6;
--shell-header-button-color-active: #557596;

View File

@@ -21,3 +21,23 @@ body {
width: 0; // remove scrollbar space
background: transparent; // optional: just make scrollbar invisible */
}
.desktop .scroll-bar::-webkit-scrollbar,
.desktop pdf-viewer ::-webkit-scrollbar {
width: 12px;
background-color: transparent;
}
.desktop .scroll-bar::-webkit-scrollbar-thumb,
.desktop pdf-viewer ::-webkit-scrollbar-thumb {
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgb(0 0 0 / 10%);
background-color: var(--scrollbar-color);
}
.desktop .scroll-bar::-webkit-scrollbar-track,
.desktop pdf-viewer ::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 4px rgb(0 0 0 / 10%);
border-radius: 10px;
background-color: white;
}

View File

@@ -5,7 +5,7 @@
<cdk-virtual-scroll-viewport
#scrollContainer
class="product-list scroll-bar"
class="product-list scroll-bar scroll-bar-margin"
[itemSize]="187"
minBufferPx="1200"
maxBufferPx="1200"

View File

@@ -44,3 +44,9 @@
@apply bg-brand text-white;
}
}
::ng-deep .desktop page-search-results {
.scroll-bar-margin::-webkit-scrollbar-track {
margin-bottom: 0.5rem;
}
}

View File

@@ -7,7 +7,7 @@ import { DomainCheckoutService } from '@domain/checkout';
import { ItemDTO } from '@swagger/cat';
import { AddToShoppingCartDTO } from '@swagger/checkout';
import { UiFilter } from '@ui/filter';
import { UiErrorModalComponent, UiModalRef, UiModalService } from '@ui/modal';
import { UiErrorModalComponent, UiModalService } from '@ui/modal';
import { CacheService } from 'apps/core/cache/src/public-api';
import { isEqual } from 'lodash';
import { BehaviorSubject, combineLatest, Subscription } from 'rxjs';

View File

@@ -18,3 +18,9 @@ a {
@apply text-lg text-brand font-bold;
}
}
::ng-deep .desktop page-customer-search-result ui-scroll-container {
.scrollbar-gap::-webkit-scrollbar-track {
margin-bottom: 250px;
}
}

View File

@@ -60,3 +60,9 @@
shared-goods-in-out-order-group-item {
@apply cursor-pointer;
}
::ng-deep .desktop page-goods-in-cleanup-list ui-scroll-container {
.scrollbar-gap::-webkit-scrollbar-track {
margin-bottom: 7.25rem;
}
}

View File

@@ -77,3 +77,9 @@ hr {
@apply bg-white text-brand;
}
}
::ng-deep .desktop page-goods-in-list ui-scroll-container {
.scrollbar-gap::-webkit-scrollbar-track {
margin-bottom: 7.25rem;
}
}

View File

@@ -60,3 +60,9 @@ shared-goods-in-out-order-group-item {
::ng-deep page-goods-in-remission-preview ui-scroll-container .cta-scroll {
bottom: 35px !important;
}
::ng-deep .desktop page-goods-in-remission-preview ui-scroll-container {
.scrollbar-gap::-webkit-scrollbar-track {
margin-bottom: 7.25rem;
}
}

View File

@@ -60,3 +60,9 @@ shared-goods-in-out-order-group-item {
::ng-deep page-goods-in-reservation ui-scroll-container .cta-scroll {
bottom: 35px !important;
}
::ng-deep .desktop page-goods-in-reservation ui-scroll-container {
.scrollbar-gap::-webkit-scrollbar-track {
margin-bottom: 7.25rem;
}
}

View File

@@ -34,3 +34,9 @@ shared-goods-in-out-order-group-item {
::ng-deep page-goods-in-search-results ui-scroll-container .cta-scroll {
bottom: 35px !important;
}
::ng-deep .desktop page-goods-in-search-results ui-scroll-container {
.scrollbar-gap::-webkit-scrollbar-track {
margin-bottom: 7.25rem;
}
}

View File

@@ -39,3 +39,9 @@ shared-goods-in-out-order-group-item {
@apply bg-white text-brand;
}
}
::ng-deep .desktop page-goods-out-search-results ui-scroll-container {
.scrollbar-gap::-webkit-scrollbar-track {
margin-bottom: 7.25rem;
}
}

View File

@@ -9,7 +9,7 @@
<cdk-virtual-scroll-viewport
#scrollContainer
class="remission-list scroll-bar"
class="remission-list"
[itemSize]="368"
minBufferPx="1200"
maxBufferPx="1200"

View File

@@ -2,14 +2,6 @@
@apply relative grid grid-flow-row gap-3;
}
::ng-deep ui-scroll-container .scroll-bar::-webkit-scrollbar {
background-color: transparent !important;
}
::ng-deep ui-scroll-container .scroll-bar::-webkit-scrollbar-track {
background-color: white !important;
}
.spacer {
@apply h-px-100;
}
@@ -25,20 +17,12 @@
}
::ng-deep .customer ui-scroll-container {
.scrollbar-gap::-webkit-scrollbar-track {
margin-bottom: 10rem;
}
.cta-scroll {
@apply text-active-customer;
}
}
::ng-deep .branch ui-scroll-container {
.scrollbar-gap::-webkit-scrollbar-track {
margin-bottom: 15.5rem;
}
.cta-scroll {
@apply text-cool-grey;
}