From ef20d0da371f38d63966f8295d0ac91d43079253 Mon Sep 17 00:00:00 2001 From: Danilo Guzzo Date: Wed, 21 Jun 2023 14:39:32 +0200 Subject: [PATCH] Show editor name and icon in navbar --- desktop/src/app/components/app.module.ts | 2 ++ .../navbar/taskbar-editor.component.ts | 33 +++++++++++++++++++ .../app/components/navbar/taskbar-editor.html | 12 +++++++ .../app/components/navbar/taskbar-editor.scss | 17 ++++++++++ .../src/app/components/navbar/taskbar.html | 2 ++ .../src/app/components/navbar/taskbar.scss | 1 + 6 files changed, 67 insertions(+) create mode 100644 desktop/src/app/components/navbar/taskbar-editor.component.ts create mode 100644 desktop/src/app/components/navbar/taskbar-editor.html create mode 100644 desktop/src/app/components/navbar/taskbar-editor.scss diff --git a/desktop/src/app/components/app.module.ts b/desktop/src/app/components/app.module.ts index 67ff1fb117..1ecc243d96 100644 --- a/desktop/src/app/components/app.module.ts +++ b/desktop/src/app/components/app.module.ts @@ -46,6 +46,7 @@ import { Modals } from '../services/modals'; import { Languages } from '../services/languages'; import { NavbarComponent } from './navbar/navbar.component'; import { ProjectsComponent } from './navbar/projects.component'; +import { TaskbarEditorComponent } from './navbar/taskbar-editor.component'; import { TaskbarConflictsComponent } from './navbar/taskbar-conflicts.component'; import { TaskbarSyncStatusComponent } from './navbar/taskbar-sync-status.component'; import { TaskbarUpdateComponent } from './navbar/taskbar-update.component'; @@ -103,6 +104,7 @@ registerLocaleData(localeUk, 'uk'); TaskbarUpdateComponent, ProjectsComponent, HelpComponent, + TaskbarEditorComponent ], providers: [ Modals, diff --git a/desktop/src/app/components/navbar/taskbar-editor.component.ts b/desktop/src/app/components/navbar/taskbar-editor.component.ts new file mode 100644 index 0000000000..55c71e72ca --- /dev/null +++ b/desktop/src/app/components/navbar/taskbar-editor.component.ts @@ -0,0 +1,33 @@ +import { Component, OnInit } from '@angular/core';; +import { SettingsProvider } from '../../services/settings/settings-provider'; +import { AppComponent } from '../app.component'; + +@Component({ + selector: 'taskbar-editor', + templateUrl: './taskbar-editor.html' +}) +/** + * @author Danilo Guzzo + */ + +export class TaskbarEditorComponent implements OnInit { + public currentEditor: string; + + constructor( + private settingsProvider: SettingsProvider, + private appComponent: AppComponent + ) { + this.currentEditor = this.settingsProvider.getSettings().username; + this.settingsProvider.settingsChangesNotifications().subscribe(settings => this.currentEditor = settings.username); + } + public openModal = () => this.appComponent.promptEditorName(); + + ngOnInit() { + + this.currentEditor = this.settingsProvider.getSettings().username; + } + + public getEditorName() { + return this.currentEditor; + } +} \ No newline at end of file diff --git a/desktop/src/app/components/navbar/taskbar-editor.html b/desktop/src/app/components/navbar/taskbar-editor.html new file mode 100644 index 0000000000..7c7842cd14 --- /dev/null +++ b/desktop/src/app/components/navbar/taskbar-editor.html @@ -0,0 +1,12 @@ +
+ + + + {{getEditorName()}} + +
diff --git a/desktop/src/app/components/navbar/taskbar-editor.scss b/desktop/src/app/components/navbar/taskbar-editor.scss new file mode 100644 index 0000000000..9615bf0555 --- /dev/null +++ b/desktop/src/app/components/navbar/taskbar-editor.scss @@ -0,0 +1,17 @@ +taskbar-editor { + #editor { + padding-right: 1rem !important; + + position: relative; + left: 1px; + height: 20px; + .mdi { + float: left; + margin-right: 10px; + } + + #editor-name { + white-space: nowrap + } + } +} diff --git a/desktop/src/app/components/navbar/taskbar.html b/desktop/src/app/components/navbar/taskbar.html index b985ce43c1..7d6cc1a214 100644 --- a/desktop/src/app/components/navbar/taskbar.html +++ b/desktop/src/app/components/navbar/taskbar.html @@ -7,6 +7,8 @@ +
  • + diff --git a/desktop/src/app/components/navbar/taskbar.scss b/desktop/src/app/components/navbar/taskbar.scss index 38aedb58f9..d5f169ed3e 100644 --- a/desktop/src/app/components/navbar/taskbar.scss +++ b/desktop/src/app/components/navbar/taskbar.scss @@ -1,6 +1,7 @@ @import 'taskbar-conflicts'; @import 'taskbar-update'; @import 'taskbar-sync-status'; +@import 'taskbar-editor'; .taskbar { margin-top: 2px;