From fb2cd34e012df1033e34d2d13c6fa9b2559cfc6b Mon Sep 17 00:00:00 2001 From: FlorianSpeicher Date: Sun, 15 Jun 2025 17:06:04 +0200 Subject: [PATCH] Added logged in username display --- 00-backend/datasource/database.sqlite | Bin 2727936 -> 2727936 bytes .../public/locales/de/translation.json | 3 ++- .../public/locales/en/translation.json | 3 ++- 01-frontend/src/helper/navbar/NavBar.tsx | 15 +++++++++++++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/00-backend/datasource/database.sqlite b/00-backend/datasource/database.sqlite index 073b1b4a17bf267125c6039a99eb45c58f64af4b..246d0e038c1dcec972b7894d519398bc0ec8182a 100644 GIT binary patch delta 314 zcmZ9^zb^xE9LDkcUVG@_K8MnB=eIi1MwgCEBnTinod_MP_~HYKjfmR!oaJjkBpWl0*6l6c9jcp-_j Vp3R^yrdo&l$*NaMR%b5W{s1l_bVvXI delta 314 zcmZ9FJuCxp9ER_&N?Urr!&R$ysE<04#?YCN2$Mw8MA8PyyI4e+3>K-#>uX}F$wVVW z7%FF?5wTWcuyqil#K3|`G&Y83dXneK7V|1wVaHO*U3)|&S3xMEitrHCgqNrxY6&0V zCjvwrQBMR3oe;tx8i+=si7<%}(M*Ji2+=}B35&3aR-%n)Ct^eg(Mfa>-9((|xqx$U z7V(Lp$&=hlUN&V;#-(2j{Yx*q_PKMZ5A@BaR#a}=oc^`~UM=DE&+b33r`|@#u9ls_ zr9v#Ka$BDt50?K|-UXwt<)MjV_wZygw3sulo%hNhqsfAt%A?%Kn(WDoWPAmE#+pd8|jkcrc1p?_dk(nZT$cM diff --git a/01-frontend/public/locales/de/translation.json b/01-frontend/public/locales/de/translation.json index 92ff8fe..4332fc3 100644 --- a/01-frontend/public/locales/de/translation.json +++ b/01-frontend/public/locales/de/translation.json @@ -107,5 +107,6 @@ "discount100": "Rabatt in %", "deleteProduct": "Produkt löschen", "description": "Beschreibung", - "images": "Bilder" + "images": "Bilder", + "loggedInAs": "Angemeldet als" } diff --git a/01-frontend/public/locales/en/translation.json b/01-frontend/public/locales/en/translation.json index 83d0cad..faa6f6a 100644 --- a/01-frontend/public/locales/en/translation.json +++ b/01-frontend/public/locales/en/translation.json @@ -107,5 +107,6 @@ "discount100": "Discount in %", "deleteProduct": "Delete Product", "description": "Description", - "images": "Images" + "images": "Images", + "loggedInAs": "Logged in as" } \ No newline at end of file diff --git a/01-frontend/src/helper/navbar/NavBar.tsx b/01-frontend/src/helper/navbar/NavBar.tsx index f590119..eaac097 100644 --- a/01-frontend/src/helper/navbar/NavBar.tsx +++ b/01-frontend/src/helper/navbar/NavBar.tsx @@ -43,6 +43,11 @@ export default function NavBar() { const pages = pageKeys.map(key => ({ key, label: t(key) })); const settings = user ? [ + { + key: 'email', + label: `${t('loggedInAs')}: ${user.email}`, + disabled: true // wir nutzen dieses Flag gleich zur Erkennung + }, { key: 'account', label: t('account') }, { key: 'orders', label: t('orders') }, { key: 'logout', label: t('logout') } @@ -234,8 +239,14 @@ export default function NavBar() { open={Boolean(anchorElUser)} onClose={() => setAnchorElUser(null)} > - {settings.map(({ key, label }) => ( - handleCloseUserMenu(key)}> + {settings.map(({ key, label, disabled }) => ( + { + if (!disabled) handleCloseUserMenu(key); + }} + disabled={disabled} + > {label} ))}