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

add technical documentation for the frontend #223

Merged
merged 3 commits into from
Jun 11, 2024
Merged
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
99 changes: 99 additions & 0 deletions docs/development/frontend/technical documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Technical documentation

| | |
| -------------------- | -------------------------- |
| **Sprache** | **Typescript, HTML, SCSS** |
| **Framework** | **Angular** |
| **Version** | **17.0.8.** |
| **Packetverwaltung** | **npm** |

### Frontend Struktur

---

Die Struktur des Frontends entspricht der typischen Angular Anwendung (siehe [Doku](https://v17.angular.io/guide/file-structure))

Übersicht Verzeichnis Frontend:

```
frontend
└── src
├── app
| |
│ ├── components - Komponenten der Seite
│ │ ├── atoms
│ │ ├── organisms
| | └── pages
│ │
│ ├── pipes
│ │ ├── timer
│ │ ├── user-filter
│ │ └── ...
| |
│ ├── services
│ │ ├── event.service.ts
│ │ ├── loader.service.ts
│ │ └── ...
| |-- styles - Globale Design Regeln
| |
│ ├── app.component.ts
│ ├── app.module.ts
│ ├── app-routing.ts - Routing Konfiguration
│ ├── authenticated.guard.ts - AuthGuard
│ └── route-transition-animation.ts - Animationsregeln
└── assets - Statische Assets

```

Zusätlich befindet sich zu jeder Datei eine Testdatei.

### LoaderService

---

Um den Loader ein- und ausblenden zu können, wurde ein LoaderService implementiert. Dieser stellt für beide Aufgaben jeweils eine Methode bereit, die beim abrufen der Daten aufgerufen werden können.

#### Anwendungsbeispiel:

---

`loader.service.ts

```ts
 public isLoading = new BehaviorSubject<boolean>(false);
  constructor() {}
  show() {
    this.isLoading.next(true);
  }
  hide() {
    this.isLoading.next(false);
  }
```

`mainpage.component.ts`

```ts
constructor(private LoaderService: LoaderService) { }
  ngOnInit(): void {
    this.LoaderService.show();
    //Simulate a html request
    setTimeout(() => {
      this.LoaderService.hide();
    }, 500);

  }
```

`app.component.ts`

```ts
...
<app-loader *ngIf="isLoading" ></app-loader>
...
```

### Backend Kommunikation

---

Die Kommunikation mit dem Backend erfolgt über eine REST-API. Eine Service-Klasse sendet HTTP-Anfragen an das Backend, und die eingehenden Daten werden von den Komponenten genutzt. Der Service wird im Konstruktor der Komponenten aufgerufen.
Loading