Skip to content

Commit

Permalink
Show editor name and icon in navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
GuzzoD committed Jun 21, 2023
1 parent 0b1c5de commit ef20d0d
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 0 deletions.
2 changes: 2 additions & 0 deletions desktop/src/app/components/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -103,6 +104,7 @@ registerLocaleData(localeUk, 'uk');
TaskbarUpdateComponent,
ProjectsComponent,
HelpComponent,
TaskbarEditorComponent
],
providers: [
Modals,
Expand Down
33 changes: 33 additions & 0 deletions desktop/src/app/components/navbar/taskbar-editor.component.ts
Original file line number Diff line number Diff line change
@@ -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;
}
}
12 changes: 12 additions & 0 deletions desktop/src/app/components/navbar/taskbar-editor.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<div id="editor">
<span class="mdi mdi-account-alert" *ngIf="getEditorName() === 'anonymous'"></span>
<span class="mdi mdi-account-check" *ngIf="getEditorName() != 'anonymous'"></span>
<a
id="editor-name"
class="nav-link px-2"
type="button"
(click)="openModal()"
>
{{getEditorName()}}
</a>
</div>
17 changes: 17 additions & 0 deletions desktop/src/app/components/navbar/taskbar-editor.scss
Original file line number Diff line number Diff line change
@@ -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
}
}
}
2 changes: 2 additions & 0 deletions desktop/src/app/components/navbar/taskbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
<taskbar-conflicts></taskbar-conflicts>
</li>

<li> <taskbar-editor></taskbar-editor></li>

<li *ngIf="showSyncStatus()" class="nav-item pr-2">
<taskbar-sync-status></taskbar-sync-status>
</li>
Expand Down
1 change: 1 addition & 0 deletions desktop/src/app/components/navbar/taskbar.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@import 'taskbar-conflicts';
@import 'taskbar-update';
@import 'taskbar-sync-status';
@import 'taskbar-editor';

.taskbar {
margin-top: 2px;
Expand Down

0 comments on commit ef20d0d

Please sign in to comment.