docs(config): Markdown-Dokumentation für zentrale Konfigurationsdateien erstellt

- Dokumentationen für:
  - appVersion.js → appVersion.md
  - layers.js → layers.md
  - paths.js → paths.md
  - urls.js → urls.md
- Übersicht in README.md mit internen Links ergänzt
- Erklärt dynamische URL-Logik, Layer-Setup und Basispfadstruktur
This commit is contained in:
ISA
2025-05-27 15:20:07 +02:00
parent 2b79c6008c
commit 257341475c
7 changed files with 115 additions and 1 deletions

View File

@@ -1,2 +1,2 @@
// /config/appVersion
export const APP_VERSION = "1.1.193";
export const APP_VERSION = "1.1.194";

38
docs/config/README.md Normal file
View File

@@ -0,0 +1,38 @@
<!-- /docs/config/README.md -->
# ⚙️ Konfigurationsübersicht (/config)
Dieses Verzeichnis enthält zentrale Konfigurationsdateien, die das Verhalten der gesamten App steuern.
Hier sind die wichtigsten Dateien, ihre Aufgaben und Verlinkungen zur Dokumentation:
---
## 📦 [`appVersion.js`](./appVersion.md)
- Definiert die aktuelle Version der App (`APP_VERSION`)
- Wird z.B. im `VersionInfoModal` angezeigt
---
## 🗺️ [`layers.js`](./layers.md)
- Enthält alle Leaflet-Layergruppen für die Kartenanzeige
- Zentrale Steuerung der aktiven Layer: TALAS, GMA, Cisco, etc.
---
## 📁 [`paths.js`](./paths.md)
- Berechnet den Basis-Pfad aus `.env.local`
- Liefert `BASE_URL`, z.B. `/talas5`
---
## 🌐 [`urls.js`](./urls.md)
- Erzeugt dynamisch API- und Tile-URLs
- Verwendet `window.location.origin` → keine statischen Ports notwendig
---
Diese Konfiguration macht das Projekt flexibel für mehrere Hosting-Umgebungen.

16
docs/config/appVersion.md Normal file
View File

@@ -0,0 +1,16 @@
<!-- /docs/config/appVersion.md -->
# 📦 appVersion.js
Diese Datei exportiert die aktuelle App-Version, die an mehreren Stellen in der UI angezeigt werden kann z.B. im `VersionInfoModal`.
## Inhalt
```js
export const APP_VERSION = "1.1.193";
```
## Verwendung
- Im Footer oder Info-Fenster
- Vergleich von Client- vs. Serverversion

View File

@@ -1,3 +1,5 @@
<!-- /docs/config/config.md -->
# ⚙️ config.js zentrale Konfiguration und Umgebungssteuerung
## Zweck

21
docs/config/layers.md Normal file
View File

@@ -0,0 +1,21 @@
<!-- /docs/config/layers.md -->
# 🗺️ layers.js
Diese Datei definiert alle verfügbaren Leaflet-Layergruppen im Projekt.
Sie werden global als `MAP_LAYERS` exportiert und enthalten alle Systemtypen (TALAS, GMA, OTDR etc.).
## Struktur
```js
export const MAP_LAYERS = {
TALAS: new L.layerGroup(),
...
lineLayer: new L.LayerGroup(),
};
```
## Verwendung
- Initialisierung der Leaflet-Karte
- Zuweisung von Markern und Linien

19
docs/config/paths.md Normal file
View File

@@ -0,0 +1,19 @@
<!-- /docs/config/paths.md -->
# 📁 paths.js
Berechnet den sauberen `BASE_URL`-Pfad basierend auf `.env.local → NEXT_PUBLIC_BASE_PATH`.
Entfernt führende und abschließende Slashes.
## Beispiel
Wenn `NEXT_PUBLIC_BASE_PATH = "/talas5/"`, wird `BASE_URL = "/talas5"` gesetzt.
```js
const BASE_PATH = basePathRaw.replace(/^\/|\/$/g, "");
export const BASE_URL = BASE_PATH ? `/${BASE_PATH}` : "";
```
## Nutzung
- Für konsistente Pfadangaben im gesamten Projekt

18
docs/config/urls.md Normal file
View File

@@ -0,0 +1,18 @@
<!-- /docs/config/urls.md -->
# 🌐 urls.js
Diese Datei berechnet dynamisch URLs basierend auf `window.location.origin`.
Alle Endpunkte (API, Tiles, Server) werden ohne Port oder Hardcoding erzeugt.
## Exportierte Konstanten
- `BASE_URL``/api`
- `SERVER_URL` → Hostname ohne Port (für Links)
- `PROXY_TARGET` → z.B. `http://hostname:4000`
- `OFFLINE_TILE_LAYER` → Offline-Kachelpfad
- `MAP_TILES_LAYER` → Alias für `OFFLINE_TILE_LAYER`
## Hinweis
Alle Berechnungen erfolgen nur **clientseitig** (`typeof window !== "undefined"`).