feat(02-12): route scoped records to granted domains

- keep shared navigation independent of actor module preferences\n- open scoped records at their first allowed destination\n- announce record access and kind in doorway names
This commit is contained in:
Marc-André Bombeck committed 2026-08-06 05:02:37 +02:00
1 parent 34073cf8dc
commit 6c4dd2d96b
6 files changed
+77 -15

No files matched your search

@@ -161,7 +161,7 @@ describe("<LookingAfterCard>", () => {
});
expect(html).toMatch(
/aria-label="Open Managed profile&#x27;s record; Can read the record, add to it, and change or remove what is in it; Managed profile"/,
/aria-label="Open Managed profile&#x27;s record; Can read the record, add to it, and change or remove what is in it; Managed profile;/,
);
});
@@ -11,6 +11,7 @@ import {
resolveRecordPresentation,
type RecordPresentation,
} from "@/lib/navigation/record-presentation";
import { sharedRecordLandingHref } from "@/lib/navigation/shared-record";
import {
accountLabel,
type AccountAccessEntry,
@@ -83,6 +84,9 @@ export function LookingAfterCard() {
<ul className="divide-y">
{accounts.map((entry) => {
const presentation = resolveRecordPresentation(entry);
const level = levelLabel(entry, presentation, t);
const kind = recordKindLabel(entry, t);
const scope = scopeLabel(entry, t);
return (
<li key={entry.accountId}>
@@ -93,10 +97,20 @@ export function LookingAfterCard() {
data-access-level={presentation.access}
data-record-kind={presentation.recordKind}
disabled={switchAccount.isPending}
onClick={() => switchAccount.mutate(entry.accountId)}
aria-label={t("recordSharing.lookingAfter.open", {
name: accountLabel(entry),
})}
onClick={() =>
switchAccount.switchTo(
entry.accountId,
sharedRecordLandingHref(entry.sections),
)
}
aria-label={[
t("recordSharing.lookingAfter.open", {
name: accountLabel(entry),
}),
level,
kind,
scope,
].join("; ")}
className="hover:bg-accent/40 focus-visible:ring-ring/50 flex min-h-11 w-full items-center gap-3 rounded-md px-2 py-2 text-left transition-colors focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50"
>
<span className="min-w-0 flex-1">
@@ -104,13 +118,13 @@ export function LookingAfterCard() {
{accountLabel(entry)}
</span>
<span className="text-muted-foreground block truncate text-xs">
{levelLabel(entry, presentation, t)}
{level}
</span>
<span className="text-muted-foreground block truncate text-xs">
{recordKindLabel(entry, t)}
{kind}
</span>
<span className="text-muted-foreground block truncate text-xs">
{scopeLabel(entry, t)}
{scope}
</span>
</span>
{switchAccount.isPending && (