Skip to content

Commit

Permalink
feat: added sync indicator to footer
Browse files Browse the repository at this point in the history
  • Loading branch information
domiSchenk committed Sep 24, 2021
1 parent f85be07 commit db32869
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/app/shared/components/footer/footer.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<ng-container *ngIf="!!repositoryService.repositorySetting?.name">
<commander-branch-ahead-behind (click)="sync()" [noColor]="true" [branch]="repositoryService.currentBranch" cds-layout="m-l:sm">
<commander-branch-ahead-behind *ngIf="!isSync; else spinner" (click)="sync()" [noColor]="true"
[branch]="repositoryService.currentBranch" cds-layout="m-l:sm">
</commander-branch-ahead-behind>
<ng-template #spinner>
<cds-icon shape="sync" class="spinner spin" cds-layout="m-l:sm"> </cds-icon>
</ng-template>
</ng-container>
4 changes: 4 additions & 0 deletions src/app/shared/components/footer/footer.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@ commander-branch-ahead-behind {
line-height: 25px;
cursor: pointer;
}

.spinner {
margin-top: 4px;
}
10 changes: 8 additions & 2 deletions src/app/shared/components/footer/footer.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { RepositoryService } from '@routes/repository/repository.service';
import { sleep } from '@shared/functions';

@Component({
selector: 'commandos-footer',
Expand All @@ -8,14 +9,19 @@ import { RepositoryService } from '@routes/repository/repository.service';
})
export class FooterComponent implements OnInit {

isSync = false;

constructor(
public repositoryService: RepositoryService
) { }

ngOnInit(): void {
}

sync() {
this.repositoryService.sync();
async sync() {
this.isSync = true;
await this.repositoryService.sync();
await sleep(2000);
this.isSync = false;
}
}

0 comments on commit db32869

Please sign in to comment.