@anchrd/intel-ui 0.48.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/feed/feed.tsx +26 -3
package/package.json
CHANGED
package/src/feed/feed.tsx
CHANGED
|
@@ -18,6 +18,21 @@ import { initials, useSessionUser } from "@/user-name/user-name.ts";
|
|
|
18
18
|
|
|
19
19
|
const PageSize = 30;
|
|
20
20
|
|
|
21
|
+
// How many steps of the trail a card shows.
|
|
22
|
+
//
|
|
23
|
+
// ⚠️ The LAST ones, not the first, and that is the whole decision (#758). A path answers "where does
|
|
24
|
+
// this sit", and the answer is at its end: `… / system / Kundenwissen` says where `Kunde A` lives,
|
|
25
|
+
// `Agenten / Anton Anchrd / sys…` says where the tree begins, which every card shares. Cutting from
|
|
26
|
+
// the front is what `truncate` does on its own, so this has to be decided here rather than left to
|
|
27
|
+
// CSS.
|
|
28
|
+
const TrailSteps = 2;
|
|
29
|
+
|
|
30
|
+
/** The tail of a trail, with a leading ellipsis where something was cut. */
|
|
31
|
+
export function shortTrail(titles: readonly string[]): string {
|
|
32
|
+
if (titles.length <= TrailSteps) return titles.join(" / ");
|
|
33
|
+
return `… / ${titles.slice(-TrailSteps).join(" / ")}`;
|
|
34
|
+
}
|
|
35
|
+
|
|
21
36
|
// Who to show. Only the first two reach the server; `people` is applied here because whether an
|
|
22
37
|
// actor is a machine is Gate's answer and arrives with the names, not with the events.
|
|
23
38
|
type Audience = "all" | "mine" | "people";
|
|
@@ -280,9 +295,17 @@ function FeedCard({
|
|
|
280
295
|
<span className="text-sm leading-snug">
|
|
281
296
|
{i18n.t(`feed.action.${event.action}`, { who, title: event.nodeTitle })}
|
|
282
297
|
</span>
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
298
|
+
{/* ⚠️ `min-w-0` is not decoration. A grid item defaults to `min-width: auto`, so without it
|
|
299
|
+
this row grows to whatever the path needs and pushes the button PAST the card's edge —
|
|
300
|
+
which is what a four-step path did on a phone. `truncate` below cannot save it either: it
|
|
301
|
+
shortens against the width it is given, and its parent was already too wide. */}
|
|
302
|
+
<span className="flex min-w-0 items-center justify-between gap-3">
|
|
303
|
+
<span
|
|
304
|
+
className="truncate text-xs text-muted-foreground"
|
|
305
|
+
// The whole path stays reachable where there is a pointer to rest.
|
|
306
|
+
title={event.path.map((step) => step.title).join(" / ")}
|
|
307
|
+
>
|
|
308
|
+
{shortTrail(event.path.map((step) => step.title))}
|
|
286
309
|
</span>
|
|
287
310
|
{/* ⚠️ A button, not a label. The whole point of the mark is getting there, and a span
|
|
288
311
|
carries no focus — so the keyboard requirement could not be met by a surface that had
|