Skip to content

Commit

Permalink
#131 fixed config editor on mobile devices
Browse files Browse the repository at this point in the history
  • Loading branch information
oznu committed Jul 30, 2018
1 parent 2f26200 commit f1c5b84
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file. This projec
### Bug Fixes

* **Config Editor:** Backup button actually downloads up the `config.json` now ([#144](https://github.com/oznu/homebridge-config-ui-x/issues/144))
* **Config Editor:** Fixed issued using config editor on mobile devices ([#131](https://github.com/oznu/homebridge-config-ui-x/issues/131))
* **Accessory Control:** Accessory layout changes are now persistent again

## 3.8.7 (2018-07-28)
Expand Down
6 changes: 6 additions & 0 deletions ui/src/app/config/config.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ <h3 class="primary-text m-0">
</div>

<ace-editor
*ngIf="!isMobile"
class="hb-ace-text-editor align-self-end h-100 mb-3 mt-3"
[(text)]="homebridgeConfig"
theme="xcode"
Expand All @@ -26,4 +27,9 @@ <h3 class="primary-text m-0">
(keydown.control.s)="$event.preventDefault(); onSave()">
</ace-editor>

<textarea wrap="off"
*ngIf="isMobile"
class="hb-plain-text-editor align-self-end h-100 w-100 mb-3 mt-3"
[(ngModel)]="homebridgeConfig">
</textarea>
</div>
2 changes: 2 additions & 0 deletions ui/src/app/config/config.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { ConfigRestoreBackupComponent } from './config.restore-backup.component'
export class ConfigComponent implements OnInit {
@Input() homebridgeConfig;
public saveInProgress: boolean;
public isMobile: any = false;
public backupUrl: string;
public options: any = { printMargin: false };

Expand All @@ -32,6 +33,7 @@ export class ConfigComponent implements OnInit {
private modalService: NgbModal
) {
this.backupUrl = environment.apiBaseUrl + '/api/backup/config.json?token=' + this.$auth.user.token;
this.isMobile = this.$md.detect.mobile();

// remove editor gutter on small screen devices
if (this.$md.detect.phone()) {
Expand Down
15 changes: 15 additions & 0 deletions ui/src/scss/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ body {
padding-top: 5.5rem;
}

@media only screen and (max-width: 600px) {
body {
padding-top: 4rem;
}
}

#log-output {
bottom: 0;
top: 0;
Expand Down Expand Up @@ -127,6 +133,15 @@ body {
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
}

.hb-plain-text-editor {
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
border: none;
white-space: pre;
font-family: monospace;
overflow-wrap: normal;
overflow-x: scroll;
}

.status-circle {
color: #ffffff;
width: 40px;
Expand Down

0 comments on commit f1c5b84

Please sign in to comment.