diff --git a/src/app/webide/webide.component.html b/src/app/webide/webide.component.html
index a952aa0..ab9174e 100644
--- a/src/app/webide/webide.component.html
+++ b/src/app/webide/webide.component.html
@@ -3,12 +3,13 @@
class="btn btn-secondary"
[class.active]="filename === file"
[class.disabled]="filename === file"
- (click)="selectCode(file); requestCode()">
+ (click)="selectCode(file); requestCode()"
+ [disabled]="filename === file">
{{file}}
-
-
-Saved
-Saving
-Not Saved
-Not Saving
+ [class.btn-success]="saveButtonState === 'SAVED'"
+ [class.btn-warning]="saveButtonState === 'SAVING'"
+ [class.disabled]="saveButtonState === 'SAVING'"
+>Save!
+ Saved!
+ Saving...
diff --git a/src/app/webide/webide.component.ts b/src/app/webide/webide.component.ts
index 14110fb..f656f6d 100644
--- a/src/app/webide/webide.component.ts
+++ b/src/app/webide/webide.component.ts
@@ -20,8 +20,7 @@ export class WebideComponent implements OnInit {
language = 'javascript';
theme = 'monokai';
files: string[];
- saved = false;
- saving = false;
+ saveButtonState = 'DIRTY';
constructor(private webSocketService: WebSocketService) { }
@@ -31,7 +30,7 @@ export class WebideComponent implements OnInit {
this.code = event.data.content;
this.language = event.data.language;
this.files = event.data.files;
- if (event.data.command === 'write') { this.saved = true; this.saving = false; }
+ if (event.data.command === 'write') { this.saveButtonState = 'SAVED'; }
});
this.requestCode();
}
@@ -41,8 +40,7 @@ export class WebideComponent implements OnInit {
'command': 'write',
'content': this.code
});
- this.saving = true;
- this.saved = false;
+ this.saveButtonState = 'SAVING';
}
requestCode() {