Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display privacy policy in the burger menu #188

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
<a (click)="about()" clrDropdownItem
><cds-icon shape="help-info"></cds-icon> About</a
>
<a
[href]="privacyPolicyLink"
*ngIf="privacyPolicyLink"
clrDropdownItem
target="_blank"
>
<cds-icon shape="pop-out"></cds-icon> {{ privacyPolicyLinkName }}
</a>
<a (click)="logout()" clrDropdownItem
><cds-icon shape="logout"></cds-icon> Logout</a
>
Expand Down
13 changes: 13 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
'Hobbyfarm Project': 'https://github.com/hobbyfarm/hobbyfarm',
};

public privacyPolicyLink = '';
public privacyPolicyLinkName = '';

public themes = themes;
public motd = '';

Expand Down Expand Up @@ -153,12 +156,12 @@
const addAccessCode = this.route.snapshot.params['accesscode'];
if (addAccessCode) {
this.userService.addAccessCode(addAccessCode).subscribe({
next: (_s: ServerResponse) => {

Check warning on line 159 in src/app/app.component.ts

View workflow job for this annotation

GitHub Actions / Build

'_s' is defined but never used
this.accesscodes.push(addAccessCode);
this.setAccessCode(addAccessCode);
this.doHomeAccessCode(addAccessCode);
},
error: (_s: ServerResponse) => {

Check warning on line 164 in src/app/app.component.ts

View workflow job for this annotation

GitHub Actions / Build

'_s' is defined but never used
// failure
this.doHomeAccessCodeError(addAccessCode);
},
Expand Down Expand Up @@ -202,6 +205,16 @@
.subscribe((typedInput: TypedInput) => {
this.buttons = typedInput?.value ?? this.buttons;
});

this.typedSettingsService
.list('public')
.subscribe((typedInputs: Map<string, TypedInput>) => {
this.privacyPolicyLink =
typedInputs.get('registration-privacy-policy-link')?.value ?? '';
this.privacyPolicyLinkName =
typedInputs.get('registration-privacy-policy-linkname')?.value ??
'Privacy Policy';
});
}

private processToken(token: string) {
Expand Down Expand Up @@ -335,7 +348,7 @@

public doSaveSettings() {
this.settingsService.update(this.settingsForm.value).subscribe({
next: (_s: ServerResponse) => {

Check warning on line 351 in src/app/app.component.ts

View workflow job for this annotation

GitHub Actions / Build

'_s' is defined but never used
this.settingsModalOpened = false;
const theme: 'light' | 'dark' | 'system' =
this.settingsForm.controls['theme'].value;
Expand All @@ -354,7 +367,7 @@
}
}
},
error: (_s: ServerResponse) => {

Check warning on line 370 in src/app/app.component.ts

View workflow job for this annotation

GitHub Actions / Build

'_s' is defined but never used
setTimeout(() => (this.settingsModalOpened = false), 2000);
},
});
Expand Down