@estiva-app/ui 0.91.0 → 0.91.1
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/dist/AttachedCard.d.ts +2 -2
- package/dist/AttachedCard.d.ts.map +1 -1
- package/dist/Card.d.ts +4 -1
- package/dist/Card.d.ts.map +1 -1
- package/dist/LinkCard.d.ts.map +1 -1
- package/dist/LinkRow.d.ts +1 -1
- package/dist/LinkRow.d.ts.map +1 -1
- package/dist/PartCard.d.ts +10 -2
- package/dist/PartCard.d.ts.map +1 -1
- package/dist/ShowMore.d.ts +8 -3
- package/dist/ShowMore.d.ts.map +1 -1
- package/dist/index.js +64 -36
- package/dist/index.js.map +3 -3
- package/dist/linkedFrom.d.ts +5 -0
- package/dist/linkedFrom.d.ts.map +1 -1
- package/package.json +1 -1
- package/registry.json +26 -10
- package/src/AttachedCard.test.tsx +3 -3
- package/src/AttachedCard.tsx +5 -7
- package/src/Card.test.tsx +1 -1
- package/src/Card.tsx +5 -2
- package/src/CommentBox.test.tsx +1 -1
- package/src/LinkCard.mdx +5 -4
- package/src/LinkCard.stories.tsx +3 -0
- package/src/LinkCard.test.tsx +8 -2
- package/src/LinkCard.tsx +28 -21
- package/src/LinkChip.mdx +1 -1
- package/src/LinkChip.test.tsx +1 -1
- package/src/LinkChip.tsx +1 -1
- package/src/LinkRow.mdx +2 -2
- package/src/LinkRow.test.tsx +1 -1
- package/src/LinkRow.tsx +6 -7
- package/src/PartCard.mdx +2 -1
- package/src/PartCard.stories.tsx +24 -0
- package/src/PartCard.test.tsx +1 -1
- package/src/PartCard.tsx +21 -6
- package/src/ShowMore.mdx +4 -4
- package/src/ShowMore.tsx +11 -6
- package/src/linked.examples.ts +1 -1
- package/src/linkedFrom.test.tsx +55 -3
- package/src/linkedFrom.ts +46 -2
package/dist/linkedFrom.d.ts
CHANGED
|
@@ -67,6 +67,11 @@ export interface LinkedFromOptions<T extends LinkedSource = LinkedSource> {
|
|
|
67
67
|
onAct?: (actionId: string, value: string) => void;
|
|
68
68
|
/** What was said about it, when the app has read that. */
|
|
69
69
|
conversation?: LinkedConversation;
|
|
70
|
+
/**
|
|
71
|
+
* When it last changed, from interop's `changedAt` (in seconds), in the app's words. Without it a card says it the
|
|
72
|
+
* kit's way, alike in every app: "just now", "5m ago", "2h ago", "3d ago", then the date.
|
|
73
|
+
*/
|
|
74
|
+
whenOf?: (seconds: number) => string;
|
|
70
75
|
}
|
|
71
76
|
/** The file a reference names, as the kit's chip, row and card draw it. */
|
|
72
77
|
export declare function linkedFrom<T extends LinkedSource>(object: T, options: LinkedFromOptions<T>): Linked;
|
package/dist/linkedFrom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linkedFrom.d.ts","sourceRoot":"","sources":["../src/linkedFrom.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAe,kBAAkB,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"linkedFrom.d.ts","sourceRoot":"","sources":["../src/linkedFrom.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
package/registry.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"kind": "package",
|
|
5
5
|
"repo": "estiva-ui",
|
|
6
6
|
"package": "@estiva-app/ui",
|
|
7
|
-
"packageVersion": "0.91.
|
|
7
|
+
"packageVersion": "0.91.1",
|
|
8
8
|
"exports": 211,
|
|
9
9
|
"typeExports": 211,
|
|
10
10
|
"files": null
|
|
@@ -4983,7 +4983,7 @@
|
|
|
4983
4983
|
"name": "noun",
|
|
4984
4984
|
"takes": "text",
|
|
4985
4985
|
"required": true,
|
|
4986
|
-
"note": "What it is, in a word: \"Issue\". Drawn as \"Issue
|
|
4986
|
+
"note": "What it is, in a word: \"Issue\". Drawn as \"Issue not available\"."
|
|
4987
4987
|
},
|
|
4988
4988
|
{
|
|
4989
4989
|
"name": "openIn",
|
|
@@ -6241,7 +6241,7 @@
|
|
|
6241
6241
|
"name": "noun",
|
|
6242
6242
|
"takes": "text",
|
|
6243
6243
|
"required": false,
|
|
6244
|
-
"note": "What it is part of, in a word, for \"A part of this issue
|
|
6244
|
+
"note": "What it is part of, in a word, for \"A part of this issue not available\"."
|
|
6245
6245
|
},
|
|
6246
6246
|
{
|
|
6247
6247
|
"name": "openIn",
|
|
@@ -6254,6 +6254,18 @@
|
|
|
6254
6254
|
"takes": "anything",
|
|
6255
6255
|
"required": false,
|
|
6256
6256
|
"note": "The part's blocks, drawn by the app."
|
|
6257
|
+
},
|
|
6258
|
+
{
|
|
6259
|
+
"name": "action",
|
|
6260
|
+
"takes": "anything",
|
|
6261
|
+
"required": false,
|
|
6262
|
+
"note": "The way out to where the part lives: a small `Button` with a leading icon (\"Open in Leaf\")."
|
|
6263
|
+
},
|
|
6264
|
+
{
|
|
6265
|
+
"name": "maxHeight",
|
|
6266
|
+
"takes": "number",
|
|
6267
|
+
"required": false,
|
|
6268
|
+
"note": "Cut the blocks at this height, in px, behind ShowMore's fade and its Show more."
|
|
6257
6269
|
}
|
|
6258
6270
|
],
|
|
6259
6271
|
"variants": [
|
|
@@ -8224,9 +8236,9 @@
|
|
|
8224
8236
|
},
|
|
8225
8237
|
{
|
|
8226
8238
|
"name": "surface",
|
|
8227
|
-
"takes": "surface | inset",
|
|
8239
|
+
"takes": "surface | inset | elevated",
|
|
8228
8240
|
"required": false,
|
|
8229
|
-
"note": "
|
|
8241
|
+
"note": "inset card and a selected message included."
|
|
8230
8242
|
},
|
|
8231
8243
|
{
|
|
8232
8244
|
"name": "action",
|
|
@@ -8234,6 +8246,12 @@
|
|
|
8234
8246
|
"required": false,
|
|
8235
8247
|
"note": "A small muted `Button` with a leading icon, at the right of the toggle's row: the way out to where the content lives."
|
|
8236
8248
|
},
|
|
8249
|
+
{
|
|
8250
|
+
"name": "contentClassName",
|
|
8251
|
+
"takes": "text",
|
|
8252
|
+
"required": false,
|
|
8253
|
+
"note": "On the content alone, not the toggle's row under it: PartCard's quote bar runs beside the blocks only."
|
|
8254
|
+
},
|
|
8237
8255
|
{
|
|
8238
8256
|
"name": "className",
|
|
8239
8257
|
"takes": "text",
|
|
@@ -8246,7 +8264,8 @@
|
|
|
8246
8264
|
"prop": "surface",
|
|
8247
8265
|
"values": [
|
|
8248
8266
|
"surface",
|
|
8249
|
-
"inset"
|
|
8267
|
+
"inset",
|
|
8268
|
+
"elevated"
|
|
8250
8269
|
]
|
|
8251
8270
|
}
|
|
8252
8271
|
],
|
|
@@ -8257,10 +8276,7 @@
|
|
|
8257
8276
|
"storyId": "page-structure-showmore--long",
|
|
8258
8277
|
"docPage": "src/ShowMore.mdx",
|
|
8259
8278
|
"app": null,
|
|
8260
|
-
"looks": [
|
|
8261
|
-
"pointer-events-none bg-gradient-to-t to-transparent from-bg-surface",
|
|
8262
|
-
"pointer-events-none bg-gradient-to-t to-transparent from-bg-inset"
|
|
8263
|
-
]
|
|
8279
|
+
"looks": []
|
|
8264
8280
|
},
|
|
8265
8281
|
{
|
|
8266
8282
|
"name": "Sidebar",
|
|
@@ -18,7 +18,7 @@ describe('AttachedCard', () => {
|
|
|
18
18
|
const user = userEvent.setup()
|
|
19
19
|
const onRemove = vi.fn()
|
|
20
20
|
render(<AttachedCard link={ready(ITEM)} onRemove={onRemove} />)
|
|
21
|
-
await user.click(screen.getByRole('button', { name: 'Remove
|
|
21
|
+
await user.click(screen.getByRole('button', { name: 'Remove' }))
|
|
22
22
|
expect(onRemove).toHaveBeenCalledTimes(1)
|
|
23
23
|
})
|
|
24
24
|
|
|
@@ -28,13 +28,13 @@ describe('AttachedCard', () => {
|
|
|
28
28
|
render(<AttachedCard link={ready({ ...ITEM, conversation: undefined, status: undefined, owner: undefined })} onRemove={onRemove} />)
|
|
29
29
|
await user.tab()
|
|
30
30
|
await user.tab()
|
|
31
|
-
expect(document.activeElement).toBe(screen.getByRole('button', { name: 'Remove
|
|
31
|
+
expect(document.activeElement).toBe(screen.getByRole('button', { name: 'Remove' }))
|
|
32
32
|
await user.keyboard('{Enter}')
|
|
33
33
|
expect(onRemove).toHaveBeenCalledTimes(1)
|
|
34
34
|
})
|
|
35
35
|
|
|
36
36
|
it('has no ✕ for anyone but who wrote it', () => {
|
|
37
37
|
render(<AttachedCard link={ready(ITEM)} />)
|
|
38
|
-
expect(screen.queryByRole('button', { name: 'Remove
|
|
38
|
+
expect(screen.queryByRole('button', { name: 'Remove' })).toBeNull()
|
|
39
39
|
})
|
|
40
40
|
})
|
package/src/AttachedCard.tsx
CHANGED
|
@@ -8,11 +8,10 @@
|
|
|
8
8
|
* Oct, kickoff). Inside a box being written in, `CommentBox` places it with the
|
|
9
9
|
* files, and the card there reads as words on the files' fill (`inTheBox`).
|
|
10
10
|
*/
|
|
11
|
-
import {
|
|
11
|
+
import type { ReactNode } from 'react'
|
|
12
12
|
import { RemoveBadge } from './AttachmentCard'
|
|
13
13
|
import { LinkCard } from './LinkCard'
|
|
14
|
-
import {
|
|
15
|
-
import { inTheBox, type LinkState } from './linked'
|
|
14
|
+
import type { LinkState } from './linked'
|
|
16
15
|
|
|
17
16
|
interface AttachedCardBase {
|
|
18
17
|
/** Draws the ✕. Without it the card shows with none, as it does to anyone but the author. */
|
|
@@ -26,14 +25,13 @@ interface AttachedCardBase {
|
|
|
26
25
|
export type AttachedCardProps = AttachedCardBase & ({ link: LinkState; children?: never } | { link?: never; children: ReactNode })
|
|
27
26
|
|
|
28
27
|
export function AttachedCard({ link, children, onRemove }: AttachedCardProps) {
|
|
29
|
-
const boxed = useContext(inTheBox)
|
|
30
28
|
return (
|
|
31
|
-
// At most 480px
|
|
32
|
-
<div className=
|
|
29
|
+
// At most 480px, so it never runs a column's or a wide box's whole width (Katerina, 29 and 30 Oct).
|
|
30
|
+
<div className="group/card relative max-w-[480px]">
|
|
33
31
|
{link ? <LinkCard link={link} /> : children}
|
|
34
32
|
{onRemove && (
|
|
35
33
|
<RemoveBadge
|
|
36
|
-
label="Remove
|
|
34
|
+
label="Remove"
|
|
37
35
|
onRemove={onRemove}
|
|
38
36
|
className="opacity-0 group-hover/card:opacity-100 group-focus-within/card:opacity-100 focus-visible:opacity-100 [@media(hover:none)]:opacity-100"
|
|
39
37
|
/>
|
package/src/Card.test.tsx
CHANGED
|
@@ -31,7 +31,7 @@ describe('Card', () => {
|
|
|
31
31
|
})
|
|
32
32
|
|
|
33
33
|
it('the hairline follows the fill: default on surface and elevated, subtle on inset and none', () => {
|
|
34
|
-
const expected = { surface: ['bg-bg-surface', 'border-border-default'], elevated: ['bg-bg-elevated', 'border-border-default'], inset: ['bg-bg-
|
|
34
|
+
const expected = { surface: ['bg-bg-surface', 'border-border-default'], elevated: ['bg-bg-elevated', 'border-border-default'], inset: ['bg-bg-wash', 'border-border-subtle'], none: ['border-border-subtle'] } as const
|
|
35
35
|
for (const [fill, classes] of Object.entries(expected)) {
|
|
36
36
|
const actual = classesOf(card(<Card fill={fill as keyof typeof expected}>Item one</Card>))
|
|
37
37
|
for (const c of classes) expect(actual).toContain(c)
|
package/src/Card.tsx
CHANGED
|
@@ -12,7 +12,10 @@ import { Link } from './Link'
|
|
|
12
12
|
*
|
|
13
13
|
* - **The fill is chosen by what the card sits on**: `surface` on the page,
|
|
14
14
|
* `elevated` on something already filled, `inset` inside a message, `none`
|
|
15
|
-
* for a hairline alone.
|
|
15
|
+
* for a hairline alone. `inset` is the see-through wash, one step over
|
|
16
|
+
* whatever the message is drawn on: a selected or hovered message's fill
|
|
17
|
+
* shows through it, as an inline chip's does (Katerina, 30 Oct: a solid fill
|
|
18
|
+
* was as light as a selected message's tint, and the card melted into it).
|
|
16
19
|
* - **The hairline follows the fill**: the default hairline on `surface` and
|
|
17
20
|
* `elevated`, the subtle one on `inset` and `none`. Every card has 8px
|
|
18
21
|
* corners.
|
|
@@ -32,7 +35,7 @@ export type CardAttention = 'accent' | 'warning'
|
|
|
32
35
|
const FILL_CLASSES: Record<CardFill, string> = {
|
|
33
36
|
surface: 'bg-bg-surface border-border-default',
|
|
34
37
|
elevated: 'bg-bg-elevated border-border-default',
|
|
35
|
-
inset: 'bg-bg-
|
|
38
|
+
inset: 'bg-bg-wash border-border-subtle',
|
|
36
39
|
none: 'border-border-subtle',
|
|
37
40
|
}
|
|
38
41
|
|
package/src/CommentBox.test.tsx
CHANGED
|
@@ -373,7 +373,7 @@ describe('under the box: the one card, with ✕, and the live parts', () => {
|
|
|
373
373
|
}
|
|
374
374
|
},
|
|
375
375
|
})
|
|
376
|
-
const removeCard = () => act(async () => fireEvent.click(screen.getByRole('button', { name: 'Remove
|
|
376
|
+
const removeCard = () => act(async () => fireEvent.click(screen.getByRole('button', { name: 'Remove' })))
|
|
377
377
|
|
|
378
378
|
it('a draft naming one item shows its card under the box, and it is sent with the words', async () => {
|
|
379
379
|
const send = vi.fn<CommentBoxProps['send']>(async () => ({ accepted: true }))
|
package/src/LinkCard.mdx
CHANGED
|
@@ -11,10 +11,11 @@ A link's card: what a row cannot hold, and the changes the reader may make from
|
|
|
11
11
|
|
|
12
12
|
## When
|
|
13
13
|
|
|
14
|
-
- **ready** — it starts as its row does: its kind in a file's 36px tile, the title as the link on one line, cut short when long, and under it the key and what it is ("ABC-2 · Issue");
|
|
15
|
-
- **width** — at most 480px in a message
|
|
14
|
+
- **ready** — it starts as its row does: its kind in a file's 36px tile, the title as the link on one line, cut short when long, and under it the key and what it is ("ABC-2 · Issue"); on the title's line, at the right, its ring, its conversation count and its faces, in that order, as a row's. Then its summary, the items inside it in a box of their own, its newest conversation as a quote, and a footer: the pickers, or who wrote it and when. No summary, the title alone.
|
|
15
|
+
- **width** — at most 480px, in a message, a document and a box being written in alike; in a box it sits on the files' fill, its values as words until it is sent.
|
|
16
|
+
- **footer** — only when there is something for it: a title and a summary alone end at the summary.
|
|
16
17
|
- **read only** — a picker the app passed no `onChange` for reads as words in the same place: the reader may not change it. `readOnly` makes every value words, as the hover preview does.
|
|
17
|
-
- **words a person wrote** — their 24px face, their name, the time beside it as the link, and the words.
|
|
18
|
+
- **words a person wrote** — their 24px face, their name, the time beside it as the link (without a time, the name), and the words.
|
|
18
19
|
- **loading** — the card it will become in bars, at its own height: `shape` from `loadingShapeOf(linked)` the last time it drew, or the kind's usual card. **LinkCardLoading**, from this file.
|
|
19
20
|
- **unavailable** — one row, as **LinkRow** draws it.
|
|
20
21
|
|
|
@@ -45,7 +46,7 @@ const linked = {
|
|
|
45
46
|
- The picker offers only the options it is given: to let the reader set nobody as the owner, include an option for it.
|
|
46
47
|
- `linked.latest` is drawn whenever it is given: pass it only to a reader who may read it.
|
|
47
48
|
- `linked.conversation.unread` only for a member of it.
|
|
48
|
-
- **From interop's projection, build it with `linkStateFrom(object, unread, options)`** (or `linkedFrom` for a read object), so every app draws one thing as one card: its key, its 7 most recently changed items, a ring over all of them, and pickers through its own actions when `options.onAct` is passed (words once it is archived). The app passes `hrefOf(object, top)`, `previewText(body, people)` and, for a link not yet read, its kind and noun.
|
|
49
|
+
- **From interop's projection, build it with `linkStateFrom(object, unread, options)`** (or `linkedFrom` for a read object), so every app draws one thing as one card: its key, its 7 most recently changed items, a ring over all of them, and pickers through its own actions when `options.onAct` is passed (words once it is archived). When it last changed (`changedAt`) reads "2h ago", the same words in every app unless the app passes `whenOf`; who made it, the key its address is signed by, shows as a face when the app can name them and nothing else on the card names a person. The app passes `hrefOf(object, top)`, `previewText(body, people)` and, for a link not yet read, its kind and noun.
|
|
49
50
|
|
|
50
51
|
## What it owns
|
|
51
52
|
|
package/src/LinkCard.stories.tsx
CHANGED
|
@@ -40,6 +40,9 @@ export const WithItems: Story = { args: { link: ready(GROUP) } }
|
|
|
40
40
|
/** A place people talk: its members and its newest conversation. */
|
|
41
41
|
export const WithLatest: Story = { args: { link: ready(PLACE) } }
|
|
42
42
|
|
|
43
|
+
/** A title and a summary, nothing more, as a topic often is: no footer row, and no space where one would be. */
|
|
44
|
+
export const TitleAndSummary: Story = { args: { link: ready({ ...PLACE, members: undefined, latest: undefined, updated: undefined, conversation: undefined }) } }
|
|
45
|
+
|
|
43
46
|
/** A page of text: who wrote it, and when. */
|
|
44
47
|
export const WithAuthors: Story = { args: { link: ready(PAGE) } }
|
|
45
48
|
|
package/src/LinkCard.test.tsx
CHANGED
|
@@ -79,7 +79,7 @@ describe('LinkCard', () => {
|
|
|
79
79
|
)
|
|
80
80
|
expect(screen.getByText('Latest conversation')).toBeTruthy()
|
|
81
81
|
expect(screen.getByText(PLACE.latest!.body)).toBeTruthy()
|
|
82
|
-
expect(screen.getByText('
|
|
82
|
+
expect(screen.getByText('Updated 1d ago')).toBeTruthy()
|
|
83
83
|
})
|
|
84
84
|
|
|
85
85
|
it('draws a person’s words as theirs, with the time as the link', () => {
|
|
@@ -89,6 +89,12 @@ describe('LinkCard', () => {
|
|
|
89
89
|
expect(screen.getByRole('link', { name: '10:42' }).getAttribute('href')).toBe('#said')
|
|
90
90
|
})
|
|
91
91
|
|
|
92
|
+
it('links a person’s words by their name when there is no time, with no other word for it', () => {
|
|
93
|
+
render(<LinkCard link={ready({ ...SAID, updated: undefined })} />)
|
|
94
|
+
expect(screen.getByRole('link', { name: 'Person one' }).getAttribute('href')).toBe('#said')
|
|
95
|
+
expect(screen.queryByText('Open')).toBeNull()
|
|
96
|
+
})
|
|
97
|
+
|
|
92
98
|
it('while it loads, is busy and shows nothing of it', () => {
|
|
93
99
|
const { container } = render(<LinkCard link={LOADING} />)
|
|
94
100
|
expect(container.querySelector('[aria-busy="true"]')).not.toBeNull()
|
|
@@ -97,7 +103,7 @@ describe('LinkCard', () => {
|
|
|
97
103
|
|
|
98
104
|
it('says it is not available, and where it may still open', () => {
|
|
99
105
|
render(<LinkCard link={UNAVAILABLE} />)
|
|
100
|
-
expect(screen.getByText('Issue
|
|
106
|
+
expect(screen.getByText('Issue not available')).toBeTruthy()
|
|
101
107
|
expect(screen.getByRole('link', { name: /Open in App one/ }).getAttribute('href')).toBe('#elsewhere')
|
|
102
108
|
})
|
|
103
109
|
})
|
package/src/LinkCard.tsx
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* A link's card: what a row cannot hold. Look C (Katerina, 29 Oct): it starts
|
|
3
3
|
* as its row does, its kind in a file's 36px tile with the title and one line
|
|
4
|
-
* under it (its key and its kind's word),
|
|
4
|
+
* under it (its key and its kind's word), and on the title's line, at the right,
|
|
5
|
+
* its ring, its conversation count and its faces, in that order, as a row's;
|
|
5
6
|
* then its summary, the items inside it in a box of their own, the newest thing said
|
|
6
|
-
* in it as a quote, and a footer: the pickers and
|
|
7
|
-
* who and when. Words a person wrote draw as themselves: their face, their name
|
|
7
|
+
* in it as a quote, and a footer: the pickers, or who and when. Words a person wrote draw as themselves: their face, their name
|
|
8
8
|
* and the time beside it, then the words.
|
|
9
9
|
*
|
|
10
|
-
* At most 480px in a message
|
|
11
|
-
*
|
|
10
|
+
* At most 480px wide, in a message, a document and a box being written in alike
|
|
11
|
+
* (Katerina, 30 Oct: a card across a wide box did not look good); in a box it
|
|
12
|
+
* sits on the files' fill, its values as words until it is sent. While it
|
|
12
13
|
* loads it holds the card's own shape, so what is around it does not jump; not
|
|
13
14
|
* available is one row.
|
|
14
15
|
*/
|
|
@@ -44,7 +45,7 @@ export function LinkCard({ link, readOnly = false, bare = false }: LinkCardProps
|
|
|
44
45
|
const body = linked.kind === 'message' && linked.author ? <SaidBody linked={linked} /> : <CardBody linked={linked} readOnly={readOnly || boxed} />
|
|
45
46
|
if (bare) return <div className={CARD_CLASSES}>{body}</div>
|
|
46
47
|
return (
|
|
47
|
-
<Card fill={boxed ? 'elevated' : 'inset'} className={cn(CARD_CLASSES,
|
|
48
|
+
<Card fill={boxed ? 'elevated' : 'inset'} className={cn(CARD_CLASSES, 'max-w-[480px]')}>
|
|
48
49
|
{body}
|
|
49
50
|
</Card>
|
|
50
51
|
)
|
|
@@ -54,6 +55,8 @@ function CardBody({ linked, readOnly }: { linked: Linked; readOnly: boolean }) {
|
|
|
54
55
|
const boxed = useContext(inTheBox)
|
|
55
56
|
const on = boxed ? 'elevated' : 'inset'
|
|
56
57
|
const meta = linkMetaOf(linked)
|
|
58
|
+
// Only when there is something to put there: a topic with a summary alone drew an empty row, 36px of nothing (Katerina, 30 Oct).
|
|
59
|
+
const footed = Boolean(linked.status || linked.owner || linked.authors || linked.updated)
|
|
57
60
|
return (
|
|
58
61
|
<>
|
|
59
62
|
<div className="flex items-center gap-3">
|
|
@@ -67,10 +70,11 @@ function CardBody({ linked, readOnly }: { linked: Linked; readOnly: boolean }) {
|
|
|
67
70
|
</span>
|
|
68
71
|
{meta && <span className="truncate text-caption text-text-secondary">{meta}</span>}
|
|
69
72
|
</span>
|
|
70
|
-
{(linked.done || linked.members) && (
|
|
71
|
-
// On the title's line, not halfway down the header.
|
|
73
|
+
{(linked.done || linked.conversation || linked.members) && (
|
|
74
|
+
// On the title's line, not halfway down the header: the ring, the count, the faces, as a row's (Katerina, 30 Oct).
|
|
72
75
|
<span className="flex h-[19.6px] shrink-0 items-center gap-2 self-start">
|
|
73
76
|
{linked.done && <ProgressRing done={linked.done.done} total={linked.done.total} />}
|
|
77
|
+
{linked.conversation && <CommentCount conversation={linked.conversation} noun={linked.conversation.noun} />}
|
|
74
78
|
{linked.members && <AvatarGroup members={linked.members} size={16} on={on} />}
|
|
75
79
|
</span>
|
|
76
80
|
)}
|
|
@@ -110,40 +114,43 @@ function CardBody({ linked, readOnly }: { linked: Linked; readOnly: boolean }) {
|
|
|
110
114
|
</div>
|
|
111
115
|
</div>
|
|
112
116
|
)}
|
|
117
|
+
{footed && (
|
|
113
118
|
<div className="flex min-h-6 items-center gap-2">
|
|
114
119
|
{(linked.status || linked.owner) && <LinkPickers status={linked.status} owner={linked.owner} ownerLabel={linked.ownerLabel} readOnly={readOnly} />}
|
|
115
120
|
{/* Faces only: names would not fit once several people wrote it. */}
|
|
116
121
|
{linked.authors ? (
|
|
117
122
|
<span className="flex min-w-0 items-center gap-2 text-caption text-text-secondary">
|
|
118
123
|
<AvatarGroup members={linked.authors} size={16} on={on} />
|
|
119
|
-
{
|
|
124
|
+
{/* Italic, as every "Updated …" on a card is (Katerina, 30 Oct). */}
|
|
125
|
+
{linked.updated && <span className="shrink-0 italic">Updated {linked.updated}</span>}
|
|
120
126
|
</span>
|
|
121
127
|
) : (
|
|
122
128
|
!linked.status && !linked.owner && linked.updated && <span className="text-caption italic text-text-secondary">Updated {linked.updated}</span>
|
|
123
129
|
)}
|
|
124
|
-
{linked.conversation && (
|
|
125
|
-
<span className="ml-auto flex">
|
|
126
|
-
<CommentCount conversation={linked.conversation} noun={linked.conversation.noun} />
|
|
127
|
-
</span>
|
|
128
|
-
)}
|
|
129
130
|
</div>
|
|
131
|
+
)}
|
|
130
132
|
</>
|
|
131
133
|
)
|
|
132
134
|
}
|
|
133
135
|
|
|
134
|
-
/** Words a person wrote, linked: their face, their name, the time beside it as the link, and the words. */
|
|
136
|
+
/** Words a person wrote, linked: their face, their name, the time beside it as the link (without a time, the name), and the words. */
|
|
135
137
|
function SaidBody({ linked }: { linked: Linked }) {
|
|
136
138
|
const author = linked.author!
|
|
137
139
|
return (
|
|
138
140
|
<>
|
|
139
141
|
<div className="flex items-center gap-2">
|
|
140
142
|
<Avatar name={author.name} src={author.picture} size={24} />
|
|
141
|
-
|
|
142
|
-
<span className=
|
|
143
|
-
<Link href={linked.href} variant="quiet">
|
|
144
|
-
{linked.updated ?? 'Open'}
|
|
145
|
-
</Link>
|
|
143
|
+
{/* No "Open" in a missing time's place (Katerina, 30 Oct): the name is the link then. */}
|
|
144
|
+
<span className="text-body-2-strong text-text-primary">
|
|
145
|
+
{linked.updated ? author.name : <Link href={linked.href} variant="quiet">{author.name}</Link>}
|
|
146
146
|
</span>
|
|
147
|
+
{linked.updated && (
|
|
148
|
+
<span className={cn('text-caption text-text-muted', TIME_CLASSES)}>
|
|
149
|
+
<Link href={linked.href} variant="quiet">
|
|
150
|
+
{linked.updated}
|
|
151
|
+
</Link>
|
|
152
|
+
</span>
|
|
153
|
+
)}
|
|
147
154
|
</div>
|
|
148
155
|
<p className="line-clamp-4 text-body-2 text-text-secondary">{linked.body ?? linked.title}</p>
|
|
149
156
|
</>
|
|
@@ -172,7 +179,7 @@ export function LinkCardLoading({ kind, shape }: LinkCardLoadingProps) {
|
|
|
172
179
|
const boxed = useContext(inTheBox)
|
|
173
180
|
return (
|
|
174
181
|
<div className="animate-skeleton-in" aria-busy>
|
|
175
|
-
<Card fill={boxed ? 'elevated' : 'inset'} aria-hidden className={cn(CARD_CLASSES,
|
|
182
|
+
<Card fill={boxed ? 'elevated' : 'inset'} aria-hidden className={cn(CARD_CLASSES, 'max-w-[480px]')}>
|
|
176
183
|
<div className="flex items-center gap-3">
|
|
177
184
|
<span className={TYPE_TILE_CLASSES}>
|
|
178
185
|
<LinkedIcon kind={kind} />
|
package/src/LinkChip.mdx
CHANGED
|
@@ -13,7 +13,7 @@ A link in a sentence: its icon, its key, its title cut short, and its status as
|
|
|
13
13
|
|
|
14
14
|
- **ready** — a link the app has looked up. Hovering it shows its card (**LinkPreview**); a tap or a click opens it.
|
|
15
15
|
- **loading** — still being looked up: the icon, which the address already says, and a bar.
|
|
16
|
-
- **unavailable** — deleted, or not the reader's to see. Both say "Issue
|
|
16
|
+
- **unavailable** — deleted, or not the reader's to see. Both say "Issue not available" in the app's word for it.
|
|
17
17
|
- `preview={false}` — no card on hover, where a card would cover what the reader is choosing from.
|
|
18
18
|
|
|
19
19
|
<Canvas of={LinkChipStories.EachKind} />
|
package/src/LinkChip.test.tsx
CHANGED
|
@@ -59,7 +59,7 @@ describe('LinkChip', () => {
|
|
|
59
59
|
|
|
60
60
|
it('says “not available” in words, and leads nowhere', () => {
|
|
61
61
|
render(<LinkChip link={UNAVAILABLE} />)
|
|
62
|
-
expect(screen.getByText('Issue
|
|
62
|
+
expect(screen.getByText('Issue not available')).toBeTruthy()
|
|
63
63
|
expect(screen.queryByRole('link')).toBeNull()
|
|
64
64
|
})
|
|
65
65
|
|
package/src/LinkChip.tsx
CHANGED
|
@@ -33,7 +33,7 @@ export function LinkChip({ link, preview = true }: LinkChipProps) {
|
|
|
33
33
|
if (link.state === 'unavailable') {
|
|
34
34
|
return (
|
|
35
35
|
<InlineChip tone="muted" icon={<LinkedIcon kind={link.kind} size={14} tone="inherit" />}>
|
|
36
|
-
{link.noun}
|
|
36
|
+
{link.noun} not available
|
|
37
37
|
</InlineChip>
|
|
38
38
|
)
|
|
39
39
|
}
|
package/src/LinkRow.mdx
CHANGED
|
@@ -13,10 +13,10 @@ A link alone on its line: its kind in a file's tile, the title and its key under
|
|
|
13
13
|
|
|
14
14
|
- **ready** — its kind in the 36px tile a file's type has (**AttachmentCard**), the title as the link, and under it the key and what it is ("ABC-2 · Issue"), in the app's word for it, else its kind's. On the title's line: its status or its ring, its comment count, then the owner, members or authors at the far right. Hovering it shows its card; a tap opens it.
|
|
15
15
|
- **words a person wrote** — their face in the tile, their name with the time beside it, and the words under them.
|
|
16
|
-
- **width** — at most 480px in a
|
|
16
|
+
- **width** — at most 480px, in a box being written in too.
|
|
17
17
|
- **unread** — the count is brighter, with its dot.
|
|
18
18
|
- **loading** — the row in bars, in the row's own shape.
|
|
19
|
-
- **unavailable** — a row's shape, "Issue
|
|
19
|
+
- **unavailable** — a row's shape, "Issue not available", with where it may still open (`openIn`). This is also what a card draws when it is not available: **LinkUnavailable**, from this file.
|
|
20
20
|
|
|
21
21
|
<Canvas of={LinkRowStories.NotAvailable} />
|
|
22
22
|
|
package/src/LinkRow.test.tsx
CHANGED
|
@@ -33,6 +33,6 @@ describe('LinkRow', () => {
|
|
|
33
33
|
|
|
34
34
|
it('says it is not available in one line', () => {
|
|
35
35
|
render(<LinkRow link={UNAVAILABLE} />)
|
|
36
|
-
expect(screen.getByText('Issue
|
|
36
|
+
expect(screen.getByText('Issue not available')).toBeTruthy()
|
|
37
37
|
})
|
|
38
38
|
})
|
package/src/LinkRow.tsx
CHANGED
|
@@ -6,8 +6,7 @@
|
|
|
6
6
|
* card; a tap opens it. Loading draws the row in bars; not available says so
|
|
7
7
|
* in a row of the same shape.
|
|
8
8
|
*
|
|
9
|
-
* At most 480px
|
|
10
|
-
* written in it fills the box.
|
|
9
|
+
* At most 480px wide, as a card is, in a box being written in too.
|
|
11
10
|
*/
|
|
12
11
|
import { useContext } from 'react'
|
|
13
12
|
import { Avatar } from './Avatar'
|
|
@@ -23,7 +22,7 @@ import { SkeletonBar } from './Skeleton'
|
|
|
23
22
|
|
|
24
23
|
export interface LinkUnavailableProps {
|
|
25
24
|
kind: LinkedKind
|
|
26
|
-
/** What it is, in a word: "Issue". Drawn as "Issue
|
|
25
|
+
/** What it is, in a word: "Issue". Drawn as "Issue not available". */
|
|
27
26
|
noun: string
|
|
28
27
|
/** Where it may still open, for someone who can: its app and address. */
|
|
29
28
|
openIn?: { app: string; href: string }
|
|
@@ -43,11 +42,11 @@ const ROW_CLASSES = 'flex items-center gap-3 p-1.5 pr-3'
|
|
|
43
42
|
export function LinkUnavailable({ kind, noun, openIn, card = false }: LinkUnavailableProps) {
|
|
44
43
|
const wide = useContext(inTheBox)
|
|
45
44
|
return (
|
|
46
|
-
<Card fill={wide ? 'elevated' : 'inset'} className={cn(card ? 'flex items-center gap-3 p-3' : ROW_CLASSES,
|
|
45
|
+
<Card fill={wide ? 'elevated' : 'inset'} className={cn(card ? 'flex items-center gap-3 p-3' : ROW_CLASSES, 'max-w-[480px]')}>
|
|
47
46
|
<span className={TYPE_TILE_CLASSES}>
|
|
48
47
|
<LinkedIcon kind={kind} />
|
|
49
48
|
</span>
|
|
50
|
-
<span className="min-w-0 flex-1 truncate text-body-2 text-text-muted">{noun}
|
|
49
|
+
<span className="min-w-0 flex-1 truncate text-body-2 text-text-muted">{noun} not available</span>
|
|
51
50
|
{openIn && (
|
|
52
51
|
<span className="shrink-0 text-caption text-text-secondary">
|
|
53
52
|
<Link href={openIn.href} variant="quiet" external>
|
|
@@ -71,8 +70,8 @@ export interface LinkRowProps {
|
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
export function LinkRow({ link, preview = true }: LinkRowProps) {
|
|
74
|
-
|
|
75
|
-
const width =
|
|
73
|
+
// At most 480px, in a box being written in too (Katerina, 30 Oct).
|
|
74
|
+
const width = 'max-w-[480px]'
|
|
76
75
|
if (link.state === 'loading') {
|
|
77
76
|
return (
|
|
78
77
|
<div className="animate-skeleton-in" aria-busy>
|
package/src/PartCard.mdx
CHANGED
|
@@ -12,8 +12,9 @@ A part of something longer, shared live: its blocks as they are now, under the t
|
|
|
12
12
|
## When
|
|
13
13
|
|
|
14
14
|
- **ready** — what it is part of, as a card starts: its kind in a file's 36px tile, its title as the link, and "A part of ABC-2" under it; then the blocks the app draws as `children`, behind a quote bar that starts where the tile does. The apps draw the blocks with **RichText** `size="small"`.
|
|
15
|
+
- **with its way out** — `action`, a small `Button` ("Open in Leaf"), under the blocks at the right, outside the quote bar; with `maxHeight` a long part is cut behind Show more, the two level on one row.
|
|
15
16
|
- **loading** — at a card's height.
|
|
16
|
-
- **unavailable** — one row: "A part of this issue
|
|
17
|
+
- **unavailable** — one row: "A part of this issue not available", in the app's word for it, else its kind's.
|
|
17
18
|
|
|
18
19
|
## When not
|
|
19
20
|
|
package/src/PartCard.stories.tsx
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
+
import { IconExternalLink } from '@tabler/icons-react'
|
|
3
|
+
import { Button } from './Button'
|
|
2
4
|
import { PartCard } from './PartCard'
|
|
3
5
|
import { RichText, type RichTextBlock } from './RichText'
|
|
4
6
|
|
|
@@ -31,6 +33,28 @@ export const Default: Story = {
|
|
|
31
33
|
},
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
const LONG_BLOCKS: RichTextBlock[] = [
|
|
37
|
+
{ type: 'heading', level: 2, inline: [{ text: 'A heading in the part', marks: [] }] },
|
|
38
|
+
...Array.from({ length: 6 }, (_, i): RichTextBlock => ({ type: 'paragraph', inline: [{ text: `Paragraph ${i + 1} of the part, long enough to fill a line of the card and go on to a second one.`, marks: [] }] })),
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
/** As an app quotes a long part: cut behind Show more, and its way out ("Open in App one") level with it, under the quote bar, not beside it. */
|
|
42
|
+
export const WithItsWayOut: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
state: 'ready',
|
|
45
|
+
kind: 'page',
|
|
46
|
+
heading: 'Document one',
|
|
47
|
+
href: '#part',
|
|
48
|
+
maxHeight: 160,
|
|
49
|
+
action: (
|
|
50
|
+
<Button size="small" leadingIcon={<IconExternalLink stroke={1.5} className="size-3.5" />} onClick={() => {}}>
|
|
51
|
+
Open in App one
|
|
52
|
+
</Button>
|
|
53
|
+
),
|
|
54
|
+
children: <RichText blocks={LONG_BLOCKS} size="small" />,
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
|
|
34
58
|
/** Still being looked up. */
|
|
35
59
|
export const Loading: Story = { args: { state: 'loading', kind: 'issue' } }
|
|
36
60
|
|
package/src/PartCard.test.tsx
CHANGED
|
@@ -21,7 +21,7 @@ describe('PartCard', () => {
|
|
|
21
21
|
|
|
22
22
|
it('says a part is not available in words', () => {
|
|
23
23
|
render(<PartCard state="unavailable" kind="issue" noun="Issue" />)
|
|
24
|
-
expect(screen.getByText('A part of this issue
|
|
24
|
+
expect(screen.getByText('A part of this issue not available')).toBeTruthy()
|
|
25
25
|
})
|
|
26
26
|
|
|
27
27
|
it('while it loads, is busy and shows nothing of it', () => {
|