mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 10:43:35 +00:00
Added toggle full width function
Added toggle full width function. Added messaging service to trigger function. Added CSS to keep login box the same size.
This commit is contained in:
@@ -35,6 +35,7 @@ import { CryptoService } from 'jslib/abstractions/crypto.service';
|
||||
import { EventService } from 'jslib/abstractions/event.service';
|
||||
import { FolderService } from 'jslib/abstractions/folder.service';
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
||||
import { NotificationsService } from 'jslib/abstractions/notifications.service';
|
||||
import { PasswordGenerationService } from 'jslib/abstractions/passwordGeneration.service';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
@@ -69,6 +70,7 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
private lastActivity: number = null;
|
||||
private idleTimer: number = null;
|
||||
private isIdle = false;
|
||||
private enableFullWidth = false;
|
||||
|
||||
constructor(private angulartics2GoogleAnalytics: Angulartics2GoogleAnalytics,
|
||||
private broadcasterService: BroadcasterService, private userService: UserService,
|
||||
@@ -83,7 +85,7 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
private sanitizer: DomSanitizer, private searchService: SearchService,
|
||||
private notificationsService: NotificationsService, private routerService: RouterService,
|
||||
private stateService: StateService, private eventService: EventService,
|
||||
private policyService: PolicyService) { }
|
||||
private policyService: PolicyService, private messagingService: MessagingService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.ngZone.runOutsideAngular(() => {
|
||||
@@ -148,6 +150,10 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
properties: { label: message.label },
|
||||
});
|
||||
break;
|
||||
case 'setFullWidth':
|
||||
this.enableFullWidth = await this.storageService.get<boolean>('enableFullWidth');
|
||||
this.setFullWidth();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@@ -166,6 +172,7 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
}
|
||||
}
|
||||
});
|
||||
this.messagingService.send('setFullWidth');
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
@@ -262,4 +269,12 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
this.notificationsService.reconnectFromActivity();
|
||||
}
|
||||
}
|
||||
|
||||
private async setFullWidth() {
|
||||
if (this.enableFullWidth) {
|
||||
document.body.classList.add('full-width');
|
||||
} else {
|
||||
document.body.classList.remove('full-width');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import { ToasterService } from 'angular2-toaster';
|
||||
import { Angulartics2 } from 'angulartics2';
|
||||
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
import { MessagingService } from 'jslib/abstractions/messaging.service';
|
||||
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
|
||||
import { StateService } from 'jslib/abstractions/state.service';
|
||||
import { StorageService } from 'jslib/abstractions/storage.service';
|
||||
@@ -35,7 +36,7 @@ export class OptionsComponent implements OnInit {
|
||||
constructor(private storageService: StorageService, private stateService: StateService,
|
||||
private analytics: Angulartics2, private i18nService: I18nService,
|
||||
private toasterService: ToasterService, private vaultTimeoutService: VaultTimeoutService,
|
||||
private platformUtilsService: PlatformUtilsService) {
|
||||
private platformUtilsService: PlatformUtilsService, private messagingService: MessagingService) {
|
||||
this.vaultTimeouts = [
|
||||
{ name: i18nService.t('oneMinute'), value: 1 },
|
||||
{ name: i18nService.t('fiveMinutes'), value: 5 },
|
||||
@@ -80,6 +81,7 @@ export class OptionsComponent implements OnInit {
|
||||
await this.stateService.save('enableGravatars', this.enableGravatars);
|
||||
await this.storageService.save('enableFullWidth', this.enableFullWidth);
|
||||
await this.stateService.save('enableFullWidth', this.enableFullWidth);
|
||||
this.messagingService.send('setFullWidth');
|
||||
await this.storageService.save(ConstantsService.localeKey, this.locale);
|
||||
this.analytics.eventTrack.next({ action: 'Saved Options' });
|
||||
if (this.locale !== this.startingLocale) {
|
||||
|
||||
Reference in New Issue
Block a user