@openpeepshq/react 0.7.1 → 0.8.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.
Files changed (91) hide show
  1. package/dist/components/markdown/compileMarkdown.js +1 -0
  2. package/dist/components/navigation/FooterMobile.js +4 -3
  3. package/dist/components/navigation/HeaderMobile.js +5 -2
  4. package/dist/components/navigation/MobileMenuItem.d.ts +3 -1
  5. package/dist/components/navigation/MobileMenuItem.js +7 -2
  6. package/dist/components/navigation/NavWithTooltip.d.ts +9 -0
  7. package/dist/components/navigation/NavWithTooltip.js +4 -0
  8. package/dist/components/navigation/index.d.ts +2 -0
  9. package/dist/components/navigation/index.js +1 -0
  10. package/dist/components/navigation/sideBarNavLinkClass.d.ts +6 -4
  11. package/dist/components/navigation/sideBarNavLinkClass.js +6 -2
  12. package/dist/components/post/CompactReplyParent.js +5 -6
  13. package/dist/components/post/TruncatedMarkdown.d.ts +27 -0
  14. package/dist/components/post/TruncatedMarkdown.js +37 -0
  15. package/dist/components/post/helpers.d.ts +2 -2
  16. package/dist/components/post/helpers.js +3 -16
  17. package/dist/components/post/index.d.ts +2 -0
  18. package/dist/components/post/index.js +1 -0
  19. package/dist/components/post/pieces/EventLocation.js +14 -0
  20. package/dist/components/post/pieces/EventRsvpButton.js +3 -1
  21. package/dist/components/post/pieces/PollContent.js +8 -2
  22. package/dist/components/post/post-form/ArticleForm.js +1 -1
  23. package/dist/components/post/post-form/ComposeAttachments.d.ts +5 -1
  24. package/dist/components/post/post-form/ComposeAttachments.js +20 -6
  25. package/dist/components/post/post-form/ComposeAttachments.test.d.ts +1 -0
  26. package/dist/components/post/post-form/ComposeAttachments.test.js +131 -0
  27. package/dist/components/post/post-form/EventForm.js +23 -3
  28. package/dist/components/post/post-form/ResourceForm.d.ts +3 -1
  29. package/dist/components/post/post-form/ResourceForm.js +51 -7
  30. package/dist/components/post/post-form/VisibilitySelector.js +9 -3
  31. package/dist/components/post/types/Article.js +2 -3
  32. package/dist/components/post/types/Event.js +10 -1
  33. package/dist/components/post/types/resource/FullResource.js +3 -3
  34. package/dist/components/preview-link/local/WelcomePreview.js +4 -2
  35. package/dist/components/resources/ResourceCard.d.ts +5 -1
  36. package/dist/components/resources/ResourceCard.js +94 -37
  37. package/dist/components/resources/ResourceCard.test.d.ts +1 -0
  38. package/dist/components/resources/ResourceCard.test.js +75 -0
  39. package/dist/components/resources/ResourceLibrary.js +1 -1
  40. package/dist/hooks/events/useEventRsvp.d.ts +1 -0
  41. package/dist/hooks/events/useEventRsvp.js +15 -7
  42. package/dist/hooks/posts/useResourceComposer.d.ts +2 -0
  43. package/dist/hooks/posts/useResourceComposer.js +131 -25
  44. package/dist/hooks/resources/useResourceLibrary.d.ts +1 -1
  45. package/dist/hooks/resources/useResourceLibrary.js +6 -2
  46. package/dist/hooks/useWelcomePreview.d.ts +3 -0
  47. package/dist/hooks/useWelcomePreview.js +1 -0
  48. package/dist/navigation/menuItems.js +15 -0
  49. package/dist/navigation/targets.d.ts +2 -0
  50. package/dist/pages/admin/community/CommunityMarkdownPage.js +2 -1
  51. package/dist/pages/auth/Register.js +3 -1
  52. package/dist/pages/resources/Edit.js +3 -3
  53. package/dist/pages/resources/New.js +2 -2
  54. package/dist/pages/settings/Account.js +30 -2
  55. package/package.json +2 -2
  56. package/src/components/markdown/compileMarkdown.ts +1 -0
  57. package/src/components/navigation/FooterMobile.tsx +41 -33
  58. package/src/components/navigation/HeaderMobile.tsx +55 -41
  59. package/src/components/navigation/MobileMenuItem.tsx +15 -2
  60. package/src/components/navigation/NavWithTooltip.tsx +26 -0
  61. package/src/components/navigation/index.ts +2 -0
  62. package/src/components/navigation/sideBarNavLinkClass.ts +9 -6
  63. package/src/components/post/CompactReplyParent.tsx +17 -10
  64. package/src/components/post/TruncatedMarkdown.tsx +91 -0
  65. package/src/components/post/helpers.ts +4 -18
  66. package/src/components/post/index.ts +2 -0
  67. package/src/components/post/pieces/EventLocation.tsx +27 -0
  68. package/src/components/post/pieces/EventRsvpButton.tsx +3 -0
  69. package/src/components/post/pieces/PollContent.tsx +8 -2
  70. package/src/components/post/post-form/ArticleForm.tsx +1 -1
  71. package/src/components/post/post-form/ComposeAttachments.tsx +24 -3
  72. package/src/components/post/post-form/EventForm.tsx +43 -15
  73. package/src/components/post/post-form/ResourceForm.tsx +135 -4
  74. package/src/components/post/post-form/VisibilitySelector.tsx +11 -3
  75. package/src/components/post/types/Article.tsx +5 -5
  76. package/src/components/post/types/Event.tsx +68 -7
  77. package/src/components/post/types/resource/FullResource.tsx +9 -1
  78. package/src/components/preview-link/local/WelcomePreview.tsx +11 -2
  79. package/src/components/resources/ResourceCard.tsx +184 -62
  80. package/src/components/resources/ResourceLibrary.tsx +2 -2
  81. package/src/hooks/events/useEventRsvp.ts +19 -7
  82. package/src/hooks/posts/useResourceComposer.ts +157 -33
  83. package/src/hooks/resources/useResourceLibrary.ts +6 -2
  84. package/src/hooks/useWelcomePreview.ts +4 -0
  85. package/src/navigation/menuItems.ts +16 -0
  86. package/src/navigation/targets.ts +2 -0
  87. package/src/pages/admin/community/CommunityMarkdownPage.tsx +5 -1
  88. package/src/pages/auth/Register.tsx +12 -0
  89. package/src/pages/resources/Edit.tsx +3 -2
  90. package/src/pages/resources/New.tsx +6 -1
  91. package/src/pages/settings/Account.tsx +51 -1
@@ -51,6 +51,7 @@ export const EventForm = ({
51
51
  }: EventFormProps) => {
52
52
  const t = useT();
53
53
  const [audienceOpen, setAudienceOpen] = useState(false);
54
+ const [endBeforeStart, setEndBeforeStart] = useState(false);
54
55
  const {
55
56
  event,
56
57
  eventTimeZone,
@@ -140,7 +141,14 @@ export const EventForm = ({
140
141
  value={dateToInputValue(event.start, eventTimeZone)}
141
142
  onChange={(e) => {
142
143
  const start = toIso(e.target.value, eventTimeZone);
143
- if (start) patchEvent({ start });
144
+ if (start) {
145
+ if (event.end && new Date(event.end) <= new Date(start)) {
146
+ setEndBeforeStart(true);
147
+ } else {
148
+ setEndBeforeStart(false);
149
+ }
150
+ patchEvent({ start });
151
+ }
144
152
  }}
145
153
  data-testid="events-start-input"
146
154
  />
@@ -160,20 +168,40 @@ export const EventForm = ({
160
168
  </Label>
161
169
 
162
170
  {showEndDate ? (
163
- <Label
164
- title={t('events.form.endDate', { defaultValue: 'End Date' })}
165
- htmlFor="event-end"
166
- >
167
- <Input
168
- id="event-end"
169
- type="datetime-local"
170
- step={60}
171
- value={dateToInputValue(event.end, eventTimeZone)}
172
- onChange={(e) =>
173
- patchEvent({ end: toIso(e.target.value, eventTimeZone) })
174
- }
175
- />
176
- </Label>
171
+ <>
172
+ <Label
173
+ title={t('events.form.endDate', { defaultValue: 'End Date' })}
174
+ htmlFor="event-end"
175
+ >
176
+ <Input
177
+ id="event-end"
178
+ type="datetime-local"
179
+ step={60}
180
+ value={dateToInputValue(event.end, eventTimeZone)}
181
+ onChange={(e) => {
182
+ const newEnd = toIso(e.target.value, eventTimeZone);
183
+ if (
184
+ newEnd &&
185
+ event.start &&
186
+ new Date(newEnd) <= new Date(event.start)
187
+ ) {
188
+ setEndBeforeStart(true);
189
+ return;
190
+ }
191
+ setEndBeforeStart(false);
192
+ patchEvent({ end: newEnd });
193
+ }}
194
+ />
195
+ </Label>
196
+ {endBeforeStart ? (
197
+ <p className="text-destructive text-sm">
198
+ {t('events.form.endBeforeStart', {
199
+ defaultValue:
200
+ 'The end date and time must be after the start date and time.',
201
+ })}
202
+ </p>
203
+ ) : null}
204
+ </>
177
205
  ) : null}
178
206
 
179
207
  <Label
@@ -5,7 +5,12 @@ import type {
5
5
  ResourceKind,
6
6
  ResourcePost,
7
7
  } from '@openpeepshq/common/types';
8
- import { RESOURCE_KINDS, normalizeResourceTags } from '@openpeepshq/common/lib';
8
+ import {
9
+ RESOURCE_KINDS,
10
+ RESOURCE_TITLE_MAX_LENGTH,
11
+ normalizeResourceTags,
12
+ resourceFormIssues,
13
+ } from '@openpeepshq/common/lib';
9
14
  import { Button, Input, Label } from '@openpeepshq/react-ui';
10
15
  import { useT } from '../../../i18n';
11
16
  import { useCurrentProfile } from '../../layout/IdentityContext';
@@ -21,22 +26,31 @@ export interface ResourceFormProps {
21
26
  postData: PostCreationData;
22
27
  onChange: (data: PostCreationData) => void;
23
28
  isEdit?: boolean;
29
+ /** Member can post this resource only to a group. */
30
+ groupOnly?: boolean;
24
31
  }
25
32
 
26
33
  export const ResourceForm = ({
27
34
  postData,
28
35
  onChange,
29
36
  isEdit = false,
37
+ groupOnly = false,
30
38
  }: ResourceFormProps) => {
31
39
  const t = useT();
32
40
  const me = useCurrentProfile();
33
41
  const resource = postData.data as ResourcePost;
34
42
  const [audienceOpen, setAudienceOpen] = useState(false);
35
43
  const [tagDraft, setTagDraft] = useState('');
36
- const library = useResourceLibrary(postData.groupId ?? undefined);
44
+ const library = useResourceLibrary(
45
+ postData.groupId ?? undefined,
46
+ !postData.groupId,
47
+ );
37
48
  const attachments = useComposeAttachments({
38
49
  attachments: resource.attachments ?? [],
39
50
  onChange: (next) => patchResource({ attachments: next }),
51
+ // Only galleries take more than one file; other kinds pick one at a time.
52
+ multipleImages: resource.resourceKind === 'gallery',
53
+ multipleAudio: false,
40
54
  });
41
55
 
42
56
  const patchResource = (patch: Partial<ResourcePost>) => {
@@ -65,6 +79,26 @@ export const ResourceForm = ({
65
79
  }
66
80
  };
67
81
 
82
+ const issues = resourceFormIssues({
83
+ title: resource.title,
84
+ resourceKind: resource.resourceKind,
85
+ url: resource.url,
86
+ attachments: resource.attachments,
87
+ visibility: postData.visibility,
88
+ audience: postData.audience,
89
+ groupId: postData.groupId,
90
+ });
91
+ const titleMissing = issues.includes('title');
92
+ const titleTooLong = issues.includes('titleLength');
93
+ const urlIssue = issues.includes('url');
94
+ const urlInvalid = urlIssue && Boolean(resource.url?.trim());
95
+ const mediaMissing = issues.includes('media');
96
+ const audienceMissing = issues.includes('audience');
97
+ const groupMissing = issues.includes('group');
98
+ const urlMessage = t('resources.validation.url', {
99
+ defaultValue: 'Enter a real link, like https://example.com',
100
+ });
101
+
68
102
  const kindActions = useMemo(
69
103
  () => ({
70
104
  gallery: attachments.openImagePicker,
@@ -84,15 +118,51 @@ export const ResourceForm = ({
84
118
  </h2>
85
119
 
86
120
  <Label
87
- title={t('resources.form.name', { defaultValue: 'Title' })}
121
+ title={t('resources.form.nameRequired', {
122
+ defaultValue: 'Title (Required)',
123
+ })}
88
124
  htmlFor="resource-title"
89
125
  >
90
126
  <Input
91
127
  id="resource-title"
92
128
  data-testid="resources-title"
93
129
  value={resource.title}
130
+ maxLength={RESOURCE_TITLE_MAX_LENGTH}
131
+ aria-invalid={titleMissing || titleTooLong}
132
+ aria-describedby={
133
+ titleMissing
134
+ ? 'resource-title-error resource-title-count'
135
+ : 'resource-title-count'
136
+ }
94
137
  onChange={(event) => patchResource({ title: event.target.value })}
95
138
  />
139
+ {titleMissing ? (
140
+ <span
141
+ id="resource-title-error"
142
+ role="status"
143
+ className="text-muted-foreground mt-1 text-sm"
144
+ >
145
+ {t('resources.validation.titleRequired', {
146
+ defaultValue: 'Title is required',
147
+ })}
148
+ </span>
149
+ ) : null}
150
+ {titleTooLong ? (
151
+ <span role="alert" className="text-destructive mt-1 text-sm">
152
+ {t('resources.validation.titleTooLong', {
153
+ defaultValue: 'Title must be 200 characters or fewer',
154
+ })}
155
+ </span>
156
+ ) : null}
157
+ <span
158
+ id="resource-title-count"
159
+ className="block w-full px-2 text-right text-sm"
160
+ >
161
+ <span className={titleTooLong ? 'text-error' : undefined}>
162
+ {resource.title.length}
163
+ </span>{' '}
164
+ / {RESOURCE_TITLE_MAX_LENGTH}
165
+ </span>
96
166
  </Label>
97
167
 
98
168
  <div>
@@ -118,15 +188,39 @@ export const ResourceForm = ({
118
188
 
119
189
  {resource.resourceKind === 'link' ? (
120
190
  <Label
121
- title={t('resources.form.url', { defaultValue: 'URL' })}
191
+ title={t('resources.form.urlRequired', {
192
+ defaultValue: 'URL (Required)',
193
+ })}
122
194
  htmlFor="resource-url"
123
195
  >
124
196
  <Input
125
197
  id="resource-url"
126
198
  data-testid="resources-url"
127
199
  value={resource.url ?? ''}
200
+ placeholder={t('resources.form.urlPlaceholder', {
201
+ defaultValue: 'https://example.com',
202
+ })}
203
+ inputMode="url"
204
+ spellCheck={false}
205
+ error={urlInvalid}
206
+ aria-invalid={urlIssue}
207
+ aria-describedby={urlIssue ? 'resource-url-error' : undefined}
128
208
  onChange={(event) => patchResource({ url: event.target.value })}
129
209
  />
210
+ {urlIssue ? (
211
+ <span
212
+ id="resource-url-error"
213
+ role={urlInvalid ? 'alert' : 'status'}
214
+ data-testid="resources-url-error"
215
+ className={
216
+ urlInvalid
217
+ ? 'text-destructive mt-1 text-sm'
218
+ : 'text-muted-foreground mt-1 text-sm'
219
+ }
220
+ >
221
+ {urlMessage}
222
+ </span>
223
+ ) : null}
130
224
  </Label>
131
225
  ) : (
132
226
  <div className="space-y-2">
@@ -140,6 +234,13 @@ export const ResourceForm = ({
140
234
  </Button>
141
235
  {attachments.previews}
142
236
  {attachments.inputs}
237
+ {mediaMissing ? (
238
+ <p role="status" className="text-muted-foreground text-sm">
239
+ {t('resources.validation.mediaRequired', {
240
+ defaultValue: 'Add the media or link this resource needs',
241
+ })}
242
+ </p>
243
+ ) : null}
143
244
  </div>
144
245
  )}
145
246
 
@@ -217,6 +318,36 @@ export const ResourceForm = ({
217
318
  disabled={isEdit}
218
319
  showDirect
219
320
  />
321
+ {!isEdit && groupOnly ? (
322
+ <span role="status" className="text-muted-foreground mt-1 text-sm">
323
+ {t('resources.form.groupOnly', {
324
+ defaultValue: 'You can only share resources with a group.',
325
+ })}
326
+ </span>
327
+ ) : null}
328
+ {groupMissing ? (
329
+ <span
330
+ id="resource-group-error"
331
+ role="status"
332
+ className="text-muted-foreground mt-1 text-sm"
333
+ >
334
+ {t('resources.validation.groupRequired', {
335
+ defaultValue: 'Choose a group before creating this resource.',
336
+ })}
337
+ </span>
338
+ ) : null}
339
+ {audienceMissing ? (
340
+ <span
341
+ id="resource-audience-error"
342
+ role="status"
343
+ className="text-muted-foreground mt-1 text-sm"
344
+ >
345
+ {t('resources.validation.directAudience', {
346
+ defaultValue:
347
+ 'Choose at least one recipient for a direct resource.',
348
+ })}
349
+ </span>
350
+ ) : null}
220
351
  </Label>
221
352
  </div>
222
353
 
@@ -44,11 +44,19 @@ export const VisibilitySelector = ({
44
44
  const description = (visibility: string) =>
45
45
  audienceChoices.find((c) => c.value === visibility)?.description ?? '';
46
46
 
47
+ const choiceLabel = (visibility: string) =>
48
+ description(visibility) ||
49
+ (audienceChoices.length > 0
50
+ ? t('posts.form.chooseAudience', {
51
+ defaultValue: 'Choose who can see this',
52
+ })
53
+ : '');
54
+
47
55
  const content = () => {
48
56
  if (postData.visibility === 'group') {
49
57
  return (
50
58
  <span className="flex min-w-0 items-center gap-1 text-sm font-normal">
51
- <span className="shrink-0 pr-2">{description('group')}</span>
59
+ <span className="shrink-0 pr-2">{choiceLabel('group')}</span>
52
60
  {selectedGroup ? (
53
61
  <span className="flex min-w-0 items-center gap-1 truncate">
54
62
  <GroupAvatar group={selectedGroup} size={1.5} borderless />
@@ -63,7 +71,7 @@ export const VisibilitySelector = ({
63
71
  const audience = postData.audience ?? [];
64
72
  return (
65
73
  <span className="flex min-w-0 items-center gap-1 text-sm font-light">
66
- <span className="shrink-0 pr-2">{description('direct')}</span>
74
+ <span className="shrink-0 pr-2">{choiceLabel('direct')}</span>
67
75
  {audience.length ? (
68
76
  <span className="flex min-w-0 flex-wrap items-center gap-1">
69
77
  {audience.map((profile) => (
@@ -77,7 +85,7 @@ export const VisibilitySelector = ({
77
85
 
78
86
  return (
79
87
  <span className="text-sm font-light">
80
- {description(postData.visibility)}
88
+ {choiceLabel(postData.visibility)}
81
89
  </span>
82
90
  );
83
91
  };
@@ -2,8 +2,7 @@ import { ArrowRight } from 'lucide-react';
2
2
  import type { PublicPost } from '@openpeepshq/common/types';
3
3
  import { useT } from '../../../i18n';
4
4
  import { resolveStaticUrl, useStaticRender } from '../../markdown/staticRender';
5
- import { PostMarkdown } from '../Markdown';
6
- import { OPENPEEPS_POST_CAPTION_CLASS } from '../../markdown/classes';
5
+ import { TruncatedMarkdown } from '../TruncatedMarkdown';
7
6
  import { firstNWords } from '../helpers';
8
7
  import { minutesToRead } from '@openpeepshq/common/lib';
9
8
 
@@ -41,9 +40,10 @@ export function FeedArticle({ post }: FeedArticleProps) {
41
40
  </p>
42
41
  )}
43
42
  </div>
44
- <PostMarkdown
45
- source={`${previewContent}${showReadMore ? '...' : ''}`}
46
- className={OPENPEEPS_POST_CAPTION_CLASS}
43
+ <TruncatedMarkdown
44
+ source={article.content ?? ''}
45
+ snippet={previewContent}
46
+ interactive={false}
47
47
  />
48
48
  {showReadMore && (
49
49
  <div className="flex justify-end">
@@ -41,6 +41,72 @@ export function FeedEvent({ post }: FeedEventProps) {
41
41
  allDay: event.wholeDay,
42
42
  })
43
43
  : fmtRange(start, end);
44
+ const viewEventHref = resolveStaticUrl(
45
+ `/posts/${post.id}`,
46
+ staticRender ? baseUrl : undefined,
47
+ );
48
+
49
+ if (staticRender) {
50
+ return (
51
+ <table
52
+ role="presentation"
53
+ width="100%"
54
+ cellPadding={0}
55
+ cellSpacing={0}
56
+ style={{ width: '100%', borderCollapse: 'collapse' }}
57
+ >
58
+ <tbody>
59
+ {event.image ? (
60
+ <tr>
61
+ <td style={{ paddingBottom: '8px' }}>
62
+ <img
63
+ src={event.image}
64
+ alt={`image for ${event.name ?? 'event'}`}
65
+ width="100%"
66
+ style={{
67
+ display: 'block',
68
+ width: '100%',
69
+ maxWidth: '100%',
70
+ height: 'auto',
71
+ }}
72
+ />
73
+ </td>
74
+ </tr>
75
+ ) : null}
76
+ <tr>
77
+ <td className="text-destructive pb-2 text-sm">{when}</td>
78
+ </tr>
79
+ <tr>
80
+ <td className="pb-2 text-lg font-medium">{event.name}</td>
81
+ </tr>
82
+ {event.recurrence ? (
83
+ <tr>
84
+ <td className="text-muted-foreground pb-2 text-sm">
85
+ {formatEventRecurrence(event.recurrence, t, event.start)}
86
+ </td>
87
+ </tr>
88
+ ) : null}
89
+ {event.physicalLocation || event.jam || event.url ? (
90
+ <tr>
91
+ <td className="pb-2">
92
+ <EventLocation post={post} />
93
+ </td>
94
+ </tr>
95
+ ) : null}
96
+ <tr>
97
+ <td>
98
+ <a
99
+ href={viewEventHref}
100
+ className="text-primary text-sm underline"
101
+ >
102
+ {t('posts.event.viewEvent', { defaultValue: 'View Event' })}
103
+ </a>
104
+ </td>
105
+ </tr>
106
+ </tbody>
107
+ </table>
108
+ );
109
+ }
44
110
 
45
111
  return (
46
112
  <div className="flex w-full flex-col gap-2">
@@ -56,15 +122,10 @@ export function FeedEvent({ post }: FeedEventProps) {
56
122
  <div className="flex w-full items-center justify-between">
57
123
  <span className="text-destructive text-sm">
58
124
  {when}{' '}
59
- {staticRender ? null : (
60
- <span className="text-muted-foreground">(your local time)</span>
61
- )}
125
+ <span className="text-muted-foreground">(your local time)</span>
62
126
  </span>
63
127
  <Button
64
- action={resolveStaticUrl(
65
- `/posts/${post.id}`,
66
- staticRender ? baseUrl : undefined,
67
- )}
128
+ action={viewEventHref}
68
129
  variant="outline"
69
130
  compact
70
131
  className="shrink-0"
@@ -97,6 +97,8 @@ export const FullResource = ({ post }: FullResourceProps) => {
97
97
  return (
98
98
  <ResourceCard
99
99
  post={post}
100
+ showDescription={false}
101
+ inGroup={!!post.group}
100
102
  preview={
101
103
  <VideoPlayer
102
104
  attachment={videoAtt}
@@ -116,6 +118,8 @@ export const FullResource = ({ post }: FullResourceProps) => {
116
118
  return (
117
119
  <ResourceCard
118
120
  post={post}
121
+ showDescription={false}
122
+ inGroup={!!post.group}
119
123
  preview={
120
124
  <AudioAttachment
121
125
  src={audioAtt.url}
@@ -131,7 +135,11 @@ export const FullResource = ({ post }: FullResourceProps) => {
131
135
  // All kinds: ResourceCard with click overlay
132
136
  return (
133
137
  <div className="relative">
134
- <ResourceCard post={post} />
138
+ <ResourceCard
139
+ post={post}
140
+ showDescription={false}
141
+ inGroup={!!post.group}
142
+ />
135
143
  <div className="pointer-events-none absolute left-0 right-0 top-0 flex h-48 items-center justify-center">
136
144
  <div
137
145
  className="pointer-events-auto flex size-20 cursor-pointer items-center justify-center rounded-full bg-black/60 text-white"
@@ -1,7 +1,9 @@
1
1
  import { useWelcomePreview } from '../../../hooks/useWelcomePreview';
2
+ import { truncateMarkdown, stripMarkdownImages } from '@openpeepshq/common/lib';
3
+ import { TruncatedMarkdown } from '../../post/TruncatedMarkdown';
2
4
 
3
5
  export const WelcomePreview = () => {
4
- const { eyebrow, title, description, imageUrl, imageFit } =
6
+ const { eyebrow, title, description, markdown, imageUrl, imageFit } =
5
7
  useWelcomePreview();
6
8
 
7
9
  return (
@@ -25,7 +27,14 @@ export const WelcomePreview = () => {
25
27
  <p className="text-muted-foreground truncate text-xs">{eyebrow}</p>
26
28
  ) : null}
27
29
  <p className="line-clamp-2 font-semibold">{title}</p>
28
- {description ? (
30
+ {markdown ? (
31
+ <TruncatedMarkdown
32
+ source={markdown}
33
+ snippet={truncateMarkdown(stripMarkdownImages(markdown), 2, 240)}
34
+ maxLines={2}
35
+ className="break-words text-sm text-muted-foreground"
36
+ />
37
+ ) : description ? (
29
38
  <p className="text-muted-foreground line-clamp-3 break-words text-sm">
30
39
  {description}
31
40
  </p>