Added imprint & privacy to auth and improved getting url #251

This commit is contained in:
Sven Heidemann 2023-03-17 13:48:48 +01:00
parent 7be40ed236
commit 4420c0e11c
17 changed files with 194 additions and 104 deletions

View File

@ -21,8 +21,8 @@
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<a [href]="privacy" target="_blank">{{'footer.privacy' | translate}}</a> <button pButton label="{{'footer.privacy' | translate}}" class="btn text-btn" (click)="navigateToPrivacy()"></button>
<span> | </span> <span> | </span>
<a [href]="imprint" target="_blank">{{'footer.imprint' | translate}}</a> <button pButton label="{{'footer.imprint' | translate}}" class="btn text-btn" (click)="navigateToImprint()"></button>
</div> </div>
</footer> </footer>

View File

@ -14,8 +14,8 @@ import { throwError } from "rxjs";
export class FooterComponent implements OnInit { export class FooterComponent implements OnInit {
frontendVersion: SoftwareVersion = new SoftwareVersion("0", "0", "0"); public frontendVersion: SoftwareVersion = new SoftwareVersion("0", "0", "0");
backendVersion: SoftwareVersion = new SoftwareVersion("0", "0", "0"); public backendVersion: SoftwareVersion = new SoftwareVersion("0", "0", "0");
public privacy: string = ""; public privacy: string = "";
public imprint: string = ""; public imprint: string = "";
@ -27,8 +27,6 @@ export class FooterComponent implements OnInit {
) {} ) {}
ngOnInit(): void { ngOnInit(): void {
this.privacy = this.settings.getPrivacyURL();
this.imprint = this.settings.getImprintURL();
this.frontendVersion = this.settings.getWebVersion() ?? new SoftwareVersion('0', '0', '0'); this.frontendVersion = this.settings.getWebVersion() ?? new SoftwareVersion('0', '0', '0');
this.spinnerService.showSpinner(); this.spinnerService.showSpinner();
@ -47,4 +45,12 @@ export class FooterComponent implements OnInit {
}); });
} }
public navigateToPrivacy(): void {
window.open(this.settings.getPrivacyURL(), "_blank");
}
public navigateToImprint(): void {
window.open(this.settings.getImprintURL(), "_blank");
}
} }

View File

@ -7,6 +7,7 @@ import { AuthHeaderComponent } from './components/auth-header/auth-header.compon
import { ForgetPasswordComponent } from './components/forget-password/forget-password.component'; import { ForgetPasswordComponent } from './components/forget-password/forget-password.component';
import { LoginComponent } from './components/login/login.component'; import { LoginComponent } from './components/login/login.component';
import { RegistrationComponent } from './components/registration/registration.component'; import { RegistrationComponent } from './components/registration/registration.component';
import { AuthFooterComponent } from "./components/auth-footer/auth-footer.component";
@NgModule({ @NgModule({
@ -14,7 +15,8 @@ import { RegistrationComponent } from './components/registration/registration.co
ForgetPasswordComponent, ForgetPasswordComponent,
LoginComponent, LoginComponent,
RegistrationComponent, RegistrationComponent,
AuthHeaderComponent AuthHeaderComponent,
AuthFooterComponent
], ],
imports: [ imports: [
CommonModule, CommonModule,

View File

@ -0,0 +1,7 @@
<div class="auth-footer">
<div class="logo-button-wrapper">
<button pButton label="{{'footer.privacy' | translate}}" class="btn text-btn" (click)="navigateToPrivacy()"></button>
<span> | </span>
<button pButton label="{{'footer.imprint' | translate}}" class="btn text-btn" (click)="navigateToImprint()"></button>
</div>
</div>

View File

@ -0,0 +1,23 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { AuthFooterComponent } from './auth-footer.component';
describe('AuthFooterComponent', () => {
let component: AuthFooterComponent;
let fixture: ComponentFixture<AuthFooterComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AuthFooterComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(AuthFooterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,32 @@
import { Component, OnInit } from "@angular/core";
import { Router } from "@angular/router";
import { SettingsService } from "../../../../services/settings/settings.service";
@Component({
selector: "app-auth-footer",
templateUrl: "./auth-footer.component.html",
styleUrls: ["./auth-footer.component.scss"]
})
export class AuthFooterComponent implements OnInit {
private privacy: string = "";
private imprint: string = "";
constructor(
private settings: SettingsService
) {
}
ngOnInit(): void {
this.privacy = this.settings.getPrivacyURL();
this.imprint = this.settings.getImprintURL();
}
public navigateToPrivacy(): void {
window.open(this.settings.getPrivacyURL(), "_blank");
}
public navigateToImprint(): void {
window.open(this.settings.getImprintURL(), "_blank");
}
}

View File

@ -1,12 +1,10 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from "@angular/core";
import { Router } from '@angular/router'; import { Router } from "@angular/router";
import { TranslateService, LangChangeEvent } from '@ngx-translate/core'; import { TranslateService } from "@ngx-translate/core";
import { MenuItem, PrimeNGConfig } from 'primeng/api'; import { MenuItem, PrimeNGConfig } from "primeng/api";
import { catchError } from 'rxjs'; import { SettingsService } from "src/app/services/settings/settings.service";
import { AuthService } from 'src/app/services/auth/auth.service'; import { SpinnerService } from "src/app/services/spinner/spinner.service";
import { SettingsService } from 'src/app/services/settings/settings.service'; import { ThemeService } from "src/app/services/theme/theme.service";
import { SpinnerService } from 'src/app/services/spinner/spinner.service';
import { ThemeService } from 'src/app/services/theme/theme.service';
@Component({ @Component({
selector: 'app-auth-header', selector: 'app-auth-header',
@ -14,9 +12,8 @@ import { ThemeService } from 'src/app/services/theme/theme.service';
styleUrls: ['./auth-header.component.scss'] styleUrls: ['./auth-header.component.scss']
}) })
export class AuthHeaderComponent implements OnInit { export class AuthHeaderComponent implements OnInit {
langList: MenuItem[] = []; public langList: MenuItem[] = [];
themeList: MenuItem[] = []; public themeList: MenuItem[] = [];
userMenuList!: MenuItem[];
constructor( constructor(
private router: Router, private router: Router,
@ -27,12 +24,12 @@ export class AuthHeaderComponent implements OnInit {
private config: PrimeNGConfig private config: PrimeNGConfig
) { } ) { }
ngOnInit(): void { public ngOnInit(): void {
this.initMenuLists(); this.initMenuLists();
this.loadLang(); this.loadLang();
} }
initMenuLists(): void { private initMenuLists(): void {
this.langList = [ this.langList = [
{ {
label: 'English', command: () => { label: 'English', command: () => {
@ -58,16 +55,16 @@ export class AuthHeaderComponent implements OnInit {
}); });
} }
changeTheme(name: string): void { private changeTheme(name: string): void {
this.themeService.setTheme(name, true); this.themeService.setTheme(name, true);
} }
translate(lang: string) { private translate(lang: string) {
this.translateService.use(lang); this.translateService.use(lang);
this.translateService.get('primeng').subscribe(res => this.config.setTranslation(res)); this.translateService.get('primeng').subscribe(res => this.config.setTranslation(res));
} }
loadLang(): void { private loadLang(): void {
let lang = localStorage.getItem(`default_lang`); let lang = localStorage.getItem(`default_lang`);
if (!lang) { if (!lang) {
lang = 'en'; lang = 'en';
@ -76,7 +73,7 @@ export class AuthHeaderComponent implements OnInit {
this.translate(lang); this.translate(lang);
} }
setLang(lang: string): void { private setLang(lang: string): void {
localStorage.setItem(`default_lang`, lang); localStorage.setItem(`default_lang`, lang);
} }

View File

@ -60,4 +60,5 @@
</div> </div>
<app-auth-header></app-auth-header> <app-auth-header></app-auth-header>
<app-auth-footer></app-auth-footer>
</section> </section>

View File

@ -62,4 +62,5 @@
</div> </div>
<app-auth-header></app-auth-header> <app-auth-header></app-auth-header>
<app-auth-footer></app-auth-footer>
</section> </section>

View File

@ -82,4 +82,5 @@
</div> </div>
<app-auth-header></app-auth-header> <app-auth-header></app-auth-header>
<app-auth-footer></app-auth-footer>
</section> </section>

View File

@ -100,6 +100,9 @@ header {
} }
} }
.auth-footer {
}
.app { .app {
height: 100%; height: 100%;
display: flex; display: flex;
@ -474,6 +477,9 @@ footer {
.right { .right {
width: 50%; width: 50%;
text-align: right; text-align: right;
.p-button-label {
font-weight: unset !important;
}
} }
} }
@ -488,7 +494,8 @@ footer {
gap: 15px; gap: 15px;
.login-form-wrapper, .login-form-wrapper,
.auth-header { .auth-header,
.auth-footer {
width: 350px; width: 350px;
height: 450px; height: 450px;
@ -549,6 +556,11 @@ footer {
width: 350px; width: 350px;
height: 75px; height: 75px;
} }
.auth-footer {
width: 350px;
height: 75px;
}
} }
.input-field { .input-field {

View File

@ -231,8 +231,10 @@
background-color: $secondaryBackgroundColor; background-color: $secondaryBackgroundColor;
.login-form-wrapper, .login-form-wrapper,
.auth-header { .auth-header,
.auth-footer {
background-color: $primaryBackgroundColor; background-color: $primaryBackgroundColor;
color: $primaryTextColor !important;
.login-form { .login-form {
.input-field { .input-field {

View File

@ -231,8 +231,10 @@
background-color: $secondaryBackgroundColor; background-color: $secondaryBackgroundColor;
.login-form-wrapper, .login-form-wrapper,
.auth-header { .auth-header,
.auth-footer {
background-color: $primaryBackgroundColor; background-color: $primaryBackgroundColor;
color: $primaryTextColor !important;
.login-form { .login-form {
.input-field { .input-field {

View File

@ -235,8 +235,10 @@
background-color: $secondaryBackgroundColor; background-color: $secondaryBackgroundColor;
.login-form-wrapper, .login-form-wrapper,
.auth-header { .auth-header,
.auth-footer {
background-color: $primaryBackgroundColor; background-color: $primaryBackgroundColor;
color: $primaryTextColor !important;
.login-form { .login-form {
.input-field { .input-field {

View File

@ -231,8 +231,10 @@
background-color: $secondaryBackgroundColor; background-color: $secondaryBackgroundColor;
.login-form-wrapper, .login-form-wrapper,
.auth-header { .auth-header,
.auth-footer {
background-color: $primaryBackgroundColor; background-color: $primaryBackgroundColor;
color: $primaryTextColor !important;
.login-form { .login-form {
.input-field { .input-field {