mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge remote-tracking branch 'origin/master' into submission
# Conflicts: # resources/i18n/en.json # src/app/app.component.scss # src/app/app.component.spec.ts # src/app/app.component.ts # src/app/app.module.ts # src/app/shared/chips/chips.component.spec.ts # src/app/shared/chips/models/chips-item.model.spec.ts # src/app/shared/form/builder/ds-dynamic-form-ui/models/tag/dynamic-tag.component.html # src/app/shared/form/builder/ds-dynamic-form-ui/models/typeahead/dynamic-typeahead.component.html # src/app/shared/shared.module.ts # yarn.lock
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { filter, first, take } from 'rxjs/operators';
|
||||
import { filter, first, map, take } from 'rxjs/operators';
|
||||
import {
|
||||
AfterViewInit,
|
||||
ChangeDetectionStrategy,
|
||||
@@ -24,16 +24,29 @@ import { isAuthenticated } from './core/auth/selectors';
|
||||
import { AuthService } from './core/auth/auth.service';
|
||||
import { Angulartics2GoogleAnalytics } from 'angulartics2/ga';
|
||||
import { RouteService } from './shared/services/route.service';
|
||||
import variables from '../styles/_exposed_variables.scss';
|
||||
import { CSSVariableService } from './shared/sass-helper/sass-helper.service';
|
||||
import { MenuService } from './shared/menu/menu.service';
|
||||
import { MenuID } from './shared/menu/initial-menus-state';
|
||||
import { Observable } from 'rxjs/internal/Observable';
|
||||
import { slideSidebarPadding } from './shared/animations/slide';
|
||||
import { combineLatest as combineLatestObservable } from 'rxjs';
|
||||
import { HostWindowService } from './shared/host-window.service';
|
||||
|
||||
@Component({
|
||||
selector: 'ds-app',
|
||||
templateUrl: './app.component.html',
|
||||
styleUrls: ['./app.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
encapsulation: ViewEncapsulation.None
|
||||
encapsulation: ViewEncapsulation.None,
|
||||
animations: [slideSidebarPadding]
|
||||
})
|
||||
export class AppComponent implements OnInit, AfterViewInit {
|
||||
isLoading = true;
|
||||
sidebarVisible: Observable<boolean>;
|
||||
slideSidebarOver: Observable<boolean>;
|
||||
collapsedSidebarWidth: Observable<string>;
|
||||
totalSidebarWidth: Observable<string>;
|
||||
|
||||
constructor(
|
||||
@Inject(GLOBAL_CONFIG) public config: GlobalConfig,
|
||||
@@ -44,7 +57,11 @@ export class AppComponent implements OnInit, AfterViewInit {
|
||||
private angulartics2GoogleAnalytics: Angulartics2GoogleAnalytics,
|
||||
private authService: AuthService,
|
||||
private router: Router,
|
||||
private routeService: RouteService
|
||||
private routeService: RouteService,
|
||||
private router: Router,
|
||||
private cssService: CSSVariableService,
|
||||
private menuService: MenuService,
|
||||
private windowService: HostWindowService
|
||||
) {
|
||||
// this language will be used as a fallback when a translation isn't found in the current language
|
||||
translate.setDefaultLang('en');
|
||||
@@ -58,6 +75,8 @@ export class AppComponent implements OnInit, AfterViewInit {
|
||||
if (config.debug) {
|
||||
console.info(config);
|
||||
}
|
||||
this.storeCSSVariables();
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
@@ -71,7 +90,23 @@ export class AppComponent implements OnInit, AfterViewInit {
|
||||
first(),
|
||||
filter((authenticated) => !authenticated)
|
||||
).subscribe((authenticated) => this.authService.checkAuthenticationToken());
|
||||
this.sidebarVisible = this.menuService.isMenuVisible(MenuID.ADMIN);
|
||||
|
||||
this.collapsedSidebarWidth = this.cssService.getVariable('collapsedSidebarWidth');
|
||||
this.totalSidebarWidth = this.cssService.getVariable('totalSidebarWidth');
|
||||
|
||||
const sidebarCollapsed = this.menuService.isMenuCollapsed(MenuID.ADMIN);
|
||||
this.slideSidebarOver = combineLatestObservable(sidebarCollapsed, this.windowService.isXsOrSm())
|
||||
.pipe(
|
||||
map(([collapsed, mobile]) => collapsed || mobile)
|
||||
);
|
||||
}
|
||||
|
||||
private storeCSSVariables() {
|
||||
const vars = variables.locals || {};
|
||||
Object.keys(vars).forEach((name: string) => {
|
||||
this.cssService.addCSSVariable(name, vars[name]);
|
||||
})
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
Reference in New Issue
Block a user