@openpeepshq/react 0.7.1 → 0.8.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/dist/components/markdown/compileMarkdown.js +1 -0
- package/dist/components/navigation/FooterMobile.js +4 -3
- package/dist/components/navigation/HeaderMobile.js +5 -2
- package/dist/components/navigation/MobileMenuItem.d.ts +3 -1
- package/dist/components/navigation/MobileMenuItem.js +7 -2
- package/dist/components/navigation/NavWithTooltip.d.ts +9 -0
- package/dist/components/navigation/NavWithTooltip.js +4 -0
- package/dist/components/navigation/index.d.ts +2 -0
- package/dist/components/navigation/index.js +1 -0
- package/dist/components/navigation/sideBarNavLinkClass.d.ts +6 -4
- package/dist/components/navigation/sideBarNavLinkClass.js +6 -2
- package/dist/components/post/CompactReplyParent.js +5 -6
- package/dist/components/post/TruncatedMarkdown.d.ts +27 -0
- package/dist/components/post/TruncatedMarkdown.js +37 -0
- package/dist/components/post/helpers.d.ts +2 -2
- package/dist/components/post/helpers.js +3 -16
- package/dist/components/post/index.d.ts +2 -0
- package/dist/components/post/index.js +1 -0
- package/dist/components/post/pieces/EventLocation.js +14 -0
- package/dist/components/post/pieces/EventRsvpButton.js +3 -1
- package/dist/components/post/pieces/PollContent.js +8 -2
- package/dist/components/post/post-form/ArticleForm.js +1 -1
- package/dist/components/post/post-form/EventForm.js +23 -3
- package/dist/components/post/post-form/ResourceForm.d.ts +3 -1
- package/dist/components/post/post-form/ResourceForm.js +48 -7
- package/dist/components/post/post-form/VisibilitySelector.js +9 -3
- package/dist/components/post/types/Article.js +2 -3
- package/dist/components/post/types/Event.js +10 -1
- package/dist/components/post/types/resource/FullResource.js +3 -3
- package/dist/components/preview-link/local/WelcomePreview.js +4 -2
- package/dist/components/resources/ResourceCard.d.ts +5 -1
- package/dist/components/resources/ResourceCard.js +29 -5
- package/dist/components/resources/ResourceCard.test.d.ts +1 -0
- package/dist/components/resources/ResourceCard.test.js +75 -0
- package/dist/components/resources/ResourceLibrary.js +1 -1
- package/dist/hooks/events/useEventRsvp.d.ts +1 -0
- package/dist/hooks/events/useEventRsvp.js +15 -7
- package/dist/hooks/posts/useResourceComposer.d.ts +2 -0
- package/dist/hooks/posts/useResourceComposer.js +131 -25
- package/dist/hooks/resources/useResourceLibrary.d.ts +1 -1
- package/dist/hooks/resources/useResourceLibrary.js +6 -2
- package/dist/hooks/useWelcomePreview.d.ts +3 -0
- package/dist/hooks/useWelcomePreview.js +1 -0
- package/dist/navigation/menuItems.js +15 -0
- package/dist/navigation/targets.d.ts +2 -0
- package/dist/pages/admin/community/CommunityMarkdownPage.js +2 -1
- package/dist/pages/auth/Register.js +3 -1
- package/dist/pages/resources/Edit.js +3 -3
- package/dist/pages/resources/New.js +2 -2
- package/dist/pages/settings/Account.js +30 -2
- package/package.json +2 -2
- package/src/components/markdown/compileMarkdown.ts +1 -0
- package/src/components/navigation/FooterMobile.tsx +41 -33
- package/src/components/navigation/HeaderMobile.tsx +55 -41
- package/src/components/navigation/MobileMenuItem.tsx +15 -2
- package/src/components/navigation/NavWithTooltip.tsx +26 -0
- package/src/components/navigation/index.ts +2 -0
- package/src/components/navigation/sideBarNavLinkClass.ts +9 -6
- package/src/components/post/CompactReplyParent.tsx +17 -10
- package/src/components/post/TruncatedMarkdown.tsx +91 -0
- package/src/components/post/helpers.ts +4 -18
- package/src/components/post/index.ts +2 -0
- package/src/components/post/pieces/EventLocation.tsx +27 -0
- package/src/components/post/pieces/EventRsvpButton.tsx +3 -0
- package/src/components/post/pieces/PollContent.tsx +8 -2
- package/src/components/post/post-form/ArticleForm.tsx +1 -1
- package/src/components/post/post-form/EventForm.tsx +43 -15
- package/src/components/post/post-form/ResourceForm.tsx +132 -4
- package/src/components/post/post-form/VisibilitySelector.tsx +11 -3
- package/src/components/post/types/Article.tsx +5 -5
- package/src/components/post/types/Event.tsx +68 -7
- package/src/components/post/types/resource/FullResource.tsx +9 -1
- package/src/components/preview-link/local/WelcomePreview.tsx +11 -2
- package/src/components/resources/ResourceCard.tsx +68 -10
- package/src/components/resources/ResourceLibrary.tsx +2 -2
- package/src/hooks/events/useEventRsvp.ts +19 -7
- package/src/hooks/posts/useResourceComposer.ts +157 -33
- package/src/hooks/resources/useResourceLibrary.ts +6 -2
- package/src/hooks/useWelcomePreview.ts +4 -0
- package/src/navigation/menuItems.ts +16 -0
- package/src/navigation/targets.ts +2 -0
- package/src/pages/admin/community/CommunityMarkdownPage.tsx +5 -1
- package/src/pages/auth/Register.tsx +12 -0
- package/src/pages/resources/Edit.tsx +3 -2
- package/src/pages/resources/New.tsx +6 -1
- package/src/pages/settings/Account.tsx +51 -1
|
@@ -11,7 +11,10 @@ export type WelcomePreviewContent = {
|
|
|
11
11
|
/** Short label above the title. Omitted when it would repeat the title. */
|
|
12
12
|
eyebrow?: string;
|
|
13
13
|
title: string;
|
|
14
|
+
/** Plain-text excerpt (image-stripped) for non-markdown consumers / fallback. */
|
|
14
15
|
description: string;
|
|
16
|
+
/** Raw welcome markdown (image-bearing) for markdown rendering + overlays. */
|
|
17
|
+
markdown: string;
|
|
15
18
|
imageUrl?: string;
|
|
16
19
|
imageFit: 'cover' | 'contain';
|
|
17
20
|
};
|
|
@@ -51,6 +54,7 @@ export const useWelcomePreview = (
|
|
|
51
54
|
: t('welcome.defaultIntro', {
|
|
52
55
|
defaultValue: 'Welcome to this community, hosted on AllPeep.',
|
|
53
56
|
}),
|
|
57
|
+
markdown: configured,
|
|
54
58
|
imageUrl: markdownImage || logo || undefined,
|
|
55
59
|
imageFit: markdownImage ? 'cover' : 'contain',
|
|
56
60
|
};
|
|
@@ -5,6 +5,8 @@ export type MainMenuCapabilities = {
|
|
|
5
5
|
showAdmin: boolean;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
+
const navTooltip = (id: string) => `navigation.tooltips.${id}` as const;
|
|
9
|
+
|
|
8
10
|
/** Default main-menu targets for hosts to render with their own icons/labels. */
|
|
9
11
|
export const buildMainNavItems = (caps: MainMenuCapabilities): NavItemDef[] => {
|
|
10
12
|
const items: NavItemDef[] = [
|
|
@@ -12,24 +14,28 @@ export const buildMainNavItems = (caps: MainMenuCapabilities): NavItemDef[] => {
|
|
|
12
14
|
id: 'community',
|
|
13
15
|
target: { type: 'feed', feed: 'local' },
|
|
14
16
|
labelKey: 'navigation.community',
|
|
17
|
+
tooltipKey: navTooltip('community'),
|
|
15
18
|
icon: 'Home',
|
|
16
19
|
},
|
|
17
20
|
{
|
|
18
21
|
id: 'welcome',
|
|
19
22
|
target: { type: 'welcome' },
|
|
20
23
|
labelKey: 'navigation.goToWelcomePage',
|
|
24
|
+
tooltipKey: navTooltip('welcome'),
|
|
21
25
|
icon: 'BookCheck',
|
|
22
26
|
},
|
|
23
27
|
{
|
|
24
28
|
id: 'explore',
|
|
25
29
|
target: { type: 'explore' },
|
|
26
30
|
labelKey: 'navigation.explore',
|
|
31
|
+
tooltipKey: navTooltip('explore'),
|
|
27
32
|
icon: 'Search',
|
|
28
33
|
},
|
|
29
34
|
{
|
|
30
35
|
id: 'myFeed',
|
|
31
36
|
target: { type: 'feed', feed: 'my' },
|
|
32
37
|
labelKey: 'navigation.myFeed',
|
|
38
|
+
tooltipKey: navTooltip('myFeed'),
|
|
33
39
|
icon: 'Newspaper',
|
|
34
40
|
},
|
|
35
41
|
];
|
|
@@ -38,6 +44,7 @@ export const buildMainNavItems = (caps: MainMenuCapabilities): NavItemDef[] => {
|
|
|
38
44
|
id: 'jams',
|
|
39
45
|
target: { type: 'jams' },
|
|
40
46
|
labelKey: 'navigation.jams',
|
|
47
|
+
tooltipKey: navTooltip('jams'),
|
|
41
48
|
icon: 'PhoneCall',
|
|
42
49
|
});
|
|
43
50
|
}
|
|
@@ -46,48 +53,56 @@ export const buildMainNavItems = (caps: MainMenuCapabilities): NavItemDef[] => {
|
|
|
46
53
|
id: 'groups',
|
|
47
54
|
target: { type: 'groups' },
|
|
48
55
|
labelKey: 'navigation.groups',
|
|
56
|
+
tooltipKey: navTooltip('groups'),
|
|
49
57
|
icon: 'Users',
|
|
50
58
|
},
|
|
51
59
|
{
|
|
52
60
|
id: 'events',
|
|
53
61
|
target: { type: 'events' },
|
|
54
62
|
labelKey: 'navigation.events',
|
|
63
|
+
tooltipKey: navTooltip('events'),
|
|
55
64
|
icon: 'CalendarDays',
|
|
56
65
|
},
|
|
57
66
|
{
|
|
58
67
|
id: 'articles',
|
|
59
68
|
target: { type: 'articles' },
|
|
60
69
|
labelKey: 'navigation.articles',
|
|
70
|
+
tooltipKey: navTooltip('articles'),
|
|
61
71
|
icon: 'ScrollText',
|
|
62
72
|
},
|
|
63
73
|
{
|
|
64
74
|
id: 'resources',
|
|
65
75
|
target: { type: 'resources' },
|
|
66
76
|
labelKey: 'navigation.resources',
|
|
77
|
+
tooltipKey: navTooltip('resources'),
|
|
67
78
|
icon: 'Library',
|
|
68
79
|
},
|
|
69
80
|
{
|
|
70
81
|
id: 'messages',
|
|
71
82
|
target: { type: 'conversation' },
|
|
72
83
|
labelKey: 'navigation.messages',
|
|
84
|
+
tooltipKey: navTooltip('messages'),
|
|
73
85
|
icon: 'MessageSquareText',
|
|
74
86
|
},
|
|
75
87
|
{
|
|
76
88
|
id: 'members',
|
|
77
89
|
target: { type: 'members' },
|
|
78
90
|
labelKey: 'navigation.members',
|
|
91
|
+
tooltipKey: navTooltip('members'),
|
|
79
92
|
icon: 'BookUser',
|
|
80
93
|
},
|
|
81
94
|
{
|
|
82
95
|
id: 'bookmarks',
|
|
83
96
|
target: { type: 'feed', feed: 'bookmarks' },
|
|
84
97
|
labelKey: 'navigation.bookmarks',
|
|
98
|
+
tooltipKey: navTooltip('bookmarks'),
|
|
85
99
|
icon: 'Bookmark',
|
|
86
100
|
},
|
|
87
101
|
{
|
|
88
102
|
id: 'settings',
|
|
89
103
|
target: { type: 'settings' },
|
|
90
104
|
labelKey: 'navigation.settings',
|
|
105
|
+
tooltipKey: navTooltip('settings'),
|
|
91
106
|
icon: 'Settings',
|
|
92
107
|
},
|
|
93
108
|
);
|
|
@@ -96,6 +111,7 @@ export const buildMainNavItems = (caps: MainMenuCapabilities): NavItemDef[] => {
|
|
|
96
111
|
id: 'admin',
|
|
97
112
|
target: { type: 'admin' },
|
|
98
113
|
labelKey: 'navigation.administration',
|
|
114
|
+
tooltipKey: navTooltip('administration'),
|
|
99
115
|
icon: 'Bolt',
|
|
100
116
|
});
|
|
101
117
|
}
|
|
@@ -49,6 +49,8 @@ export type NavItemDef = {
|
|
|
49
49
|
id: string;
|
|
50
50
|
target: NavTarget;
|
|
51
51
|
labelKey: string;
|
|
52
|
+
/** i18n key describing what happens when the item is activated. */
|
|
53
|
+
tooltipKey?: string;
|
|
52
54
|
/** Lucide (or similar) icon component name — host maps to actual icon. */
|
|
53
55
|
icon?: string;
|
|
54
56
|
end?: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import type { CommunityConfig } from '@openpeepshq/common/types';
|
|
3
3
|
import { useT, useSetPageHeader } from '../../../index';
|
|
4
|
+
import { Markdown } from '../../../lib/Markdown';
|
|
4
5
|
import { OpenpeepsMarkdownInput } from '../../../components';
|
|
5
6
|
import { Button, Toast, deepGet, deepSet } from '@openpeepshq/react-ui';
|
|
6
7
|
import { useCommunityConfig } from './useCommunityConfig';
|
|
@@ -55,7 +56,10 @@ export function CommunityMarkdownPage({
|
|
|
55
56
|
|
|
56
57
|
return (
|
|
57
58
|
<div className="flex flex-col gap-4 p-4">
|
|
58
|
-
<
|
|
59
|
+
<Markdown
|
|
60
|
+
source={t(descriptionKey)}
|
|
61
|
+
className="pb-2 pt-4 text-sm text-muted-foreground"
|
|
62
|
+
/>
|
|
59
63
|
<OpenpeepsMarkdownInput
|
|
60
64
|
value={value}
|
|
61
65
|
maxLength={10000}
|
|
@@ -340,6 +340,18 @@ export function Register({ invite = false }: RegisterProps) {
|
|
|
340
340
|
)}
|
|
341
341
|
/>
|
|
342
342
|
|
|
343
|
+
{password && password.length > 0 && (
|
|
344
|
+
<p
|
|
345
|
+
data-testid="auth-register-password-rules"
|
|
346
|
+
className="text-xs text-muted-foreground"
|
|
347
|
+
>
|
|
348
|
+
{t('auth.register.passwordRules', {
|
|
349
|
+
defaultValue:
|
|
350
|
+
'8+ characters, with an uppercase letter, lowercase letter, number, and symbol',
|
|
351
|
+
})}
|
|
352
|
+
</p>
|
|
353
|
+
)}
|
|
354
|
+
|
|
343
355
|
{(password ?? '').length > 0 &&
|
|
344
356
|
(confirmPassword ?? '').length === 0 && (
|
|
345
357
|
<div className="bg-surface border-border flex w-full justify-center rounded py-2">
|
|
@@ -14,6 +14,7 @@ export const EditResource = () => {
|
|
|
14
14
|
postData,
|
|
15
15
|
setPostData,
|
|
16
16
|
resourceTitle,
|
|
17
|
+
canSubmit,
|
|
17
18
|
submitting,
|
|
18
19
|
error,
|
|
19
20
|
clearError,
|
|
@@ -26,14 +27,14 @@ export const EditResource = () => {
|
|
|
26
27
|
title={t('resources.update.title', { defaultValue: 'Update resource' })}
|
|
27
28
|
variant="default"
|
|
28
29
|
action={submit}
|
|
29
|
-
disabled={submitting}
|
|
30
|
+
disabled={submitting || !canSubmit}
|
|
30
31
|
>
|
|
31
32
|
{submitting
|
|
32
33
|
? t('common.saving', { defaultValue: 'Saving…' })
|
|
33
34
|
: t('resources.update.title', { defaultValue: 'Update resource' })}
|
|
34
35
|
</Button>
|
|
35
36
|
),
|
|
36
|
-
[submit, submitting, t],
|
|
37
|
+
[canSubmit, submit, submitting, t],
|
|
37
38
|
);
|
|
38
39
|
|
|
39
40
|
useSetPageHeader(
|
|
@@ -10,6 +10,7 @@ export const NewResource = () => {
|
|
|
10
10
|
postData,
|
|
11
11
|
setPostData,
|
|
12
12
|
canSubmit,
|
|
13
|
+
groupOnly,
|
|
13
14
|
submitting,
|
|
14
15
|
error,
|
|
15
16
|
clearError,
|
|
@@ -40,7 +41,11 @@ export const NewResource = () => {
|
|
|
40
41
|
|
|
41
42
|
return (
|
|
42
43
|
<div className="pb-12">
|
|
43
|
-
<ResourceForm
|
|
44
|
+
<ResourceForm
|
|
45
|
+
postData={postData}
|
|
46
|
+
onChange={setPostData}
|
|
47
|
+
groupOnly={groupOnly}
|
|
48
|
+
/>
|
|
44
49
|
{error ? (
|
|
45
50
|
<div className="px-3">
|
|
46
51
|
<Toast variant="error" onDismiss={clearError}>
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
import { useT, useOpenpeeps, useSetPageHeader } from '../../index';
|
|
3
|
-
import { useCurrentAccount } from '../../components';
|
|
3
|
+
import { useCurrentAccount, useToast } from '../../components';
|
|
4
4
|
import { Button, Input, Label, Toast } from '@openpeepshq/react-ui';
|
|
5
5
|
|
|
6
6
|
export function AccountSettings() {
|
|
7
7
|
const t = useT();
|
|
8
8
|
const { openpeepsApi, client } = useOpenpeeps();
|
|
9
|
+
const { success, error: toastError } = useToast();
|
|
9
10
|
const account = useCurrentAccount();
|
|
10
11
|
const updateAccount = openpeepsApi.updateCurrentAccountAction();
|
|
11
12
|
|
|
@@ -65,6 +66,29 @@ export function AccountSettings() {
|
|
|
65
66
|
}
|
|
66
67
|
};
|
|
67
68
|
|
|
69
|
+
const validateEmail = openpeepsApi.validationEmailAction();
|
|
70
|
+
const [verifying, setVerifying] = useState(false);
|
|
71
|
+
|
|
72
|
+
const handleVerifyEmail = async () => {
|
|
73
|
+
setVerifying(true);
|
|
74
|
+
try {
|
|
75
|
+
await validateEmail();
|
|
76
|
+
success(
|
|
77
|
+
t('settings.account.verifyEmailSent', {
|
|
78
|
+
defaultValue: 'Verification email sent',
|
|
79
|
+
}),
|
|
80
|
+
);
|
|
81
|
+
} catch {
|
|
82
|
+
toastError(
|
|
83
|
+
t('settings.account.verifyEmailError', {
|
|
84
|
+
defaultValue: 'Failed to send verification email',
|
|
85
|
+
}),
|
|
86
|
+
);
|
|
87
|
+
} finally {
|
|
88
|
+
setVerifying(false);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
68
92
|
const exportAccount = async () => {
|
|
69
93
|
setExporting(true);
|
|
70
94
|
try {
|
|
@@ -136,6 +160,32 @@ export function AccountSettings() {
|
|
|
136
160
|
/>
|
|
137
161
|
</div>
|
|
138
162
|
|
|
163
|
+
{!account?.emailValidated ? (
|
|
164
|
+
<div className="space-y-2">
|
|
165
|
+
<p className="text-muted-foreground text-sm">
|
|
166
|
+
{t('settings.account.verifyEmailDescription', {
|
|
167
|
+
defaultValue:
|
|
168
|
+
'Your email is not verified. Resend a verification email.',
|
|
169
|
+
})}
|
|
170
|
+
</p>
|
|
171
|
+
<Button
|
|
172
|
+
title={t('settings.account.verifyEmailButton', {
|
|
173
|
+
defaultValue: 'Verify email',
|
|
174
|
+
})}
|
|
175
|
+
variant="outline"
|
|
176
|
+
action={handleVerifyEmail}
|
|
177
|
+
loading={verifying}
|
|
178
|
+
data-testid="settings-verify-email-button"
|
|
179
|
+
>
|
|
180
|
+
{verifying
|
|
181
|
+
? t('common.submitting', { defaultValue: 'Sending...' })
|
|
182
|
+
: t('settings.account.verifyEmailButton', {
|
|
183
|
+
defaultValue: 'Verify email',
|
|
184
|
+
})}
|
|
185
|
+
</Button>
|
|
186
|
+
</div>
|
|
187
|
+
) : null}
|
|
188
|
+
|
|
139
189
|
<div className="space-y-2">
|
|
140
190
|
<Label htmlFor="newPassword">
|
|
141
191
|
{t('settings.account.newPassword', {
|