Skip to content

Commit

Permalink
Retreive about modal buttons from settings (hobbyfarm#185)
Browse files Browse the repository at this point in the history
* Retreive about modal buttons from settings

* Run prettier
  • Loading branch information
jggoebel authored Nov 22, 2023
1 parent 559157a commit 3984a85
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ <h3 class="modal-title">{{ aboutTitle }}</h3>
<p class="about-body">
{{ aboutBody }}
</p>
<ng-container *ngFor="let button of buttons">
<a href="{{ button.url }}" target="_blank">
<ng-container *ngFor="let button of buttons | keyvalue">
<a href="{{ button.value }}" target="_blank">
<button class="btn btn-sm btn-link">
{{ button.title }}
{{ button.key }}
<cds-icon shape="pop-out"></cds-icon>
</button>
</a>
Expand Down
15 changes: 9 additions & 6 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,9 @@ export class AppComponent implements OnInit {
public aboutBody =
this.Config.about?.body ||
'HobbyFarm is lovingly crafted by the HobbyFarm team';
public buttons = this.Config.about?.buttons || [
{
title: 'Hobbyfarm Project',
url: 'https://github.com/hobbyfarm/hobbyfarm',
},
];
public buttons = {
'Hobbyfarm Project': 'https://github.com/hobbyfarm/hobbyfarm',
};

public themes = themes;
public motd = '';
Expand Down Expand Up @@ -199,6 +196,12 @@ export class AppComponent implements OnInit {
.subscribe((typedInput: TypedInput) => {
this.motd = typedInput?.value ?? '';
});

this.typedSettingsService
.get('user-ui', 'aboutmodal-buttons')
.subscribe((typedInput: TypedInput) => {
this.buttons = typedInput?.value ?? this.buttons;
});
}

private processToken(token: string) {
Expand Down

0 comments on commit 3984a85

Please sign in to comment.