mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 13:01:00 +00:00
fix(nav): drop the access-level line from a record-switcher entry
Three lines in a 240 px menu: the name, the access level, the kind of record. The middle one truncated more often than it read, and it is what the warning banner states in full once you are inside the record, where it governs what the page lets you do. Two lines left, and the level stays on the row as `data-access-level` for the browser journeys. The switcher's own "Read only" / "Can add entries" strings had no other reader and leave all six bundles.
This commit is contained in:
1 parent
dc56f70961
commit
95988ee843
8 files changed
+22
-31
No files matched your search
@@ -313,6 +313,15 @@ test.describe("account sharing", () => {
|
||||
const entry = page.locator('[data-slot="account-switcher-entry"]');
|
||||
await expect(entry).toHaveCount(1);
|
||||
await expect(entry).toContainText(E2E_OWNER.username);
|
||||
// Two lines: the name and the kind of record. The access level used to
|
||||
// take a third and was truncated more often than it was read; it is what
|
||||
// the banner says once you are inside. The row still CARRIES the level as
|
||||
// an attribute, which is the positive control for the absence below —
|
||||
// without it, a renamed slot would make this read green.
|
||||
await expect(entry).toHaveAttribute("data-access-level", /.+/);
|
||||
await expect(entry).not.toContainText("Read only");
|
||||
await expect(entry).not.toContainText("Can add entries");
|
||||
await expect(entry).not.toContainText("change or remove what is in it");
|
||||
// The way home is in the same menu as the way in.
|
||||
await expect(
|
||||
page.locator('[data-slot="account-switcher-own"]'),
|
||||
|
||||
+1
-3
@@ -9677,9 +9677,7 @@
|
||||
},
|
||||
"switcher": {
|
||||
"label": "Akte öffnen",
|
||||
"ownRecord": "Meine eigene Akte",
|
||||
"readOnly": "Nur lesen",
|
||||
"canWrite": "Darf Einträge anlegen"
|
||||
"ownRecord": "Meine eigene Akte"
|
||||
},
|
||||
"switch": {
|
||||
"failed": "Die Akte konnte nicht geöffnet werden. Bitte noch einmal versuchen.",
|
||||
|
||||
+1
-3
@@ -9677,9 +9677,7 @@
|
||||
},
|
||||
"switcher": {
|
||||
"label": "Open a record",
|
||||
"ownRecord": "My own record",
|
||||
"readOnly": "Read only",
|
||||
"canWrite": "Can add entries"
|
||||
"ownRecord": "My own record"
|
||||
},
|
||||
"switch": {
|
||||
"failed": "Could not open that record. Please try again.",
|
||||
|
||||
+1
-3
@@ -9677,9 +9677,7 @@
|
||||
},
|
||||
"switcher": {
|
||||
"label": "Abrir un historial",
|
||||
"ownRecord": "Mi propio historial",
|
||||
"readOnly": "Solo lectura",
|
||||
"canWrite": "Puede añadir entradas"
|
||||
"ownRecord": "Mi propio historial"
|
||||
},
|
||||
"switch": {
|
||||
"failed": "No se pudo abrir ese historial. Inténtalo de nuevo.",
|
||||
|
||||
+1
-3
@@ -9677,9 +9677,7 @@
|
||||
},
|
||||
"switcher": {
|
||||
"label": "Ouvrir un dossier",
|
||||
"ownRecord": "Mon propre dossier",
|
||||
"readOnly": "Lecture seule",
|
||||
"canWrite": "Peut ajouter des entrées"
|
||||
"ownRecord": "Mon propre dossier"
|
||||
},
|
||||
"switch": {
|
||||
"failed": "Impossible d'ouvrir ce dossier. Veuillez réessayer.",
|
||||
|
||||
+1
-3
@@ -9677,9 +9677,7 @@
|
||||
},
|
||||
"switcher": {
|
||||
"label": "Apri una cartella",
|
||||
"ownRecord": "La mia cartella",
|
||||
"readOnly": "Sola lettura",
|
||||
"canWrite": "Può aggiungere voci"
|
||||
"ownRecord": "La mia cartella"
|
||||
},
|
||||
"switch": {
|
||||
"failed": "Non è stato possibile aprire quella cartella. Riprova.",
|
||||
|
||||
+1
-3
@@ -9677,9 +9677,7 @@
|
||||
},
|
||||
"switcher": {
|
||||
"label": "Otwórz kartę",
|
||||
"ownRecord": "Moja własna karta",
|
||||
"readOnly": "Tylko odczyt",
|
||||
"canWrite": "Może dodawać wpisy"
|
||||
"ownRecord": "Moja własna karta"
|
||||
},
|
||||
"switch": {
|
||||
"failed": "Nie udało się otworzyć tej karty. Spróbuj ponownie.",
|
||||
|
||||
@@ -101,11 +101,15 @@ export function AccountSwitcherMenuItems() {
|
||||
)
|
||||
}
|
||||
>
|
||||
{/* Two lines, not three. The access level had a line of its
|
||||
own here and it never fit — a 240 px menu truncated
|
||||
"Kann verwalten" as often as it showed it, and the entry
|
||||
still said which kind of record this is on the line below.
|
||||
The level is what the banner states once you are inside,
|
||||
where it governs what the page lets you do. It stays on
|
||||
the row as `data-access-level` for the browser journeys. */}
|
||||
<div className="flex min-w-0 flex-1 flex-col">
|
||||
<span className="truncate">{accountLabel(account)}</span>
|
||||
<span className="text-muted-foreground truncate text-xs">
|
||||
{accessLabel(presentation.access, t)}
|
||||
</span>
|
||||
<span className="text-muted-foreground truncate text-xs">
|
||||
{recordKindLabel(presentation.recordKind, t)}
|
||||
</span>
|
||||
@@ -122,16 +126,6 @@ export function AccountSwitcherMenuItems() {
|
||||
);
|
||||
}
|
||||
|
||||
function accessLabel(
|
||||
access: ReturnType<typeof resolveRecordPresentation>["access"],
|
||||
t: ReturnType<typeof useTranslations>["t"],
|
||||
): string {
|
||||
if (access === "manage") return t("recordSharing.row.canManage");
|
||||
return access === "view-and-add"
|
||||
? t("recordSharing.switcher.canWrite")
|
||||
: t("recordSharing.switcher.readOnly");
|
||||
}
|
||||
|
||||
function recordKindLabel(
|
||||
recordKind: ReturnType<typeof resolveRecordPresentation>["recordKind"],
|
||||
t: ReturnType<typeof useTranslations>["t"],
|
||||
|
||||
Reference in new issue
Block a user