Skip to content
Open
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
36 changes: 36 additions & 0 deletions src/app/_layout/app-footer/_app-footer-theme.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@use "@angular/material" as mat;
@use "sass:map";

@mixin color($theme) {
$color-config: map.get($theme, "color");
$primary: map.get($color-config, "primary");

.footer {
background-color: mat.m2-get-color-from-palette($primary, "default-contrast");
color: mat.m2-get-color-from-palette($primary);

a,
.toplink,
.footer-copy,
mat-icon {
color: mat.m2-get-color-from-palette($primary);

}

mat-toolbar {
background-color: mat.m2-get-color-from-palette($primary, "darker");
}

a {
color: mat.m2-get-color-from-palette($primary, "default-contrast");
}
}
}

@mixin theme($theme) {

// Check if the 'color' key exists in the theme map
@if map.has-key($theme, "color") {
@include color($theme);
}
}
33 changes: 33 additions & 0 deletions src/app/_layout/app-footer/app-footer.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<div class="footer">
<mat-toolbar class="mat-elevation-z1">
<span class="spacer"></span>

<span>
<h6>
<a
class="toplink"
href="{{ imprintUrl }}"
target="_blank"
rel="noopener"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 suggestion (security): Consider adding 'noreferrer' to rel attribute for external links.

This helps prevent referrer information from being shared with external sites.

Suggested change
rel="noopener"
rel="noopener noreferrer"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include the suggestion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely! To include the suggestion, update the rel attribute in your anchor tag as follows:

<a
  class="toplink"
  href="{{ imprintUrl }}"
  target="_blank"
  rel="noopener noreferrer"
>

This will ensure both security and privacy by preventing the new page from accessing the window object and by not sending referrer information. Let me know if you need help with anything else!

>
<mat-icon>description</mat-icon>
<span class="large-screen-text">Imprint</span>
</a>
</h6>
</span>

<span>
<h6>
<a
class="toplink"
href="{{ privacyUrl }}"
target="_blank"
rel="noopener"
>
<mat-icon>lock</mat-icon>
<span class="large-screen-text">Privacy</span>
</a>
</h6>
</span>
</mat-toolbar>
</div>
27 changes: 27 additions & 0 deletions src/app/_layout/app-footer/app-footer.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.footer {
// background: white;
// width: 100%;
// padding: 1rem;
// text-align: center;
Comment on lines +2 to +5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the commented lines


background-color: white;

mat-toolbar {
background: white !important;
height: 3.5rem;

.spacer {
flex: 1 1 auto;
}

.toplink {
padding: 0.5rem 1rem;
font: bold;
font-size: 11pt;

mat-icon {
vertical-align: middle;
}
}
}
}
21 changes: 21 additions & 0 deletions src/app/_layout/app-footer/app-footer.component.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';

Check failure on line 1 in src/app/_layout/app-footer/app-footer.component.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

Replace `'@angular/core/testing'` with `"@angular/core/testing"`

import { AppFooterComponent } from './app-footer.component';

Check failure on line 3 in src/app/_layout/app-footer/app-footer.component.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

Replace `'./app-footer.component'` with `"./app-footer.component"`

describe('AppFooterComponent', () => {

Check failure on line 5 in src/app/_layout/app-footer/app-footer.component.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

Replace `'AppFooterComponent'` with `"AppFooterComponent"`
let component: AppFooterComponent;
let fixture: ComponentFixture<AppFooterComponent>;

beforeEach(() => {
TestBed.configureTestingModule({
declarations: [AppFooterComponent]

Check failure on line 11 in src/app/_layout/app-footer/app-footer.component.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

Insert `,`
});
fixture = TestBed.createComponent(AppFooterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {

Check failure on line 18 in src/app/_layout/app-footer/app-footer.component.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

Replace `'should·create'` with `"should·create"`
expect(component).toBeTruthy();
});
});
24 changes: 24 additions & 0 deletions src/app/_layout/app-footer/app-footer.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Component, OnInit } from "@angular/core";
import { AppConfigService } from "app-config.service";

@Component({
selector: "app-app-footer",
templateUrl: "./app-footer.component.html",
styleUrls: ["./app-footer.component.scss"],
standalone: false,

Check warning on line 8 in src/app/_layout/app-footer/app-footer.component.ts

View workflow job for this annotation

GitHub Actions / eslint

Components, Directives and Pipes should not opt out of standalone
})
export class AppFooterComponent implements OnInit {
appConfig = this.appConfigService.getConfig();

imprintUrl = "";
privacyUrl = "";

constructor(public appConfigService: AppConfigService) { }

Check failure on line 16 in src/app/_layout/app-footer/app-footer.component.ts

View workflow job for this annotation

GitHub Actions / eslint

Delete `·`

ngOnInit() {
this.imprintUrl =
this.appConfig.imprintUrl || "https://example.com/imprint";
this.privacyUrl =
this.appConfig.privacyUrl || "https://example.com/privacy";
Comment on lines +19 to +22
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add explicit configuration option to enable/disable imprint and privacy

}
}
1 change: 1 addition & 0 deletions src/app/_layout/app-layout/app-layout.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
<div class="main">
<router-outlet></router-outlet>
</div>
<app-app-footer></app-app-footer>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we show the footer if nothing is shown in the footer

</div>
4 changes: 3 additions & 1 deletion src/app/_layout/layout.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
import { BatchCardModule } from "datasets/batch-card/batch-card.module";
import { BreadcrumbModule } from "shared/modules/breadcrumb/breadcrumb.module";
import { UsersModule } from "../users/users.module";
import { AppFooterComponent } from './app-footer/app-footer.component';

Check failure on line 15 in src/app/_layout/layout.module.ts

View workflow job for this annotation

GitHub Actions / eslint

Replace `'./app-footer/app-footer.component'` with `"./app-footer/app-footer.component"`

@NgModule({
declarations: [
AppLayoutComponent,
AppHeaderComponent,
AppMainLayoutComponent,
AppFooterComponent,
],
imports: [
CommonModule,
Expand All @@ -33,4 +35,4 @@
],
exports: [],
})
export class LayoutModule {}
export class LayoutModule { }

Check failure on line 38 in src/app/_layout/layout.module.ts

View workflow job for this annotation

GitHub Actions / eslint

Delete `·`
2 changes: 2 additions & 0 deletions src/app/app-config.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
multipleDownloadAction: "http://localhost:3012/zip",
multipleDownloadEnabled: true,
multipleDownloadUseAuthToken: false,
imprintUrl = "https://example.com/imprint",
privacyUrl = "https://example.com/privacy",
Comment on lines +58 to +59
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Assignment operator used instead of colon in object literal.

Please replace the equals sign with a colon to avoid syntax errors in the object literal.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change as suggested

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely! To fix the syntax error, update the appConfig object as follows:

const appConfig: AppConfigInterface = {
  multipleDownloadAction: "http://localhost:3012/zip",
  multipleDownloadEnabled: true,
  multipleDownloadUseAuthToken: false,
  imprintUrl: "https://example.com/imprint",
  privacyUrl: "https://example.com/privacy",
}

Just replace the equals signs (=) with colons (:) for imprintUrl and privacyUrl. This will resolve the issue.

oAuth2Endpoints: [],
policiesEnabled: true,
retrieveDestinations: [],
Expand Down Expand Up @@ -307,7 +309,7 @@

const mockHttpGet = (backendError = false) => {
spyOn(service["http"], "get").and.callFake(
(url: string): Observable<any> => {

Check warning on line 312 in src/app/app-config.service.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

Unexpected any. Specify a different type
if (url === "/api/v3/admin/config") {
if (backendError) {
return new Observable((sub) =>
Expand Down
2 changes: 2 additions & 0 deletions src/app/app-config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
datasetReduceEnabled: boolean;
datasetDetailsShowMissingProposalId: boolean;
datafilesActionsEnabled: boolean;
datafilesActions: any[];

Check warning on line 76 in src/app/app-config.service.ts

View workflow job for this annotation

GitHub Actions / eslint

Unexpected any. Specify a different type
editDatasetEnabled: boolean;
editDatasetSampleEnabled: boolean;
editMetadataEnabled: boolean;
Expand Down Expand Up @@ -143,9 +143,11 @@
mainMenu?: MainMenuConfiguration;
supportEmail?: string;
checkBoxFilterClickTrigger?: boolean;
imprintUrl?: string;
privacyUrl?: string;
Comment on lines +146 to +147
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add also explicit configuration options to enable/disable showing the imprint and the privacy.
Something like:

  • imprintEnable: true/false
  • privacyEnable: true/false

}

function isMainPageConfiguration(obj: any): obj is MainPageConfiguration {

Check warning on line 150 in src/app/app-config.service.ts

View workflow job for this annotation

GitHub Actions / eslint

Unexpected any. Specify a different type
const validKeys = Object.keys(MainPageOptions);
return (
obj &&
Expand Down Expand Up @@ -196,12 +198,12 @@
.pipe(timeout(2000))
.toPromise();
this.appConfig = Object.assign({}, this.appConfig, config);
} catch (err) {

Check warning on line 201 in src/app/app-config.service.ts

View workflow job for this annotation

GitHub Actions / eslint

'err' is defined but never used
console.log("No config available in backend, trying with local config.");
try {
const config = await this.mergeConfig();
this.appConfig = Object.assign({}, this.appConfig, config);
} catch (err) {

Check warning on line 206 in src/app/app-config.service.ts

View workflow job for this annotation

GitHub Actions / eslint

'err' is defined but never used
console.error("No config provided.");
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@use "@angular/material" as mat;
@use "./app/app-theme" as app;
@use "./app/_layout/app-header/app-header-theme" as app-header;
@use "./app/_layout/app-footer/app-footer-theme" as app-footer;
@use "./app/datasets/batch-view/batch-view-theme" as batch-view;
@use "./app/datasets/dashboard/dashboard-theme" as dashboard;
@use "./app/datasets/datafiles/datafiles-theme" as datafiles;
Expand Down Expand Up @@ -229,6 +230,7 @@ $theme: map.merge(
@include mat.all-component-themes($theme);
@include app.theme($theme);
@include app-header.theme($theme);
@include app-footer.theme($theme);
@include batch-view.theme($theme);
@include dashboard.theme($theme);
@include datafiles.theme($theme);
Expand Down
Loading